function validate_master()
{
	var flag = true
	if ((flag) && (document.frm.txtUsername.value == "")){
		alert("Please enter username.");
		document.frm.txtUsername.focus();
		flag = false;
		return false;
	}
	if ((flag) && (document.frm.txtPassword.value == "")){
		alert("Please enter password.");
		document.frm.txtPassword.focus();
		flag = false;
		return false;
	}
	if ((flag) && (document.frm.txtPassword.value != document.frm.txtConfirm_Password.value)){
		alert("Please enter valid confirm password.");
		document.frm.txtConfirm_Password.focus();
		flag = false;
		return false;
	}			
	if ((flag) && (document.frm.txtCompany_Name.value == ""))
	{
		alert("Please enter company name.");
		document.frm.txtCompany_Name.focus();
		flag = false;	
		return false;
	}
	if ((flag) && parseInt(document.frm.txtAddress.length > 100))
	{
		alert("Please enter Company Address less then 100 characters.");
		document.frm.txtAddress.focus();
		flag = false;	
		return false;
	}	
	if ((flag) && (document.frm.txtTel.value == ""))
	{
		alert("Please enter Company Tel.");
		document.frm.txtTel.focus();
		flag = false;	
		return false;
	}
	if ((flag) && (document.frm.txtEmail.value == ""))
	{
		alert("Please enter Company Email.");
		document.frm.txtEmail.focus();
		flag = false;	
		return false;
	}	
	if ((flag) && (document.frm.drpCountry_ID.value == "0"))
	{
		alert("Please select Company Country.");
		document.frm.drpCountry_ID.focus();
		flag = false;	
		return false;
	}
	if ((flag) && (document.frm.drpMembership_Type.value == "0"))
	{
		alert("Please select Membership Type.");
		document.frm.drpMembership_Type.focus();
		flag = false;	
		return false;
	}
	if ((flag) && (document.frm.txtProfile.value == ""))
	{
		alert("Please enter Company Profile.");
		document.frm.txtProfile.focus();
		flag = false;	
		return false;
	}	
	if ((flag) && parseInt(document.frm.txtProfile.length > 3000))
	{
		alert("Please enter Company Profile less then 3000 characters.");
		document.frm.txtProfile.focus();
		flag = false;	
		return false;
	}
	if ((flag) && (document.frm.txtContact_Person.value == ""))
	{
		alert("Please enter Contact Person.");
		document.frm.txtContact_Person.focus();
		flag = false;	
		return false;
	}
	if ((flag) && (document.frm.txtContact_Designation.value == ""))
	{
		alert("Please enter Contact Designation.");
		document.frm.txtContact_Designation.focus();
		flag = false;	
		return false;
	}
	if ((flag) && parseInt(document.frm.txtContact_Address.length > 100))
	{
		alert("Please enter Contact Address less then 100 characters.");
		document.frm.txtAddress.focus();
		flag = false;	
		return false;
	}		
	if ((flag) && (document.frm.txtContact_Email.value == ""))
	{
		alert("Please enter Contact Email.");
		document.frm.txtContact_Email.focus();
		flag = false;	
		return false;
	}	
	if ((flag) && (document.frm.txtHint_Answer.value == ""))
	{
		alert("Please enter valid Hint Answer.");
		document.frm.txtHint_Answer.focus();
		flag = false;	
		return false;
	}
	if (flag)
	{
		return true;
	}
}



function validate_personal()
{
	var flag = true
	if ((flag) && (document.frm.txtCompany_Name.value == ""))
	{
		alert("Please enter company name.");
		document.frm.txtCompany_Name.focus();
		flag = false;	
		return false;
	}
	if ((flag) && parseInt(document.frm.txtAddress.length > 100))
	{
		alert("Please enter Company Address less then 100 characters.");
		document.frm.txtAddress.focus();
		flag = false;	
		return false;
	}	
	if ((flag) && (document.frm.txtTel.value == ""))
	{
		alert("Please enter Company Tel.");
		document.frm.txtTel.focus();
		flag = false;	
		return false;
	}
	if ((flag) && (document.frm.txtEmail.value == ""))
	{
		alert("Please enter Company Email.");
		document.frm.txtEmail.focus();
		flag = false;	
		return false;
	}	
	if ((flag) && (document.frm.drpCountry_ID.value == "0"))
	{
		alert("Please select Company Country.");
		document.frm.drpCountry_ID.focus();
		flag = false;	
		return false;
	}
	if ((flag) && (document.frm.drpMembership_Type.value == "0"))
	{
		alert("Please select Membership Type.");
		document.frm.drpMembership_Type.focus();
		flag = false;	
		return false;
	}
	if ((flag) && (document.frm.txtProfile.value == ""))
	{
		alert("Please enter Company Profile.");
		document.frm.txtProfile.focus();
		flag = false;	
		return false;
	}	
	if ((flag) && parseInt(document.frm.txtProfile.length > 3000))
	{
		alert("Please enter Company Profile less then 3000 characters.");
		document.frm.txtProfile.focus();
		flag = false;	
		return false;
	}
	if ((flag) && (document.frm.txtContact_Person.value == ""))
	{
		alert("Please enter Contact Person.");
		document.frm.txtContact_Person.focus();
		flag = false;	
		return false;
	}
	if ((flag) && (document.frm.txtContact_Designation.value == ""))
	{
		alert("Please enter Contact Designation.");
		document.frm.txtContact_Designation.focus();
		flag = false;	
		return false;
	}
	if ((flag) && parseInt(document.frm.txtContact_Address.length > 100))
	{
		alert("Please enter Contact Address less then 100 characters.");
		document.frm.txtAddress.focus();
		flag = false;	
		return false;
	}		
	if ((flag) && (document.frm.txtContact_Email.value == ""))
	{
		alert("Please enter Contact Email.");
		document.frm.txtContact_Email.focus();
		flag = false;	
		return false;
	}	
	if (flag)
	{
		return true;
	}
}

