// For Seller Registration Form
function checkNavalOfficersform()
{
	emailFields = /^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/;
	var dateFieldFormat = /^\d{4}-\d{2}-\d{2}$/	;

	
/*	if (document.sellerform.AccountType.selectedIndex == 0)
		{	
	    alert('Account Type is missing.');
		document.sellerform.AccountType.focus();
		return false; }
*/		
	if (document.sellerform.UserName.value == '')
	{	alert('User Name field is missing.');
	    document.sellerform.UserName.focus();
		return false; }
		
	if (document.sellerform.Password.value == '')
	{	alert('Password field is missing.');
	    document.sellerform.Password.focus();
		return false; }
		
	if (document.sellerform.ConfirmPassword.value == '')
	{	alert('Confirm Password field is missing.');
		document.sellerform.ConfirmPassword.focus();
		return false; }
		
	if (document.sellerform.FirstName.value == '')
	{	alert('First Name field is missing.');
		document.sellerform.FirstName.focus();
		return false; }
		
	if (document.sellerform.LastName.value == '')
	{	alert('Last Name field is missing.');
		document.sellerform.LastName.focus();
		return false; }
		
	if (document.sellerform.DateBirth.value != '')
	{	
		
		if (document.sellerform.DateBirth.value.search(dateFieldFormat) == -1)
		{	
	    alert('Please Enter Valid Date of Birth.');
		document.sellerform.DateBirth.focus();
		return false; }
	}
		
	if (document.sellerform.Email.value == '')
	{	alert('Email Address field is missing.');
		document.sellerform.Email.focus();	
		return false; }
	
	if (document.sellerform.zone.selectedIndex == 0)
	{	alert('City field is missing.');
		document.sellerform.zone.focus();
		return false; }
		
	if (document.sellerform.SecurityCode.selectedIndex == 0)
	{	alert('Security Code field is missing.');
		document.sellerform.SecurityCode.focus();
		return false; }
	
	if (!document.sellerform.Disclaimer.checked)
	{	alert('Error! Disclaimer has not been checked.');
		document.sellerform.Disclaimer.focus();
		return false; }		
	
	if (!document.sellerform.SecurityCode.value)
	{	alert('Security Code is missing.');
		document.sellerform.SecurityCode.focus();
		return false; }		
	
	if (document.sellerform.SecurityCode.value != document.sellerform.scode.value)
	{	alert('Wrong Security Code has been inputed.');
		document.sellerform.SecurityCode.focus();
		return false; }
		
	if (document.sellerform.Password.value != document.sellerform.ConfirmPassword.value)
	{	alert('Wrong Confirm Password has been inputed.');
		document.sellerform.ConfirmPassword.focus();
		return false; }
		
	if (document.sellerform.Email.value.search(emailFields) != 0)
	{
	alert("Invalid E-mail Address! Please re-enter.");
	document.sellerform.Email.focus();
	return false;
	}
	
	//checkEmail();
	
return true;
}


