var currcount = 3;
function AddInput(){		
	if(currcount>=15) return false;		
	currcount++;		
	var el = document.getElementById('fileInput'+currcount);		
	el.style.display = '';	
	
	if(currcount >= 15) document.getElementById("attachMoreLink").style.display = "none";
}

function alertme() {
	alert('At Least One Work Experience and Education Record is Required');
}

function isNumberKey(evt){
	var charCode = (evt.which) ? evt.which : event.keyCode
	if (charCode > 31 && (charCode < 48 || charCode > 57))
	return false;
	
	return true;
}

// this function will remove "Click to activate" when using IE for flash file, method found in func_proc.php in do_header
function writeFlash(id) {
document.getElementById(id).innerHTML = "<object classid='clsid:d27cdb6e-ae6d-11cf-96b8-444553540000' codebase='http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0' width='810' height='164' id='myflash' align='middle'><param name='allowScriptAccess' value='sameDomain' /><param name='movie' value='images/iris_header.swf' /><param name='quality' value='high' /><param name='bgcolor' value='#ffffff' /><embed src='images/iris_header.swf' quality='high' bgcolor='#ffffff' width='810' height='164' name='mymovie' align='middle' allowScriptAccess='sameDomain' type='application/x-shockwave-flash' pluginspage='http://www.macromedia.com/go/getflashplayer' /></object>";
}
// this function will remove "Click to activate" when using IE for flash file, method found in func_proc.php in do_header

// this function will validate apply_online.php 
function validate_form() {
	position1 = document.getElementById("position1").value;
	lname = document.getElementById("lname").value;
	fname = document.getElementById("fname").value;
	mname = document.getElementById("mname").value;
	cellphone = document.getElementById("cellphone").value;
	email = document.getElementById("email").value;
	bday_month = document.getElementById("bday_month").value;
	bday_day = document.getElementById("bday_day").value;
	bday_year = document.getElementById("bday_year").value;
	address1 = document.getElementById("address1").value;
	//perm_no = document.getElementById("perm_no").value;
	perm_st = document.getElementById("perm_st").value;
	perm_city = document.getElementById("perm_city").value;
	perm_prov = document.getElementById("perm_prov").value;
	perm_zip = document.getElementById("perm_zip").value;
	password = document.getElementById("password").value;
	password1 = document.getElementById("password1").value;
	position1_yrsofexp = document.getElementById("position1_yrsofexp").value;
	position1_mosofexp = document.getElementById("position1_mosofexp").value;
	position1_yrsofexp_abroad = document.getElementById("position1_yrsofexp_abroad").value;
	position1_mosofexp_abroad = document.getElementById("position1_mosofexp_abroad").value;	
	
	pos_other = document.getElementById("pos_other").value;
	
	myOption = -1;
	for (i=document.thisonly.sex.length-1; i > -1; i--) {
		if (document.thisonly.sex[i].checked) {
		myOption = i; i = -1;
		}
	} 
	
	if (position1 == "0") {
		if (pos_other == "") {	
			alert("Please Specify is Required");	
			document.getElementById("pos_other").focus();
			return false;	
		}
	}
	
	if (position1 == "") {
		hideAllErrors();
		document.getElementById("positionError").style.display = "inline";
		document.getElementById("position1").focus();
		return false;
	} else if (position1_yrsofexp_abroad == "") {
		hideAllErrors();
		document.getElementById("position1_yrsofexp_abroadError").style.display = "inline";
		document.getElementById("position1_yrsofexp_abroad").focus();
		return false;
	} else if (position1_mosofexp_abroad == "") {
		hideAllErrors();
		document.getElementById("position1_mosofexp_abroadError").style.display = "inline";
		document.getElementById("position1_mosofexp_abroad").focus();
		return false;
	} else if (position1_yrsofexp == "") {
		hideAllErrors();
		document.getElementById("position1_yrsofexpError").style.display = "inline";
		document.getElementById("position1_yrsofexp").focus();
		return false;
	} else if (position1_mosofexp == "") {
		hideAllErrors();
		document.getElementById("position1_mosofexpError").style.display = "inline";
		document.getElementById("position1_mosofexp").focus();
		return false;	
	} else if (lname == "") {
		hideAllErrors();
		document.getElementById("lnameError").style.display = "inline";
		document.getElementById("lname").focus();
		return false;
		
	} else if (fname == "") {
		hideAllErrors();
		document.getElementById("fnameError").style.display = "inline";
		document.getElementById("fname").focus();
		return false;
	} else if (mname == "") {
	hideAllErrors();
		document.getElementById("mnameError").style.display = "inline";
		document.getElementById("mname").focus();
		return false;
	} else if (mname.length < 2) {
	hideAllErrors();
		document.getElementById("mnameError").style.display = "inline";
		document.getElementById("mname").focus();
		return false;	
	} else if (address1 == "") {
	hideAllErrors();
		document.getElementById("address1Error").style.display = "inline";
		document.getElementById("address1").focus();
		return false;	
	/*} else if (cellphone.length < 11) {
	hideAllErrors();
		document.getElementById("cellphoneError").style.display = "inline";
		document.getElementById("cellphone").focus();
		return false;*/
	} else if (email == "") {
		hideAllErrors();
		document.getElementById("emailError").style.display = "inline";
		document.getElementById("email").focus();
		return false;
	} else if (email.indexOf('@')<=0) {
		hideAllErrors();
		document.getElementById("emailvalidError").style.display = "inline";
		document.getElementById("email").focus();
		return false;
	/*} else if (perm_no == "") {
	hideAllErrors();
		document.getElementById("perm_noError").style.display = "inline";
		document.getElementById("perm_no").focus();
		return false;	*/
	} else if (password == "") {
		hideAllErrors();
		document.getElementById("passwordError").style.display = "inline";
		document.getElementById("password").focus();
		return false;	
	} else if (password1 == "") {
		hideAllErrors();
		document.getElementById("password1Error").style.display = "inline";
		document.getElementById("password1").focus();
		return false;	
	} else if (password != password1) {
		hideAllErrors();
		document.getElementById("passwordvalidError").style.display = "inline";
		document.getElementById("password1validError").style.display = "inline";		
		document.getElementById("password").focus();
		return false;			
	} else if (perm_st == "") {
		hideAllErrors();
		document.getElementById("perm_stError").style.display = "inline";
		document.getElementById("perm_st").focus();
		return false;	
	} else if (perm_city == "") {
		hideAllErrors();
		document.getElementById("perm_cityError").style.display = "inline";
		document.getElementById("perm_city").focus();
		return false;	
	} else if (perm_prov == "") {
		hideAllErrors();
		document.getElementById("perm_provError").style.display = "inline";
		document.getElementById("perm_prov").focus();
		return false;	
	} else if (perm_zip == "") {
		hideAllErrors();
		document.getElementById("perm_zipError").style.display = "inline";
		document.getElementById("perm_zip").focus();
		return false;		
	} else if (bday_month == "") {
	hideAllErrors();
		document.getElementById("bdateError").style.display = "inline";
		document.getElementById("bday_month").focus();
		return false;
	} else if (bday_day == "") {
		hideAllErrors();
		document.getElementById("bdateError").style.display = "inline";
		document.getElementById("bday_day").focus();
		return false;
	} else if (bday_year == "") {
		hideAllErrors();
		document.getElementById("bdateError").style.display = "inline";
		document.getElementById("bday_year").focus();
		return false;
	} else if (myOption == -1) {
		alert("Gender is Required");
		return false;
	}
	return true;
}
  