function validate_vacancy()
{
	var flag = true
	if ((flag) && (document.frm.txtJob_Code.value == "")){
		alert("Please enter Job Code.");
		document.frm.txtJob_Code.focus();
		flag = false;
	}	
	if ((flag) && (document.frm.txtJob_Title.value == "")){
		alert("Please enter Job Title.");
		document.frm.txtJob_Title.focus();
		flag = false;
	}
	if ((flag) && (document.frm.txtDesignation.value == "")){
		alert("Please enter Vacancy Designation.");
		document.frm.txtDesignation.focus();
		flag = false;
	}
	if ((flag) && (document.frm.drpIndustry_ID.value == "0")){
		alert("Please select Industry.");
		document.frm.drpIndustry_ID.focus();
		flag = false;
	}
	if ((flag) && (document.frm.drpFunctional_ID.value == "0")){
		alert("Please select Functional.");
		document.frm.drpFunctional_ID.focus();
		flag = false;
	}				
	if ((flag) && (document.frm.drpJob_Type.value == "0")){
		alert("Please select Job Type.");
		document.frm.drpJob_Type.focus();
		flag = false;
	}
	if ((flag) && (document.frm.txtKeywords.value == "")){
		alert("Please enter Keywords.");
		document.frm.txtKeywords.focus();
		flag = false;
	}						
	if ((flag) && (document.frm.drpQualification_ID.value == "0")){
		alert("Please select Qualification.");
		document.frm.drpQualification_ID.focus();
		flag = false;
	}
	if ((flag) && (document.frm.drpSpecialization_ID.value == "0")){
		alert("Please select Specilization.");
		document.frm.drpSpecialization_ID.focus();
		flag = false;
	}	
	if ((flag) && ((document.frm.txtExp_From.value == "") || isNaN(document.frm.txtExp_From.value))){
		alert("Please enter valid Experience From.");
		document.frm.txtExp_From.focus();
		flag = false;
	}
	if ((flag) && ((document.frm.txtExp_To.value == "") || isNaN(document.frm.txtExp_To.value))){
		alert("Please enter valid Experience From.");
		document.frm.txtExp_To.focus();
		flag = false;
	}	
	if ((flag) && (parseFloat(document.frm.txtExp_From.value) > parseFloat(document.frm.txtExp_To.value))){
		alert("Please enter valid Experience to.");
		document.frm.txtExp_To.focus();
		flag = false;
	}
	if ((flag) && ((document.frm.txtAge_From.value == "") || isNaN(document.frm.txtAge_From.value))){
		alert("Please enter valid Age From.");
		document.frm.txtAge_From.focus();
		flag = false;
	}
	if ((flag) && ((document.frm.txtAge_To.value == "") || isNaN(document.frm.txtAge_To.value))){
		alert("Please enter Age From.");
		document.frm.txtAge_To.focus();
		flag = false;
	}	
	if ((flag) && (parseFloat(document.frm.txtAge_From.value) > parseFloat(document.frm.txtAge_To.value))){
		alert("Please enter valid Age to.");
		document.frm.txtExp_To.focus();
		flag = false;
	}
	if ((flag) && (document.frm.drpCountry_ID.value == "0")){
		alert("Please select Country.");
		document.frm.drpCountry_ID.focus();
		flag = false;
	}
	if ((flag) && (document.frm.txtLocation.value == "")){
		alert("Please enter Location From.");
		document.frm.txtLocation.focus();
		flag = false;
	}	
	if ((flag) && ((document.frm.txtNo_Opening.value == "") || isNaN(document.frm.txtNo_Opening.value))){
		alert("Please enter valid Opening.");
		document.frm.txtNo_Opening.focus();
		flag = false;
	}
	var dt=document.frm.txtEntry_Date
	if ((flag) && (isDate(dt.value)==false))
	{
		dt.focus()
		flag = false
		return false;
	}	
	var dt=document.frm.txtExpiry_Date
	if ((flag) && (isDate(dt.value)==false))
	{
		dt.focus()
		flag = false
		return false;
	}	
	if ((flag) && (Date.parse(document.frm.txtEntry_Date.value) >= Date.parse(document.frm.txtExpiry_Date.value)))
	{
		alert("Please enter Expiry Date greater than Entry Date.");
		document.frm.txtExpiry_Date.focus();
		flag = false;	
	}
	if ((flag) && (document.frm.txtJob_Desc.value == "")){
		alert("Please enter Job Description.");
		document.frm.txtJob_Desc.focus();
		flag = false;
	}
	if (flag)
	{
		document.frm.action = "vacancysave.asp"
		document.frm.submit();
	}
}
