function onSubmit()
{		
if(document.registration.username.value.length==0)
{
alert('Please enter a User name.');
document.registration.username.focus();
return false;
}
try{
if(document.getElementById("available").value=="-1")
{
alert("Please check the availability of user name.");	
document.registration.username.focus();
return false;
}
if(document.getElementById("available").value=="0")
{
alert("User name: "+document.registration.username.value+" is already exist.");	
document.registration.username.focus();
return false;
}
}catch(e){alert("Please check the availability of username");document.getElementById("chk").focus();return false;}
var emailRegEx = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
if(!(document.registration.username.value).match(emailRegEx))
{
alert('Please enter a valid email address as your user name');
document.registration.username.focus();
return false;
}
var pwd=document.registration.password.value;
var cpwd=document.registration.confirm_password.value;
if(pwd.length==0)
{
alert('Please enter the password.');
document.registration.password.focus();
return false;
}
if(cpwd.length==0)
{
alert('Please confirm password.');
document.registration.confirm_password.focus();
return false;
}
if(pwd!=cpwd)
{
alert("Please enter the Password and Confirm Password");
return false;
}
if(document.registration.username.value.length==0)
{
alert("Please enter your Name");
document.registration.username.focus();
return false;
}
if(document.registration.address.value.length==0)
{
alert("Please enter your Address");
document.registration.address.focus();
return false;
}
if(document.registration.city.value=='-1')
{
alert("Please select your City");
document.registration.city.focus();
return false;
}
if(document.registration.state.value=='-1')
{
alert("Please select your State");
document.registration.state.focus();
return false;
}
if(document.registration.zipcode.value.length==0)
{
alert("Please enter your Pincode");
document.registration.zipcode.focus();
return false;
}
if(isNaN(document.registration.zipcode.value))
{
alert("Please enter the valid pin code");
document.registration.zipcode.focus();
return false;
}
if(document.registration.zipcode.value.length!=6)
{
alert("Pincode must have 6 digits only");
document.registration.zipcode.focus();
return false;
}
if(document.registration.mobileno.value.length==0)
{
alert("Please enter your Mobile number");
document.registration.mobileno.focus();
return false;
}
if(document.registration.mobileno.value.length<10)
{
alert("mobileno must have atlease 10 digits");
document.registration.mobileno.focus();
return false;
}
var regexLetter = /[a-zA-z]/;
if(regexLetter.test(document.registration.mobileno.value))
{
alert('Please enter the valid mobile number');
document.registration.mobileno.focus();
return false;
}
isInteger_re     = /^\s*(\+|-)?\d+\s*$/;
if(!isInteger(document.registration.mobileno.value))
{
alert("Please enter the valid mobile number" );
document.registration.mobileno.focus();
return false;
}
if(document.registration.emailid.value.length==0)
{
alert('Please enter your email address.');
document.registration.emailid.focus();
return false;
}
if(!(document.registration.emailid.value).match(emailRegEx))
{
alert('Please enter a valid email address.');
document.registration.emailid.focus();
return false;
}
if(document.registration.totalyrs.value=='-1')
{
alert("Please select the total years you have worked");
document.registration.totalyrs.focus();
return false;
}
if(document.registration.totalmonths.value=='-1')
{
alert("Please select total months you have worked");
document.registration.totalmonths.focus();
return false;
}
if(document.registration.curlacs.value=='-1')
{
alert("Please select current salary in lakhs");
document.registration.curlacs.focus();
return false;
}
if(document.registration.curthous.value=='-1')
{
alert("Please select current salary in thousands");
document.registration.curthous.focus();
return false;
}
if(document.registration.desiredjob.value=='-1')
{
alert("Please select the desired job");
document.registration.desiredjob.focus();
return false;
}
if(document.registration.funarea.value=='-1')
{
alert("Please select the functional area");
document.registration.funarea.focus();
return false;
}
if(document.registration.industry.value=='-1')
{
alert("Please select the industry type");
document.registration.industry.focus();
return false;
}
if(document.registration.desiredjob.value=='-1')
{
alert("Please select the desired job");
document.registration.desiredjob.focus();
return false;
}
if(document.registration.keyskills.value.length==0)
{
alert('Please enter your key skills.');
document.registration.keyskills.focus();
return false;
}
if(document.registration.service_type.value==-1)
{
alert('Please select the service type.');
document.registration.service_type.focus();
return false;
}
if(document.registration.resumeheading.value.length==0)
{
alert('Please enter the resume heading.');
document.registration.resumeheading.focus();
return false;
}
if(document.registration.qualification.value=='-1')
{
alert("Please select your qualification");
document.registration.qualification.focus();
return false;
}
if(document.registration.docmajor.value=='-1')
{
alert("Please select your department");
document.registration.docmajor.focus();
return false;
}
if(document.registration.docuniv.value=='-1')
{
alert("Please select the university");
document.registration.docuniv.focus();
return false;
}
if(document.registration.year_passing.value=='-1')
{
alert("Please select the year of passing");
document.registration.year_passing.focus();
return false;
}
if(document.registration.gender.value=='-1')
{
alert("Please select your gender");
document.registration.gender.focus();
return false;
}
if(document.registration.doccgp.value.length==0)
{
alert("Please enter your percentage");
document.registration.doccgp.focus();
return false;
}
var percent=document.registration.doccgp.value;
var validRegEx=/^\d*\.{0,1}\d+$/;
if(!percent.match(validRegEx))
{
alert("Please enter valid percentage");
document.registration.doccgp.focus();
return false;
}
if(document.registration.available.value==0)
{
alert("User name already exist. Please try another user name");
document.registration.username.focus();
return false;
}
if(document.registration.uploadify.value.lastIndexOf(".doc")==-1)
{
alert("Upload only word document files.");
document.registration.uploadify.focus();
return false;
}
//document.registration.submit();
}
	
function removeSpace(strField)
{strField.value=strField.value.replace(/\s+/g,"");}
function isInteger(s) {return String(s).search (isInteger_re) != -1}
function escapeNow(field){document.getElementById(field).value=escape(field.value);}
function unescapeNow(str){document.getElementById(field).value=unescape(field.value);}
function removeSplChars(field){var temp=/[^a-zA-Z 0-9.]+/g;field.value =  field.value.replace(temp,'');}
function removeSplsNotComma(field){var temp=/[^a-zA-Z 0-9.,]+/g;field.value =  field.value.replace(temp,'');}
function setReference()
{
 if(document.getElementById("yes").checked==true)
 {
  document.getElementById("referencequestion").value="yes";
  //alert(document.getElementById("referencequestion").value);
 }
 if(document.getElementById("no").checked==true)
 {
document.getElementById("referencequestion").value="no";//alert(document.getElementById("referencequestion").value);
 }
}
function setAgentState()
{
var agentstate=document.getElementById("citydrop").value;
document.registration.refstates.value=agentstate;
//alert(document.registration.refstates.value);
}
function setAgentName()
{
var agentname=document.getElementById("agentid").value;
document.registration.agentname.value=agentname;
//alert(document.registration.agentname.value);		
}
function setSource()
{
document.registration.source.value=document.getElementById("sourceid").value;
//alert(document.registration.source.value);
}
function removeQuotes(field)
{
var temp=/[\"\']/g;
field.value =  field.value.replace(temp,'');
}
function getCapt(){
		var x=""+Math.random()*9876543210;
		document.getElementById("capt").src="/Captcha.jsp?rand="+x.substr(0,5);
}
	
	