function checkCivilianform()
{
	emailFields = /^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/;
	var dateFieldFormat = /^\d{4}-\d{2}-\d{2}$/	;

	

			if (document.sellerform.UserName.value == '')
	{	alert('User Name field is missing.');
	    document.sellerform.UserName.focus();
		return false; }
		
	if (document.sellerform.Password.value == '')
	{	alert('Password field is missing.');
	    document.sellerform.Password.focus();
		return false; }
		
	if (document.sellerform.ConfirmPassword.value == '')
	{	alert('Confirm Password field is missing.');
		document.sellerform.ConfirmPassword.focus();
		return false; }
		
	if (document.sellerform.FirstName.value == '')
	{	alert('First Name field is missing.');
		document.sellerform.FirstName.focus();
		return false; }
		
	if (document.sellerform.LastName.value == '')
	{	alert('Last Name field is missing.');
		document.sellerform.LastName.focus();
		return false; }
		
	
	if (document.sellerform.Email.value == '')
	{	alert('Email Address field is missing.');
		document.sellerform.Email.focus();	
		return false; }
	if (document.sellerform.DateBirth.value != '')
	{	
		
		if (document.sellerform.DateBirth.value.search(dateFieldFormat) == -1)
		{	
	    alert('Please Enter Valid Date of Birth.');
		document.sellerform.DateBirth.focus();
		return false; }
	}
	
	if (document.sellerform.zone.selectedIndex == 0)
	{	alert('City field is missing.');
		document.sellerform.zone.focus();
		return false; }
	// for studend Section
		if (document.sellerform.DegreeLevel.selectedIndex == 0)
	{
	alert("Degree Level field is missing.");
	document.sellerform.DegreeLevel.focus();
	return false;
	}
	if (document.sellerform.DegreeTitle.value == '')
	{	alert('Degree Title field is missing.');
		document.sellerform.DegreeTitle.focus();
		return false; }
	if (document.sellerform.DegreeCompletionDate.value == '')
	{	alert('Degree Completion Date  field is missing.');
		document.sellerform.DegreeCompletionDate.focus();
		return false; }
	if (document.sellerform.Institution.value == '')
	{	alert('Institution field is missing.');
		document.sellerform.Institution.focus();
		return false; }
		
	 if (document.sellerform.workExpYes.checked)
	 {
	  
			if (document.sellerform.LatesJob_title.value == '')
			{	alert('Lates Job title field is missing.');
				document.sellerform.LatesJob_title.focus();
				return false; }
			if (document.sellerform.ProfessionalExp.selectedIndex == 0)
			{
				alert("Professional Experience field is missing.");
				document.sellerform.ProfessionalExp.focus();
				return false;
			}
			if (document.sellerform.Company.value == '')
			{	alert('Company field is missing.');
				document.sellerform.Company.focus();
				return false; }
				
			}

	
	if (document.sellerform.Prof_industry.selectedIndex == 0)
	{
	alert("Professional Industry field is missing.");
	document.sellerform.Prof_industry.focus();
	return false;
	}
	//// end of student Section
		
	if (document.sellerform.SecurityCode.selectedIndex == 0)
	{	alert('Security Code field is missing.');
		document.sellerform.SecurityCode.focus();
		return false; }
	
	if (!document.sellerform.Disclaimer.checked)
	{	alert('Error! Disclaimer has not been checked.');
		document.sellerform.Disclaimer.focus();
		return false; }		
	
	if (!document.sellerform.SecurityCode.value)
	{	alert('Security Code is missing.');
		document.sellerform.SecurityCode.focus();
		return false; }		
	
	if (document.sellerform.SecurityCode.value != document.sellerform.scode.value)
	{	alert('Wrong Security Code has been inputed.');
		document.sellerform.SecurityCode.focus();
		return false; }
		
	if (document.sellerform.Password.value != document.sellerform.ConfirmPassword.value)
	{	alert('Wrong Confirm Password has been inputed.');
		document.sellerform.ConfirmPassword.focus();
		return false; }
		
	if (document.sellerform.Email.value.search(emailFields) != 0)
	{
	alert("Invalid E-mail Address! Please re-enter.");
	document.sellerform.Email.focus();
	return false;
	}
	
	//checkEmail();
	
return true;
}


