function validate()
{
if(document.career.salutation.value=="Select")
{
    alert("Please select your salutation");   
    document.career.salutation.focus();
    return false;
}
if(document.career.fname.value=="")
{
    alert("Please enter your first name");   
    document.career.fname.focus();
    return false;
}
if (!document.career.gender[0].checked && !document.career.gender[1].checked) 
{
	alert("Please Select your Gender");   
	return false;
}
if(document.career.date.value=="")
{
    alert("Please Select your date of birth");   
    document.career.date.focus();
    return false;
}
if(document.career.month.value=="")
{
    alert("Please Select your month of birth");   
    document.career.month.focus();
    return false;
}
if(document.career.year.value=="")
{
    alert("Please Select your year of birth");   
    document.career.year.focus();
    return false;
}
if(document.career.maritalstatus.value=="")
{
    alert("Please select your marital status");   
    document.career.maritalstatus.focus();
    return false;
}  
 if(document.career.address.value=="")
{
    alert("Please enter your address");   
    document.career.address.focus();
    return false;
}

if (document.career.country.value=="select")
	{
	alert ("Please select your Country!")
	document.career.country.focus()
	return false
	}
	
 function IsNumeric(sText)
	{
		var ValidChars = "0123456789.";
		var IsNumber=true;
		var Char;
			
		for (i = 0; i < sText.length && IsNumber == true; i++) 
		  { 
			  Char = sText.charAt(i); 
			  if (ValidChars.indexOf(Char) != -1) 
				{
			        IsNumber = "false";
					alert ("Please enter characters only.");						
				}
		  }
	   return IsNumber;   
	}//character validation
 
 if (document.career.city.value=="")
			{
				alert("Please enter your city");
				document.career.city.focus();
				return false;
			}
			else (document.career.city.value!="")
			{
				var mytext=document.career.city.value;
				var number=IsNumeric(mytext);
				if (number=="false")
				{
					document.career.city.value="";
	                document.career.city.focus();
	                return false;
				}
			}// city validation
 
	if(document.career.state.value!="")
			{
				var mytext=document.career.state.value;
				var number=IsNumeric(mytext);
				if (number=="false")
				{
					document.career.state.value="";
	                document.career.state.focus();
	                return false;
				}
		}// sate validation
 
 //pincode
 if(document.career.pincode.value=="")
{
    alert("Please enter your pincode");   
    document.career.pincode.focus();
    return false;
}

str10 = document.career.pincode.value
	if (str10=="")
	{
	alert("Please fill Pincode field")
	document.career.pincode.focus()
	return false
	}
	else{
    for (var i = 0; i < str10.length; i++) {
		var ch = str10.substring(i, i + 1);
		if (ch < "0" || "9" < ch) 
		{
		if(ch==" "){}
		else {
			alert("\nThe Pincode field only accepts integers.\n\nPlease re-enter your pincode..");
			document.career.pincode.focus();		
			document.career.pincode.select();		
			return false;
			}
		}
		}
	} /// pincode

 if(document.career.contactno.value=="")
{
    alert("Please enter your Telephone No.");   
    document.career.contactno.focus();
    return false;
}

var str11 = document.career.contactno.value
	if (str11 == "") 
		{
			alert("The phone field is blank.\n\nPlease fill the phone field.")
			document.career.contactno.focus();		
			return false;
		}//if

	if (str11.indexOf("+") != 0) 
		{
			alert("Value of phone field should be as shown in e.g.\n\nPlease re-enter the phone field.")
			document.career.contactno.focus();		
			return false;
		}//if
	if (str11.indexOf("-") == -1) 
	{
		alert("Value of phone field should be as shown in e.g.\n\nPlease re-enter the phone field.")
		document.career.contactno.focus();		
		return false;
	}
	for (var i = 0; i < str11.length; i++) 
	{
		var ch = str11.substring(i, i + 1);
		if ( (ch == "+") || (ch == "-" ) || (ch == " " ))
		{
		}//if
		else if (ch < "0" || "9" < ch)  
		{
			alert("The phone field only accepts integers.\n\nPlease re-enter your phone no.")
			document.career.contactno.select();		
			document.career.contactno.focus();		
			return false;
		}//else if
	}//tel

	var str12 = document.career.off_contact.value
	if (str12 !="") 
   {
			if (str12.indexOf("+") != 0) 
				{
					alert("Value of office phone field should be as shown in e.g.\n\nPlease re-enter the office phone field.")
					document.career.off_contact.focus();		
					return false;
				}//if
			if (str12.indexOf("-") == -1) 
			{
				alert("Value of office phone field should be as shown in e.g.\n\nPlease re-enter the office phone field.")
				document.career.off_contact.focus();		
				return false;
			}
			for (var i = 0; i < str12.length; i++) 
			{
				var ch = str12.substring(i, i + 1);
				if ( (ch == "+") || (ch == "-" ) || (ch == " " ))
				{
				}//if
				else if (ch < "0" || "9" < ch)  
				{
					alert("The office phone field only accepts integers.\n\nPlease re-enter your office phone no.")
					document.career.off_contact.select();		
					document.career.off_contact.focus();		
					return false;
				}//else if
			}//tel
		} // off tel

var str13 = document.career.fax.value
	if (str13 !="") 
   {
			 /*if (str13.indexOf("+") != 0) 
				{
					alert("Value of fax field should be as shown in e.g.\n\nPlease re-enter the fax field.")
					document.career.fax.focus();		
					return false;
				}//if
			if (str13.indexOf("-") == -1) 
			{
				alert("Value of fax field should be as shown in e.g.\n\nPlease re-enter the fax field.")
				document.career.fax.focus();		
				return false;
			} */
			for (var i = 0; i < str13.length; i++) 
			{
				var ch = str13.substring(i, i + 1);
				if ( (ch == "+") || (ch == "-" ) || (ch == " " ))
				{
				}//if
				else if (ch < "0" || "9" < ch)  
				{
					alert("The fax field only accepts integers.\n\nPlease re-enter your fax no.")
					document.career.fax.select();		
					document.career.fax.focus();		
					return false;
				}//else if
			}//tel
		} // off tel
	
if(document.career.email.value=="")
{
    alert("Please enter your email address");
    document.career.email.focus();
    return false;
}
    var str =/[-a-zA-Z0-9_\.]+@[-a-zA-Z0-9]+\.[-a-zA-Z0-9\.]+/;
    var eflag = document.career.email.value.match(str);
    if(eflag!=document.career.email.value)
		{
			alert("Please enter a valid email address")
			document.career.email.focus();
			document.career.email.select();
			return false;
		}
if(document.career.jobposition.value=="")
{
    alert("Please select your job position");   
    document.career.jobposition.focus();
    return false;
}
if(document.career.designation.value=="")
{
    alert("Please select your designation");   
    document.career.designation.focus();
    return false;
}


if(!document.career.exp[0].checked && !document.career.exp[1].checked) 
{
	alert("Please Select your Previous Work Experience.");   
	return false;
}
if(document.career.exp[0].checked)
{
    /*
    if(document.career.ex_cname.value=="")
    {
        alert("Please enter your company name of work experience");
        document.career.ex_cname.focus();
        return false;
    }
     if(document.career.ex_desig.value=="")
    {
        alert("Please enter your designation of work experience");
        document.career.ex_desig.focus();
        return false;
    }       
     if(document.career.ex_roll.value=="")
    {
        alert("Please enter your role of work experience");
        document.career.ex_roll.focus();
        return false;
    }
    */
}

var NameFilter=/^[a-zA-Z ]+$/;
var NoFilter=/^[0-9+ -]*$/;

if(!(NoFilter.test(document.career.pincode.value)))
{
    alert("Please enter only numbers");
    document.career.pincode.value="";
    document.career.pincode.focus();
    return false;
}			
if(!(NoFilter.test(document.career.contactno.value)))
{
    alert("Please enter only numbers");
    document.career.contactno.value="";
    document.career.contactno.focus();
    return false;
}			
if(!(NoFilter.test(document.career.off_contact.value)))
{
    alert("Please enter only numbers");
    document.career.off_contact.value="";
    document.career.off_contact.focus();
    return false;
}			
if(!(NoFilter.test(document.career.fax.value)))
{
    alert("Please enter only numbers");
    document.career.fax.value="";
    document.career.fax.focus();
    return false;
}			

str = document.career.txtresume.value;
if(document.career.txtresume.value !="") 
{
   start=str.indexOf(".")
   last=str.length
   str1=str.substring(start+1,last)
   if(str1!="rtf" && str1!="txt" && str1!="doc")
   {
      alert("Please select a file with .rtf or .txt or .doc extension.")
      return false;
   }
}
    
    
    document.career.action="submit.php";
    document.career.submit();
} 
function reset()
{
    document.career.reset();
}
function ena()
{
    document.career.ex_cname.disabled=false;
    document.career.ex_desig.disabled=false;
    document.career.ex_country.disabled=false;
    document.career.ex_city.disabled=false;
    document.career.ex_roll.disabled=false;
    document.career.ex_periodfrm_date.disabled=false;
    document.career.ex_periodfrm_month.disabled=false;
    document.career.ex_periodfrm_year.disabled=false;
    document.career.ex_periodto_date.disabled=false;
    document.career.ex_periodto_month.disabled=false;
    document.career.ex_periodto_year.disabled=false;
}
function dis()
{
    document.career.ex_cname.disabled=true;
    document.career.ex_desig.disabled=true;
    document.career.ex_country.disabled=true;
    document.career.ex_city.disabled=true;
    document.career.ex_roll.disabled=true;
    document.career.ex_periodfrm_date.disabled=true;
    document.career.ex_periodfrm_month.disabled=true;
    document.career.ex_periodfrm_year.disabled=true;
    document.career.ex_periodto_date.disabled=true;
    document.career.ex_periodto_month.disabled=true;
    document.career.ex_periodto_year.disabled=true;
}