
// no number script - WORKING
function CheckName(HoldName)
{
NoNumThere=true;
for(i=0; i<HoldName.length; i++)
	{
	for(j=0; j<10; j++)
		{
		if(HoldName.charAt(i)==j.toString())
			{
			NoNumThere=false;
			break;
			}
		}
		if(NoNumThere==false)
			{
			break;
			}
		}
return NoNumThere;
}

// number script - working
function validatephone(xxxxx) {
	 var maintainplus = '';
 	var numval = xxxxx.value
 	if ( numval.charAt(0)=='+' ){ var maintainplus = '+';}
 	curphonevar = numval.replace(/[\\A-Za-z!"£$%^&*+_={};:'@#~,.¦\/<>?|`¬\]\[]/g,'');
 	xxxxx.value = maintainplus + curphonevar;
 	var maintainplus = '';
 	xxxxx.focus;
}
// testing script
function textCounter(field,cntfield,maxlimit) {
if (field.value.length < maxlimit)
	{
	// if too long...trim it!
	field.value = field.value.substring(0, maxlimit);
	cntfield.value = maxlimit - field.value.length;
	//window.alert("invalid CV");
	txtpastecv.focus();
   // return false;
	//return false;
	}
// otherwise, update 'characters left' counter
else
	{
	cntfield.value = "0";
	//cntfield.value = maxlimit - field.value.length;
	//window.alert("valid CV");
	//return true;
	}
}


// AGENCY FORWARD VALIDATION
function ValidateContactForm_agencyforward()
{
    var name = document.ContactForm.txtname;
	var title = document.ContactForm.txttitle;
	var profession = document.ContactForm.txtprofession;
	var targetindustry = document.ContactForm.txttargetindustry;
	var targetposition = document.ContactForm.txttargetposition;
	var locationpref = document.ContactForm.txtlocationpref;
	var expectedsalary = document.ContactForm.txtexpectedsalary;
	var presentsalary = document.ContactForm.txtpresentsalary;
	var noticeperiod = document.ContactForm.txtnoticeperiod;
	var totalexperience = document.ContactForm.txttotalexperience;
	var gulfexperience = document.ContactForm.txtgulfexperience;	
	var qualification = document.ContactForm.txtqualification;
	var gender = document.ContactForm.txtgender;
	var maritalstatus = document.ContactForm.txtmaritalstatus;
	var language1 = document.ContactForm.txtlanguage1;
	var language2 = document.ContactForm.txtlanguage2;
	var date = document.ContactForm.txtdate;
	var month = document.ContactForm.txtmonth;
	var year = document.ContactForm.txtyear;
	var nationality = document.ContactForm.txtnationality;
	var visastatus = document.ContactForm.txtvisastatus;
	var lvdl = document.ContactForm.txtlvdl;
	var pcskills = document.ContactForm.txtpcskills;
	var primaryemail = document.ContactForm.txtprimaryemail;
	var secondaryemail = document.ContactForm.txtsecondaryemail;
	var mobile = document.ContactForm.txtmobile;
	var localcontact = document.ContactForm.txtlocalcontact;
	var fileresume = document.ContactForm.fileresume;
	var pastecv = document.ContactForm.txtpastecv;
	var rem = document.ContactForm.remLen2;
	var pastecoverletter = document.ContactForm.txtpastecoverletter;
	var certification = document.ContactForm.txtcertification;
	NameValid=CheckName(name.value);
	TPValid=CheckName(targetposition.value);
	//cv=textCounter(pastecv,remLen2,1000);
	
	// ends here //

    	
	if (title.value == "") {
        window.alert("Please enter Salutation");
        title.focus();
        return false; }	
	if (name.value == "") {
        window.alert("Please enter your Full Name.");
        name.focus();
        return false; }
	if(NameValid==false){
		alert("Sorry, your name can not contain numbers.");
		name.focus(); 
		name.select(); 
		return false; }
	if (profession.value == "") {
        window.alert("Please select Profession.");
        profession.focus();
        return false; }
    if (targetindustry.value == "") {
        window.alert("Please enter your Target Industry.");
        targetindustry.focus();
        return false; }
	if (targetposition.value == "") {
        window.alert("Please enter your Target Position.");
        targetposition.focus();
        return false; }
	if (TPValid == false) {
        window.alert("Sorry, your Target Position can not contain numbers.");
        targetposition.focus();
		targetposition.select(); 
        return false; }
	if (locationpref.value == "") {
        window.alert("Please select Preferred Job Location.");
        locationpref.focus();
        return false; }
	if (expectedsalary.value == "") {
        window.alert("Please select Expected Salary.");
        expectedsalary.focus();
        return false; }
	if (presentsalary.value == "") {
        window.alert("Please select Present Salary.");
        presentsalary.focus();
        return false; }
	if (noticeperiod.value == "") {
        window.alert("Please select Notice Period.");
        noticeperiod.focus();
        return false; }
	if (totalexperience.value == "") {
        window.alert("Please select Total Experience.");
        totalexperience.focus();
        return false; }
	if (gulfexperience.value == "") {
        window.alert("Please select Gulf Experience.");
        gulfexperience.focus();
        return false; }
	if (qualification.value == "") {
        window.alert("Please select Qualification.");
        qualification.focus();
        return false; }
	if (certification.value == "") {
        window.alert("Please enter Certification.");
        certification.focus();
        return false; }
	if (gender.value == "") {
        window.alert("Please select Gender.");
        gender.focus();
        return false; }
	if (maritalstatus.value == "") {
        window.alert("Please select Marital Status.");
        maritalstatus.focus();
        return false; }
    if (language1.value == "") {
        window.alert("Please select First language.");
        language1.focus();
        return false; }
	 if (language2.value == "") {
        window.alert("Please select Second language.");
        language2.focus();
        return false; }
	if (date.value == "") {
        window.alert("Please select Date.");
        date.focus();
        return false; }
	if (month.value == "") {
        window.alert("Please select Month.");
        month.focus();
        return false; }
	if (year.value == "") {
        window.alert("Please select Year.");
        year.focus();
        return false; }
	if (nationality.value == "") {
        window.alert("Please select Nationality.");
        nationality.focus();
        return false; }
	if (visastatus.value == "") {
        window.alert("Please select Visa Status.");
        visastatus.focus();
        return false; }
	if (lvdl.value == "") {
        window.alert("Please select Driving License.");
        lvdl.focus();
        return false; }
	if (pcskills.value == "") {
        window.alert("Please enter your Computer - IT Skills.");
        pcskills.focus();
        return false; }
    if (primaryemail.value.indexOf("@", 0) < 0) {
        window.alert("Please enter a valid Primary E-mail address.");
        primaryemail.focus();
		primaryemail.select();
        return false; }
	 if (primaryemail.value.indexOf(".", 0) < 0) {
        window.alert("Please enter a valid Primary E-mail address.");
        primaryemail.focus();
		primaryemail.select();
        return false; }
	if (secondaryemail.value.indexOf("@", 0) < 0) {
        window.alert("Please enter a valid Secondary E-mail address.");
        secondaryemail.focus();
		secondaryemail.select();
        return false; }
	 if (secondaryemail.value.indexOf(".", 0) < 0) {
        window.alert("Please enter a valid Secondary E-mail address.");
        secondaryemail.focus();
		secondaryemail.select();
        return false; }
	if (mobile.value == "") {
        window.alert("Please enter your Mobile no.");
        mobile.focus();
        return false; }
	if (pastecoverletter.value == "") {
        window.alert("Please paste your Cover Letter here.");
        pastecoverletter.focus();
        return false; }
	if (fileresume.value == "") {
        window.alert("Please upload your CV in MS Word(.doc) or Plain Text(.txt) or Rich Text(.rtf) or PDF(.pdf) Format only.");
        fileresume.focus();
        return false; }
	if (pastecv.value == "") {
        window.alert("Please Copy and Paste the CV you're uploading and close the file before you Submit this Form");
        pastecv.focus();
        return false; }
	if (rem.value > 0) {
        window.alert("Your paste CV must contain not less than 500 character");
        pastecv.focus();
        return false; }
	return true;
}

