// form checkings
function checkLoginForm()
{
var username = trim(document.theloginform.username.value);
var password = trim(document.theloginform.password.value);
var errormsg = "";
if(username.length==0)
errormsg+="Username should not be empty.
";
if(password.length==0)
errormsg+="Password should not be empty.
";
if(errormsg.length>0)
{
setErrorMsg(errormsg,"loginerrormsg");
}else
document.theloginform.submit();
}
function checkForgotPassword()
{
var email = trim(document.forgotpasswordform.email.value);
var mobile = trim(document.forgotpasswordform.mobile.value);
var birthyear = trim(document.forgotpasswordform.birthyear.value);
var errormsg="";
if(email.length==0 && mobile.length==0)
errormsg+="You should enter either your email or mobile to retrieve password.
";
else if(email.length>0)
{
if(!validateEmail(email))
errormsg+="Email is invalid.
";
}else if(mobile.length>0)
{
if(!isNumeric(mobile))
errormsg+="Mobile Number should only contain numeric digits.
";
else if(mobile.length < 10)
errormsg+="Mobile Number should be 10 digits.
";
}
if(birthyear.length==0)
errormsg+="Birth year should not be empty.
";
else if(!isNumeric(birthyear))
errormsg+="Birth day should not be empty.
";
if(errormsg.length>0)
setErrorMsg(errormsg,"forgotpassworderrormsg");
else
document.forgotpasswordform.submit();
}
function checkSignUp()
{
//var mobile = trim(document.signupform.mobile.value);
var username = document.signupform.username.value;
var email = trim(document.signupform.email.value);
var errormsg="";
/*
if(mobile.length==0)
errormsg+="Mobile Number should not be empty.
";
else if(!isNumeric(mobile))
errormsg+="Mobile Number should only contain numeric digits.
";
else if(mobile.length < 10)
errormsg+="Mobile Number should be 10 digits.
";
*/
if(email.length==0)
{ errormsg+="error";
document.getElementById("validateemail").innerHTML="Email is invalid.";
}
else if(!validateEmail(email))
{ errormsg+="error";
document.getElementById("validateemail").innerHTML="Email is invalid.";
}
if(username.length==0)
{ errormsg+="error";
document.getElementById("validateusername").innerHTML="Username should not be empty.";
}
else if(username.indexOf(" ",0)!=-1)
{ errormsg+="error";
document.getElementById("validateusername").innerHTML="Username should not contain special characters or any spaces.
";
}else if(validUsername(username)==false)
{
errormsg+="error";
document.getElementById("validateusername").innerHTML="Username should not contain special characters or any spaces.
";
}
if(errormsg.length>0)
{ //setErrorMsg(errormsg,"signuperrormsg");
}else
document.signupform.submit();
}
function validUsername(username)
{ var i=0;
for(i=0; i 0 && username.charCodeAt(i) < 48) || (username.charCodeAt(i) > 57 && username.charCodeAt(i) < 65) || (username.charCodeAt(i) > 90 && username.charCodeAt(i) < 95) || (username.charCodeAt(i) > 95 && username.charCodeAt(i) < 97) || username.charCodeAt(i) > 122)
return false;
}return true;
}
function checkInviteUsers()
{
var totalinvites = 0;
var errormsg = "";
for(var i=1; i<=10; i++)
{
var mobile = trim(document.inviteform['mobile'+i].value);
var email = trim(document.inviteform['email'+i].value);
if(mobile.length>0 || email.length>0)
{ totalinvites++;
if(mobile.length>0 && !isNumeric(mobile))
errormsg+="Mobile "+i+" should only contain digits.
";
else if(mobile.length>0 && mobile.length<10)
errormsg+="Mobile "+i+" should at least be a 10 digits.
";
if(email.length>0 && !validateEmail(email))
errormsg+="Email "+i+" is invalid.
";
}
}
if(totalinvites==0)
errormsg+="You should at least enter one invitee.
";
if(errormsg.length>0)
setErrorMsg(errormsg,"inviteuserserrormsg");
else
document.inviteform.submit();
}
function checkRegister()
{
var screenname = trim(document.theform.screenname.value);
var birthmonth = trim(document.theform.birthmonth.value);
var birthday = trim(document.theform.birthday.value);
var phone = trim(document.theform.phone.value);
var password = trim(document.theform.password.value);
var repassword = trim(document.theform.repassword.value);
var zip = trim(document.theform.zip.value);
var errormsg="";
if(screenname.length==0)
errormsg+="Screen Name should not be empty.
";
else if(!validUsername(screenname))
errormsg+="Screen name should not contain special characters.
";
if(birthmonth.length==0)
errormsg+="Birth month should not be empty.
";
else if(!isNumeric(birthmonth))
errormsg+="Birth month should only contain numeric digits.
";
if(birthday.length==0)
errormsg+="Birth day should not be empty.
";
else if(!isNumeric(birthday))
errormsg+="Birth day should only contain numeric digits.
";
if(phone.length>0)
{
if(phone.length<10)
errormsg+="Mobile Number should only contain numeric digits.
";
else if(!isNumeric(phone))
errormsg+="Mobile Number should be 10 digits.
";
}
if(password.length>0 && password != repassword)
{ errormsg+="Passwords does not match.
";
document.theform.password.value="";
document.theform.repassword.value="";
}
if(zip.length==0)
errormsg+="Zip should not be empty.
";
else if(!isNumeric(zip))
errormsg+="Zip code should only contain numeric digits.
";
if(errormsg.length>0)
setErrorMsg(errormsg,"registererrormsg");
else
document.theform.submit();
}
function checkEditBasic()
{
var screenname = trim(document.theeditbasicform.screenname.value);
var birthmonth = trim(document.theeditbasicform.birthmonth.value);
var birthday = trim(document.theeditbasicform.birthday.value);
var zip = trim(document.theeditbasicform.zip.value);
var errormsg="";
if(screenname.length==0)
errormsg+="Screen Name should not be empty.
";
else if(!validUsername(screenname))
errormsg+="Screen name should not contain special characters.
";
if(birthmonth.length==0)
errormsg+="Birth month should not be empty.
";
else if(!isNumeric(birthmonth))
errormsg+="Birth month should only contain numeric digits.
";
if(birthday.length==0)
errormsg+="Birth day should not be empty.
";
else if(!isNumeric(birthday))
errormsg+="Birth day should only contain numeric digits.
";
if(zip.length==0)
errormsg+="Zip should not be empty.
";
else if(!isNumeric(zip))
errormsg+="Zip code should only contain numeric digits.
";
else if(zip.length>5)
errormsg+="Please enter a valid 5 digit zip code.
";
if(errormsg.length>0)
setErrorMsg(errormsg,"theeditbasicformerrormsg");
else
document.theeditbasicform.submit();
}
function checkEditAccount()
{
var phone = trim(document.editaccountform.phone.value);
var email = trim(document.editaccountform.email.value);
var password = trim(document.editaccountform.password.value);
var repassword = trim(document.editaccountform.repassword.value);
var errormsg="";
if(phone.length>0)
{
if(!isNumeric(phone))
errormsg+="Mobile Number should only contain numeric digits.
";
else if(phone.length<10)
errormsg+="Mobile Number should be 10 digits.
";
}
if(email.length==0)
errormsg+="Email should not be empty.
";
else if(!validateEmail(email))
errormsg+="Email is invalid.
";
if(password.length>0 && password != repassword)
{ errormsg+="Passwords does not match.
";
document.editaccountform.password.value="";
document.editaccountform.repassword.value="";
}
if(errormsg.length>0)
setErrorMsg(errormsg,"editaccounterrormsg");
else
document.editaccountform.submit();
}
function checkSendMessage()
{
var message = trim(document.sendmessageform.message.value);
var subject = trim(document.sendmessageform.subject.value);
var errormsg="";
if(subject.length==0)
errormsg+="Subject should not be empty.
";
if(message.length==0)
errormsg+="Message should not be empty.
";
if(errormsg.length>0)
setErrorMsg(errormsg,"sendmessageerrormsg");
else
document.sendmessageform.submit();
}
function checkFeedBack()
{
var name = document.feedbackform.name.value;
var email = trim(document.feedbackform.email.value);
var message = trim(document.feedbackform.message.value);
var errormsg = "";
if(trim(name).length==0)
errormsg+="Name should not be empty.
";
if(email.length==0)
errormsg+="Email should not be empty.
";
else if(!validateEmail(email))
errormsg+="Email is invalid.
";
if(trim(message).length==0)
errormsg+="Message should not be empty.
";
if(errormsg.length>0)
setErrorMsg(errormsg,"feedbackerrormsg");
else
document.feedbackform.submit();
}
function checkSearchUser()
{
var screenname = document.searchuserform.screenname.value;
var errormsg="";
if(trim(screenname).length==0)
errormsg+="Screen Name should not be empty.
";
if(errormsg.length>0)
setErrorMsg(errormsg,"searchusererrormsg");
else
document.searchuserform.submit();
}