function checkEmpoyersform()
{
	emailFields = /^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/;
	var dateFieldFormat = /^\d{4}-\d{2}-\d{2}$/;	

	
/*	if (document.sellerform.AccountType.selectedIndex == 0)
		{	
	    alert('Account Type is missing.');
		document.sellerform.AccountType.focus();
		return false; }
*/		
	if (document.sellerform.UserName.value == '')
	{	alert('User Name field is missing.');
	    document.sellerform.UserName.focus();
		return false; }
		
	if (document.sellerform.Password.value == '')
	{	alert('Password field is missing.');
	    document.sellerform.Password.focus();
		return false; }
		
	if (document.sellerform.ConfirmPassword.value == '')
	{	alert('Confirm Password field is missing.');
		document.sellerform.ConfirmPassword.focus();
		return false; }
		
	if (document.sellerform.FirstName.value == '')
	{	alert('First Name field is missing.');
		document.sellerform.FirstName.focus();
		return false; }
		
	if (document.sellerform.LastName.value == '')
	{	alert('Last Name field is missing.');
		document.sellerform.LastName.focus();
		return false; }
		
	if (document.sellerform.DateBirth.value != '')
	{	
		
		if (document.sellerform.DateBirth.value.search(dateFieldFormat) == -1)
		{	
	    alert('Please Enter Valid Date of Birth.');
		document.sellerform.DateBirth.focus();
		return false; }
	}
		
	if (document.sellerform.Email.value == '')
	{	alert('Email Address field is missing.');
		document.sellerform.Email.focus();	
		return false; }
	
	if (document.sellerform.zone.selectedIndex == 0)
	{	alert('City field is missing.');
		document.sellerform.zone.focus();
		return false; }
		
		if (document.sellerform.Company.value == '')
		{	
	    alert('Company Name field is missing.');
		document.sellerform.Company.focus();
		return false; }
		if (document.sellerform.CompanyIndustry.selectedIndex == 0)
		{	
	    alert('Industry field is missing.');
		document.sellerform.CompanyIndustry.focus();
		return false; }
		if (document.sellerform.CompanyDescn.value == '')
		{	
	    alert('Company Description is missing.');
		document.sellerform.CompanyDescn.focus();
		return false; }
		if (document.sellerform.CompanyAddress.value == '')
		{	
	    alert('Company Address is missing.');
		document.sellerform.CompanyAddress.focus();
		return false; }
		
		/*if (document.sellerform.CompanyLocation.selectedIndex == 0)
		{	
	    alert('Company Location is missing.');
		document.sellerform.CompanyLocation.focus();
		return false; }*/
		if (document.sellerform.CompanyCity.value == '')
		{	
	    alert('City is missing.');
		document.sellerform.CompanyCity.focus();
		return false; }
		if (document.sellerform.CompanyURL.value == '')
		{	
	    alert('Company URL is missing.');
		document.sellerform.CompanyURL.focus();
		return false; }
		if (document.sellerform.CompanyPhone.value == '')
		{	
	    alert('Company Phone is missing.');
		document.sellerform.CompanyPhone.focus();
		return false; }
		
		if(!/(\.bmp|\.gif|\.jpg|\.jpeg)$/i.test(document.sellerform.Logo.value))
		{
		alert("Invalid image file type.");
		//fld.form.reset();
		document.sellerform.Logo.focus();
		return false;
		}
		
	
	if (document.sellerform.SecurityCode.selectedIndex == 0)
	{	alert('Security Code field is missing.');
		document.sellerform.SecurityCode.focus();
		return false; }
	
	if (!document.sellerform.Disclaimer.checked)
	{	alert('Error! Disclaimer has not been checked.');
		document.sellerform.Disclaimer.focus();
		return false; }		
	
	if (!document.sellerform.SecurityCode.value)
	{	alert('Security Code is missing.');
		document.sellerform.SecurityCode.focus();
		return false; }		
	
	if (document.sellerform.SecurityCode.value != document.sellerform.scode.value)
	{	alert('Wrong Security Code has been inputed.');
		document.sellerform.SecurityCode.focus();
		return false; }
		
	if (document.sellerform.Password.value != document.sellerform.ConfirmPassword.value)
	{	alert('Wrong Confirm Password has been inputed.');
		document.sellerform.ConfirmPassword.focus();
		return false; }
		
	if (document.sellerform.Email.value.search(emailFields) != 0)
	{
	alert("Invalid E-mail Address! Please re-enter.");
	document.sellerform.Email.focus();
	return false;
	}
	
	//checkEmail();
	
return true;
}



