//code for username
function signupusrrname(username)
{
//alert('zxzxz');	
var ck_username =/^[A-Za-z0-9_. ]{1,20}$/;
if (!ck_username.test(username)) 
{
//usernameerror
document.getElementById('usernameerror').style.display="block";
document.getElementById('usernamecorrect').style.display='none';
document.getElementById('username').style.borderColor = '#F00';
document.getElementById('username').value ="Error: Please enter Valid User Name";
document.getElementById('username').style.color = '#F00';

/*document.getElementById('username').focus();*/
return false;
}
else
{
document.getElementById('usernameerror').style.display="none";
document.getElementById('usernamecorrect').style.display='block';
document.getElementById('username').style.borderColor = '';
document.getElementById('username').style.color = '';
/*document.getElementById('name').focus();*/
return true;
}
}
//code for email addess validation
function signupemail(email)
{
var ck_email=/^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/;
if (!ck_email.test(email)) 
{
//usernameerror
document.getElementById('emailerror').style.display="block";
document.getElementById('emailcorrect').style.display='none';
document.getElementById('email').style.borderColor = '#F00';
document.getElementById('email').value ="Error: Please enter Valid Email Address";
document.getElementById('email').style.color = '#F00';
/*document.getElementById('email').focus();*/
return false;
}
else
{
document.getElementById('emailerror').style.display="none";
document.getElementById('emailcorrect').style.display='block';
document.getElementById('email').style.borderColor = '';
document.getElementById('email').style.color = '';
/*document.getElementById('gender').focus();*/
return true;
}
}
//code for zipcode
function signupzipcode(zipcode)
{
if (document.getElementById('zipcode').value.length !=5) 
{
//usernameerror
document.getElementById('zipcodeerror').style.display="block";
document.getElementById('zipcodecorrect').style.display='none';
document.getElementById('zipcode').style.borderColor = '#F00';
document.getElementById('zipcode').value ="Error: Zipcode upto 5 digits";
document.getElementById('zipcode').style.color = '#F00';
/*document.getElementById('zipcode').focus();*/
return false;
}
else
{
document.getElementById('zipcodeerror').style.display="none";
document.getElementById('zipcodecorrect').style.display='block';
document.getElementById('zipcode').style.borderColor = '';
document.getElementById('zipcode').style.color = '';
/*document.getElementById('center').focus();*/
return true;
}
}
//code for zipcode
function signuppassword(password)
{
if (document.getElementById('password').value.length !=8) 
{
//usernameerror
document.getElementById('passworderror').style.display="block";
document.getElementById('passwordcorrect').style.display='none';
document.getElementById('password').style.borderColor = '#F00';
document.getElementById('password').type="text";
document.getElementById('password').value ="Error: Password upto 8 digits";
/*document.getElementById('password').focus();*/
document.getElementById('password').style.color = '#F00';
return false;
}
else
{
document.getElementById('passworderror').style.display="none";
document.getElementById('passwordcorrect').style.display='block';
document.getElementById('password').style.borderColor = '';
document.getElementById('password').type="password";
document.getElementById('password').style.color = '';
/*document.getElementById('cpassword').focus();*/
return true;
}
}
//code for confirm passwrod
function signupcpassword(cpasswordv)
{
if (document.getElementById('cpassword').value.length !=8 || document.getElementById('cpassword').value != document.getElementById('password').value) 
{
//usernameerror
document.getElementById('cpassworderror').style.display="block";
document.getElementById('cpasswordcorrect').style.display='none';
document.getElementById('cpassword').style.borderColor = '#F00';
/*document.getElementById('cpassword').focus();*/
return false;
}
else
{
document.getElementById('cpassworderror').style.display="none";
document.getElementById('cpasswordcorrect').style.display='block';
document.getElementById('cpassword').style.borderColor = '';
/*document.getElementById('checkbox').focus();*/
return true;
}
}

