
function personal_validate(form1,strDateType) {
			var NAME=document.getElementById('txtName').value //form1.txtName.value;//
			//var FNAME=form1.txtFName.value;
			//var MNAME=form1.txtMName.value;
			
			//var BIRTH_DATE=document.getElementById('txtBirthDate').value//form1.txtBirthDate.value;//			
			var GENDER=document.getElementById('cboGender').value//cboGender			
			var MSTATUS=document.getElementById('cboMStatus').value
			var NATIONALITY=document.getElementById('txtNationality').value//form1.txtNationality.value;//		
			//var RELIGION=form1.txtReligion.value;//document.getElementById('txtReligion').value
			
			var PRESENT_ADD=document.getElementById('txtPresentAdd').value//form1.txtPresentAdd.value//
			//var PERMANENT_ADD=form1.txtPermanentAdd.value
			var PRESENT_LOC=document.getElementById('cboPLocation').options[document.getElementById('cboPLocation').selectedIndex].value;
			
			var PHONE_O=document.getElementById('txtPhone_Off').value//form1.txtPhone_Off.value;//
			var PHONE_H=document.getElementById('txtPhone_H').value//form1.txtPhone_H.value;//
			var MOBILE=document.getElementById('txtMobile').value//form1.txtMobile.value;//
			
			var EMAIL_1 =trim_it(document.getElementById('txtEmail1').value);//form1.txtEmail1.value;//
			var EMAIL_2 =trim_it(document.getElementById('txtEmail2').value); //form1.txtEmail2.value;//
			
			var OBJ=document.getElementById('txtObjective').value//form1.txtObjective.value;//
			var EXPERIENCE=document.getElementById('txtExperience').value; //txtExperience
			var PRESENT_SAL=document.getElementById('txtPresentSalary').value//form1.txtPresentSalary.value;//
			var EXPECTED_SAL=document.getElementById('txtExpectedSalary').value//form1.txtExpectedSalary.value;//
			var KEYWORD=document.getElementById('txtKeyword').value//form1.txtKeyword.value;//
			
			//var USER=form1.txtUserName.value;
			//var PASS1=form1.txtPassword.value;
			//var PASS2=form1.txtRetypePassword.value;
			var PRE_CAT=document.getElementById("selected_Cat").value;
			
			var JOB_LOCATION=document.getElementById("selected_Dist").value;
			//var JOB_LOCATION_OPT=document.form1.optJobArea.value;
			if( NAME == "")//if( NAME1 == "")	
			{       
				alert('Name field cannot be blank!');
				document.getElementById('txtName').focus();
				return false;
			}
             
			// if invalid birth date
			/*if(BIRTH_DATE=="")	
			{       
				alert('Please enter your Date of Birth.');
				//form1.txtBirthDate.focus();
				document.getElementById('txtBirthDate').focus();
				return false;
			}
			else
			{
			var today;
			var birth;
			birth=new Date(BIRTH_DATE);
				today=new Date();
				
				if (today.getFullYear()-birth.getFullYear()<15 ||  today.getFullYear()-birth.getFullYear()>85)
				{
					
					alert('Age must between 15 to 85 years');
					return false;
				}
			}*/
			var dt;
			var dd = '';
			var mm = '';
			var yy = '';
			
			dd = document.getElementById('cboDay1').value;
			mm = document.getElementById('cboMonth1').value;
			yy = document.getElementById('cboYear1').value;				
			dt = mm + "/" + dd + "/" + yy;					
			
			if (isDate(dt, strDateType)==false){
				document.getElementById('cboDay1').focus();
				return false
			}
				//return true;

 			if (GENDER=="-1")//Gender
				{
				alert('Please select gender.');
				document.getElementById('cboGender').focus();
				return false;
				}
			if (MSTATUS=="-1")//Marital Status
				{
				alert('Please select marital status.');
				document.getElementById('cboMStatus').focus();
				return false;
				}
			if(NATIONALITY=="")	// if NATIONALITY==""
			{       
				alert('Check your Nationality.');
				//form1.txtNationality.focus();
				document.getElementById('txtNationality').focus();
				return false;
			}
			
			/*if(RELIGION=="")	// if RELIGION==""
			{       
				alert('Check your Religion.');
				//form1.txtReligion.focus();
				document.getElementById('txtReligion').focus();
				return false;
			}*/
			
			if (PRESENT_ADD=="") // if PRESENT_ADD==""
			{
				alert('Present address field cannot be blank!.');
				document.getElementById('txtPresentAdd').focus();				
				
//form1.txtPresentAdd.focus();
				return false;
			}
			
			if (PRESENT_LOC=="-1") // if PRESENT_LOC==""
			{
				alert('Please select present location.');
				//form1.cboPLocation.focus();
				document.getElementById('cboPLocation').focus();											
				return false;
			}
			 
			if (PHONE_O=="" && PHONE_H=="" && MOBILE=="")  // if PHONE==""
			{
				alert("Please give at least one contact number.");
				//form1.txtPhone_H.focus();
				document.getElementById('txtPhone_H').focus();
				return false;
			}
			
			if(EMAIL_1 == "") // if Emaol==""
			 {
				alert("Please give one valid e-mail address in Email 1 field.");
				//form1.txtEmail1.focus();
				document.getElementById('txtEmail1').focus();
				return false;
	
	          }
	          
			//E-mail validation
			if(EMAIL_1 != "")
			 {
	         	if (validate_email(EMAIL_1,"Not a valid e-mail address!")==false)
					  {
					//form1.txtEmail1.focus();
					document.getElementById('txtEmail1').focus();
					return false}
	         }
			 //alternate email
			 
			 if(EMAIL_2 != "")
			 {
	         	if (validate_email(EMAIL_2,"Not a valid e-mail address!")==false)
					  {
					//form1.
					document.getElementById('txtEmail2').focus();
					return false}
			 }

			if(OBJ=="")
			{
				alert('Objective field cannot be blank!');
//				form1.txtObjective.focus();
				document.getElementById('txtObjective').focus();
				return false;
			}
			if (EXPERIENCE !="")
				{
					if ( parseInt(EXPERIENCE) >70)
					{
					alert('Invalid year of Experience');
					document.getElementById('txtExperience').focus();
					return false;
					}
				}
						
			/*if(EXPECTED_SAL=="")
			{
				alert('Expected salary field cannot be blank!');
				form1.txtExpectedSalary.focus();
				return false;
			}*/
			
			if(PRE_CAT=="")
			{
				alert('You have to select at least one preferred category!');
//				form1.lstWorkArea.focus();
				document.getElementById('lstWorkArea').focus();
				return false;
			 }
			 
			 if (form1.optJobArea[1].checked)
			 {	
			 	
				if (JOB_LOCATION=="")
					{
						alert('Please select preferred Job Area!');
						//form1.
						document.getElementById('lstJobArea').focus();
						return false;
					}
			 }
			
			if(KEYWORD=="")
			{
				alert('Keyword field cannot be blank!');
				//form1.
				document.getElementById('txtKeyword').focus();
				return false;
			}
// this section used only for step_01
			if(document.getElementById('txtUserName'))
				{
					var USER=document.getElementById('txtUserName').value;
					var PASS1=document.getElementById('txtPassword').value;
					var PASS2=document.getElementById('txtRetypePassword').value;

//--------------------------------------------User Name Validation--------------------------------------------------------------------------------
				if (USER=="")
					{
						alert('Please enter user name');
						form1.txtUserName.focus();
						return false;
					}
					
					if (USER.length < 5 )
					{
						alert('User name must be at least 5 characters!');
						form1.txtUserName.focus();
						return false;
					}

//dv.indexOf(';', 0) >= 0

					if (USER.indexOf('/', 0) >= 0 )
					{
						alert('User name does not allow /');
						form1.txtUserName.focus();
						return false;
					}
				// If does not work properly
					if (USER.indexOf("\\", 0) >= 0 )
					{
						alert("User name does not allow '\\'");
						form1.txtUserName.focus();
						return false;
					}

					if (USER.indexOf(';', 0) >= 0 )
					{
						alert('User name does not allow ;');
						form1.txtUserName.focus();
						return false;
					}

					if (USER.indexOf(':', 0) >= 0 )
					{
						alert('User name does not allow :');
						form1.txtUserName.focus();
						return false;
					}

					if (USER.indexOf('&', 0) >= 0 )
					{
						alert('User name does not allow & ');
						form1.txtUserName.focus();
						return false;
					}

					if (USER.indexOf('"', 0) >= 0 )
					{
						alert('User name does not allow "');
						form1.txtUserName.focus();
						return false;
					}

					if (USER.indexOf("'", 0) >= 0 )
					{
						alert("User name does not allow '");
						form1.txtUserName.focus();
						return false;
					}

					if (USER.indexOf(' ', 0) >= 0 )
					{
						alert('User Name should be only one word! No space allowed.');
						form1.txtUserName.focus();
						return false;
					}

//-------------------------------------------Password Validation-------------------------------------------------------------------------------------------			
			if(PASS1=="")
					{
						alert('Please enter your password');
						form1.txtPassword.focus();
						return false;
					}

					if (PASS1.indexOf(' ', 0) >= 0 )
					{
						alert('Password should be only one word!');
						form1.txtPassword.focus();
						return false;
					}

					if (PASS1.indexOf("'", 0) >= 0 )
					{
						alert("Password field does not allow ' ");
						form1.txtPassword.focus();
						return false;
					}

					if (PASS1.indexOf('"', 0) >= 0 )
					{
						alert('Password field does not allow "');
						form1.txtPassword.focus();
						return false;
					}
					if (PASS1.indexOf(';', 0) >= 0 )
					{
						alert('Password field does not allow ;');
						form1.txtPassword.focus();
						return false;
					}
					if (PASS1.indexOf('&', 0) >= 0 )
					{
						alert('Password field does not allow &');
						form1.txtPassword.focus();
						return false;
					}
			
			if(PASS2=="")
					{
						alert('Please re-enter your password.');
						form1.txtRetypePassword.focus();
						return false;
					}
			
			if(PASS1!=PASS2)
					{
						alert('Please be sure of your password \n Enter same password in the fields');
						form1.txtRetypePassword.focus();
						return false;
					}
//-------------------------------End Password Validation----------------------------------------------------------------------------------
				}
} // end of validate func()

function trim_it(string_txt)
{
elem = string_txt ; ///document.getElementById(filename) ;
 while(elem.charAt(0)==' ')// Ltrim
	{
	elem = elem.substring(1,elem.length);
	}
 while(elem.charAt(elem.length - 1)==' ') // rtrim
	{
	elem = elem.substring(0,elem.length - 1);
	}
 return elem ;

}//fnc trim_it