function checkEmail() {
	
	emailFields = /^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/;

	if (document.sellerform.Email.value.search(emailFields) != 0)
	{
	alert("Invalid E-mail Address! Please re-enter.");
	document.sellerform.Email.focus();
	return false;
	}
	else 
	{
		return true;
	}
}



function checkLoginform()
{
	if (!document.SigninForm.UserName.value)
	{	alert('Error! User Name is missing.');
		document.SigninForm.UserName.focus();
		return false; }
	
	if (!document.SigninForm.Password.value)
	{	alert('Error! Password is missing.');
		document.SigninForm.Password.focus();
		return false; }
	
	
	return true;
}
function checkUserProfile()
{
	
	var dateFieldFormat = /^\d{4}-\d{2}-\d{2}$/	

	// for studend Section
		
	if (document.form1.DegreeTitle.value == '')
	{	alert('Degree Title field is missing.');
		document.form1.DegreeTitle.focus();
		return false; }
	if (document.form1.DegreeCompletionDate.value.search(dateFieldFormat) == -1)
	{	alert('Please Enter Valid Degree Completion Date.');
		document.form1.DegreeCompletionDate.focus();
		return false; }
	if (document.form1.Institution.value == '')
	{	alert('Institution field is missing.');
		document.form1.Institution.focus();
		return false; }
	
	return true;
}

function checkProfileForm()
{
	
		emailFields = /^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/;
		var dateFieldFormat = /^\d{4}-\d{2}-\d{2}$/	


	if (document.sellerform.FirstName.value == '')
	{	alert('First Name field is missing.');
		document.sellerform.FirstName.focus();
		return false; }
		
	if (document.sellerform.LastName.value == '')
	{	alert('Last Name field is missing.');
		document.sellerform.LastName.focus();
		return false; }
		
	if (document.sellerform.DateBirth.value.search(dateFieldFormat) == -1)
	{	alert('Please enter Valid Date of Birth.');
		document.sellerform.DateBirth.focus();
		return false; }
	
	if (document.sellerform.City.value == '')
	{	alert('City field is missing.');
		document.sellerform.City.focus();
		return false; }
		
		if (document.sellerform.Email.value.search(emailFields) != 0)
	{
	alert("Invalid E-mail Address! Please re-enter.");
	document.sellerform.Email.focus();
	return false;
	}
	
return true;
}


function checkConfirmPassword()
{
	
	if (document.form1.CurrentPassword.value == '')
	{	alert('Current Password field is missing.');
	    document.form1.CurrentPassword.focus();
		return false; }
		
	if (document.form1.newPassword.value == '')
	{	alert('New Password field is missing.');
	    document.form1.newPassword.focus();
		return false; }
		
	if (document.form1.ConfirmPassword.value == '')
	{	alert('Confirm Password field is missing.');
	    document.form1.ConfirmPassword.focus();
		return false; }
		
	
	
	if (document.form1.newPassword.value != document.form1.ConfirmPassword.value)
	{	alert('Wrong Confirm Password has been inputed.');
		document.form1.ConfirmPassword.focus();
		return false; }
	
return true;
}

function checkCVForm()
{
	
	if (document.form1.cvTitle.value == '')
	{	alert('CV Title field is missing.');
	    document.form1.cvTitle.focus();
		return false; }
		
	/*if (document.form1.cv_url.value == '')
	{	alert('CV Location field is missing.');
	    document.form1.cv_url.focus();
		return false; }*/
	
return true;
}



function validateFileExtension(fld) {
	if(!/(\.bmp|\.gif|\.jpg|\.jpeg)$/i.test(fld.value)) {
		alert("Invalid image file type.");
		fld.form.reset();
		fld.focus();
		return false;
	}
	return true;
}