function hideAllErrors() {
	document.getElementById("positionError").style.display = "none"
	document.getElementById("lnameError").style.display = "none"
	document.getElementById("fnameError").style.display = "none"
	document.getElementById("mnameError").style.display = "none"
	document.getElementById("cellphoneError").style.display = "none"
	document.getElementById("emailError").style.display = "none"
	document.getElementById("emailvalidError").style.display = "none"
	document.getElementById("bdateError").style.display = "none"
	document.getElementById("address1Error").style.display = "none"
	document.getElementById("perm_noError").style.display = "none"
	document.getElementById("perm_stError").style.display = "none"
	document.getElementById("perm_cityError").style.display = "none"
	document.getElementById("perm_provError").style.display = "none"
	document.getElementById("perm_zipError").style.display = "none"
	document.getElementById("passwordError").style.display = "none"
	document.getElementById("password1Error").style.display = "none"
	document.getElementById("passwordvalidError").style.display = "none"
	document.getElementById("password1validError").style.display = "none"	
	document.getElementById("position1_yrsofexp_abroadError").style.display = "none"	
	document.getElementById("position1_mosofexp_abroadError").style.display = "none"	
	document.getElementById("position1_yrsofexpError").style.display = "none"	
	document.getElementById("position1_mosofexpError").style.display = "none"	
}
// this function will validate apply_online.php


// contact us validation
function val_contactus() {
	var formname = document.formcontact;
	if(formname.Full_Name.value == '') {
		alert("Full Name Required");
		formname.Full_Name.focus();
		return false;
	}
	if(formname.Company_Name.value == '') {
		alert("Company Name Required");
		formname.Company_Name.focus();
		return false;
	}
	if(formname.Email.value == '') {
		alert("Email Address Required");
		formname.Email.focus();
		return false;
	}
	if(formname.Email.value.indexOf('@')<=0) {
		alert("Invalid Email Address");
		formname.Email.focus();
		return false;
	}
	if(formname.Phone_Number.value == '') {
		alert("Phone Number Required");
		formname.Phone_Number.focus();
		return false;
	}
	if(formname.Location.value == '') {
		alert("Location Required");
		formname.Location.focus();
		return false;
	}
	return true;
}
function contact_send() {
	document.getElementById('result').style.display = "block";
    document.getElementById('result').innerHTML = "<img src='images/loading2.gif' />&nbsp;&nbsp;Sending.... Please Wait";
	//contactform.form.submit();
	document.formcontact.submit();
    return true;
}
function request_send() {
	document.getElementById('result').style.display = "block";
    document.getElementById('result').innerHTML = "<img src='images/loading2.gif' />&nbsp;&nbsp;Sending.... Please Wait";
	//requestform.form.submit();
	document.formrequest.submit();
    return true;
}
function employer_send(employerform) {
	document.getElementById('result').style.display = "block";
    document.getElementById('result').innerHTML = "<img src='images/loading2.gif' />&nbsp;&nbsp;Sending.... Please Wait";
	//employerform.form.submit();
	document.formemployer.submit();
    return true;
}