//code for sinup submit buttun
function signup()
{
var username=document.getElementById('username').value;
if(document.getElementById('username').value == '')
{
alert('Enter Username');	
document.getElementById('username').style.borderColor = '#F00';
document.getElementById('username').focus();
return false;
}
else
{
document.getElementById('username').style.borderColor = '';
} 	
if (document.getElementById('username').value=='Username Already Exist') 
{
alert('Username Already Exist');		
document.getElementById('username').style.borderColor = '#F00';
document.getElementById('username').focus();
return false;
}
else
{
document.getElementById('username').style.borderColor = '';	
}
if (document.getElementById('username').value=='Error: Please enter Valid User Name') 
{
alert('Please enter Valid User Name');		
document.getElementById('username').style.borderColor = '#F00';
document.getElementById('username').focus();
return false;
}
else
{
document.getElementById('username').style.borderColor = '';	
}
//email

var email=document.getElementById('email').value;
if(document.getElementById('email').value == '')
{
alert('Enter Email Address');	
document.getElementById('email').style.borderColor = '#F00';
document.getElementById('email').focus();
return false;
}
else
{
document.getElementById('email').style.borderColor = '';
} 
 var ck_email=/^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/;
 var email_address =document.getElementById('email').value;
 if (!ck_email.test(email_address)) 
{
alert('Enter Valid Email Address');		
document.getElementById('email').style.borderColor = '#F00';
document.getElementById('email').focus();
return false;
}
else
{
document.getElementById('email').style.borderColor = '';	
}
 if (document.getElementById('email').value=='Email Already Exist') 
{
alert('Email Already Exist');		
document.getElementById('email').style.borderColor = '#F00';
document.getElementById('email').focus();
return false;
}
else
{
document.getElementById('email').style.borderColor = '';	
}

//zipcode
var zipcode=document.getElementById('zipcode').value;
if(document.getElementById('zipcode').value == '' || document.getElementById('zipcode').value.length !=5)
{
alert('Enter Zipcode Upto 5 digits');	
document.getElementById('zipcode').style.borderColor = '#F00';
document.getElementById('zipcode').focus();
return false;
}
else
{
document.getElementById('zipcode').style.borderColor = '';
}
//paswword vaildation
var password=document.getElementById('password').value;
if(document.getElementById('password').value == '')
{
alert('Enter Password');	
document.getElementById('password').style.borderColor = '#F00';
document.getElementById('password').focus();
return false;
}
else
{
document.getElementById('password').style.borderColor = '';
}
if(document.getElementById('password').value.length!=8)
{
alert('Password Length must equal to 8');	
document.getElementById('password').style.borderColor = '#F00';
document.getElementById('password').focus();
return false;
}
else
{
document.getElementById('password').style.borderColor = '';
}
var cpassword=document.getElementById('cpassword').value;
if(document.getElementById('cpassword').value == '')
{
alert('Enter Confirm Password');	
document.getElementById('cpassword').style.borderColor = '#F00';
document.getElementById('cpassword').focus();
return false;
}
else
{
document.getElementById('cpassword').style.borderColor = '';
}
if(document.getElementById('cpassword').value.length!=8)
{
alert('Password Length must equal to 8');	
document.getElementById('cpassword').style.borderColor = '#F00';
document.getElementById('cpassword').focus();
return false;
}
else
{
document.getElementById('cpassword').style.borderColor = '';
}


if(document.getElementById('cpassword').value !=document.getElementById('password').value)
{
alert("Password Doesn't Match");	
document.getElementById('cpassword').style.borderColor = '#F00';
document.getElementById('cpassword').focus();
return false;
}
else
{
document.getElementById('cpassword').style.borderColor = '';
}
//capcha validation
/*if(document.getElementById('captcha').value=='')
{
alert("Enter Captcha Code");	
document.getElementById('captcha').style.borderColor = '#F00';
document.getElementById('captcha').focus();
return false;
}
else
{
document.getElementById('captcha').style.borderColor = '';
}

alert(document.getElementById('g-recaptcha').value);
alert(form.g-recaptcha.value);
 if(!form.captcha.value.match(/^\d{5}$/)) {
      alert('Please Enter The Captcha Digits In The Box Provided');
	  document.getElementById('captcha').style.borderColor = '#F00';
	  document.getElementById('captcha').focus();
      //form.captcha.focus();
      return false;
    }*/
	
if(!document.getElementById('checkbox').checked)
{
alert("Pleass Check Terms And Conditions");	
document.getElementById('checkbox').style.borderColor = '#F00';
document.getElementById('checkbox').focus();
return false;
}
else
{
document.getElementById('checkbox').style.borderColor = '';
}
return true;
}

//isnumber validation for
function isNumberKey(evt,f)
{
	
          var charCode = (evt.which) ? evt.which : event.keyCode;
          if (charCode != 46 && charCode > 31
            && (charCode < 48 || charCode > 57))
             return false;


          return true;
}