function vf()
{

var yearField = /^\d{1,2}$/;
		
	if (document.form1.PNO.value == '')
		{	
	    alert('P/NO is missing.');
		document.form1.PNO.focus();
		return false; }
		
	if (document.form1.rank.selectedIndex == 0)
	{	alert('rank field is missing.');
	    document.form1.rank.focus();
		return false; }
		
	if (document.form1.Branch.value == '')
		{	
	    alert('Branch/Trade/Specialisation is missing.');
		document.form1.Branch.focus();
		return false; }
		
	if (document.form1.BirthPlace.value == '')
		{	
	    alert('Place of Birth is missing.');
		document.form1.BirthPlace.focus();
		return false; }
		
	if (document.form1.Domicile.value == '')
		{	
	    alert('Domicile is missing.');
		document.form1.Domicile.focus();
		return false; }
		
	if (document.form1.DateJoiningService.value == '')
		{	
	    alert('Date of Joining Service is missing.');
		document.form1.DateJoiningService.focus();
		return false; }
	if (document.form1.DateSOD.value == '')
		{	
		 alert('Date of SOD Service is missing.');
		document.form1.DateSOD.focus();
		return false; }
	if (document.form1.DateSOS.value == '')
		{	
		 alert('Date of SOS Service is missing.');
	     document.form1.DateSOS.focus();
		 return false; }
				
	if (document.form1.ReasonRetirement.value == '')
		{	
	    alert('Reasons of retirement is missing.');
		document.form1.ReasonRetirement.focus();
		return false; }
	if (document.form1.Languages.value == '')
		{	
	    alert('Language is missing.');
		document.form1.Languages.focus();
		return false; }
	if (document.form1.WillingServe.value == '')
		{	
	    alert('Willing to serve in is missing.');
		document.form1.WillingServe.focus();
		return false; }
	if (document.form1.SalaryAcceptable.value == '')
		{	
	    alert('Minimum Salary Acceptable is missing.');
		document.form1.SalaryAcceptable.focus();
		return false; }
	if (document.form1.PreferenceCountriesAbroad.value == '')
		{	
	    alert('Preference of Countries Abroad is missing.');
		document.form1.PreferenceCountriesAbroad.focus();
		return false; }
	if (document.form1.MinimumSalaryAbroad.value == '')
		{	
	    alert('Salary Abroad is missing.');
		document.form1.MinimumSalaryAbroad.focus();
		return false; }
		
	if (document.form1.PresentAddress.value == '')
		{	
	    alert('Present Address is missing.');
		document.form1.PresentAddress.focus();
		return false; }
		
	if (document.form1.PermanentAddress.value == '')
		{	
	    alert('Permanent Address is missing.');
		document.form1.PermanentAddress.focus();
		return false; }



return true;

}



function vf2()
{

var yearField = /^\d{1,2}$/;

	if (document.form1.PNO.value == '')
		{	
	    alert('P/NO is missing.');
		document.form1.PNO.focus();
		return false; }
		
	if (document.form1.rank.selectedIndex == 0)
	{	
	alert('rank field is missing.');
	    document.form1.rank.focus();
		return false; }
		
	if (document.form1.Branch.value == '')
		{	
	    alert('Branch/Trade/Specialisation is missing.');
		document.form1.Branch.focus();
		return false; }
		
	if (document.form1.BirthPlace.value == '')
		{	
	    alert('Place of Birth is missing.');
		document.form1.BirthPlace.focus();
		return false; }
		
	if (document.form1.Domicile.value == '')
		{	
	    alert('Domicile is missing.');
		document.form1.Domicile.focus();
		return false; }
		
	if (document.form1.DateJoiningService.value == '')
		{	
	    alert('Date of Joining Service is missing.');
		document.form1.DateJoiningService.focus();
		return false; }
		
	if (document.form1.DateRetd.value == '')
		{	
		 alert('Date of Retirement Service is missing.');
		 document.form1.DateRetd.focus();
		 return false; }
	if (document.form1.DateLPR.value == '')
		{	
	   	 alert('Date of Proceeding on LPR is missing.');
		document.form1.DateLPR.focus();
		return false; }
	if (document.form1.ExpInService.value == '')
		{	
	  	 alert('Experience in Service assignment is missing.');
		 document.form1.ExpInService.focus();
		 return false; }
	if (document.form1.ReasonRetirement.value == '')
		{	
	    alert('Reasons of retirement is missing.');
		document.form1.ReasonRetirement.focus();
		return false;
		}
	if (document.form1.Languages.value == '')
		{	
	    alert('Language is missing.');
		document.form1.Languages.focus();
		return false; }
	/*if (document.form1.WillingServe.value == '')
		{	
	    alert('Willing to serve in is missing.');
		document.form1.WillingServe.focus();
		return false; }*/
	if (document.form1.SalaryAcceptable.value == '')
		{	
	    alert('Minimum Salary Acceptable is missing.');
		document.form1.SalaryAcceptable.focus();
		return false; }
	if (document.form1.PreferenceCountriesAbroad.value == '')
		{	
	    alert('Preference of Countries Abroad is missing.');
		document.form1.PreferenceCountriesAbroad.focus();
		return false; }
	if (document.form1.MinimumSalaryAbroad.value == '')
		{	
	    alert('Salary Abroad is missing.');
		document.form1.MinimumSalaryAbroad.focus();
		return false; }
	if (document.form1.PresentAddress.value == '')
		{	
	    alert('Present Address is missing.');
		document.form1.PresentAddress.focus();
		return false; }
		
	if (document.form1.PermanentAddress.value == '')
		{	
	    alert('Permanent Address is missing.');
		document.form1.PermanentAddress.focus();
		return false; }

return true;

}


function vf3()
{

var yearField = /^\d{1,2}$/;

		if (document.form1.FatherName.value == '')
		{	
	    alert('Father Name is missing.');
		document.form1.FatherName.focus();
		return false; }
		if (document.form1.ProvinceOrigin.value == '')
		{	
	    alert('Province of Origin is missing.');
		document.form1.ProvinceOrigin.focus();
		return false; }
		
		if (document.form1.ProvinceOrigin.value == '')
		{	
	    alert('Province of Origin is missing.');
		document.form1.ProvinceOrigin.focus();
		return false; }
		if (document.form1.Domicile.value == '')
		{	
	    alert('Province of Domicile is missing.');
		document.form1.Domicile.focus();
		return false; }
		if (document.form1.ServedNavyYears.value == '')
		{	
	    alert('Served in Pak Navy is missing.');
		document.form1.ServedNavyYears.focus();
		return false; }
		if (document.form1.ServedNavyYears.value.search(yearField) != 0)
		{	
	    alert('Please Enter only digit (eg,30).');
		document.form1.ServedNavyYears.focus();
		return false; }
	
	if (document.form1.PresentAddress.value == '')
		{	
	    alert('Present Address is missing.');
		document.form1.PresentAddress.focus();
		return false; }
		
	if (document.form1.PermanentAddress.value == '')
		{	
	    alert('Permanent Address is missing.');
		document.form1.PermanentAddress.focus();
		return false; }
		
		if (document.form1.NocCountry.selectedIndex == 0)
		{	
	    alert('Country is missing.');
		document.form1.NocCountry.focus();
		return false; }
		
		if (document.form1.ForeignAgency.value == ' ')
		{	
	    alert('Foreign Agency is missing.');
		document.form1.ForeignAgency.focus();
		return false; }
		
		if (!document.form1.NatureOfDuties.value)
		{	
	    alert('Nature Of Duties is missing.');
		document.form1.NatureOfDuties.focus();
		return false; }
		
		if (!document.form1.Emolument.value)
		{	
	    alert('Emolument is missing.');
		document.form1.Emolument.focus();
		return false; }
		
		
		
return true;

}
function checkCVWizartForm()
{
	
	if (document.form1.cvTitle.value == '')
	{	alert('CV Title field is missing.');
	    document.form1.cvTitle.focus();
		return false; }
		
return true;
}