// JavaScript Document

if(rr==1) {

	alert('Thank you for using our service!\n You have previously submitted a temporary request for this date.  This request cannot be duplicated.\n We are currently working to place one of your prior selections.\n Princess Dental Staffing');

}

function checkForm() {

	// Speciality validation	

	if(document.frmSearch.Speciality[0].checked==false && document.frmSearch.Speciality[1].checked==false && document.frmSearch.Speciality[2].checked==false && document.frmSearch.Speciality[3].checked==false){

		alert('You must first select from the top three options before proceeding.');

		document.frmSearch.Speciality[0].focus();

		return false;

	}

	// City Location

	if(document.frmSearch.CityLocation.options[0].selected==true){

		alert('You must first select from the top three options before proceeding.');

		document.frmSearch.CityLocation.focus();

		document.frmSearch.CityLocation.className = "error";

		return false;

	}

	// Day for Temporary job

	if(isBlank(document.frmSearch.tmpDate.value)) {

		alert('You must first select from the top three options before proceeding.');

		document.frmSearch.tmpDate.focus();

		document.frmSearch.tmpDate.className = "error";

		return false;

	}
	else {
		var today = new Date();
		var selectedDate = document.frmSearch.tmpDate.value;
		var tempArr = selectedDate.split("/");
		
		var selectedDate = new Date();
		selectedDate.setFullYear(tempArr[2],tempArr[0]-1,tempArr[1]);

		if(today>selectedDate) {
			alert("Your selected date has already passed. Please select today's date or a future date.");
			document.frmSearch.tmpDate.focus();
			document.frmSearch.tmpDate.className = "error";
			return false;
		}
	}

	// Proficiency

	var tmpPro='';

	arrProficiency=new Array();

	OptionsChecked=false;

	limit = document.frmSearch.tmpProficiency.length;

	counter=0;

	for(i=0;i<limit;i++){

		//OptionsChecked = OptionsChecked || document.frmSearch.tmpProficiency[i].checked;

		if(document.frmSearch.tmpProficiency[i].checked==true){

			tmpPro += document.frmSearch.tmpProficiency[i].value+',';

			//counter++;

		}

	}

	/*if(OptionsChecked) {

		if(arrProficiency.length > 1)

	    	document.frmSearch.Proficiency.value = arrProficiency.join(",");

		else

			document.frmSearch.Proficiency.value = arrProficiency[0];

	}*/

	

	//alert(document.frmSearch.Proficiency.value);

	if(tmpPro.length > 1) {

		tmpL = tmpPro.length;

		tmpPro = tmpPro.substr(0,tmpL-1);

	}

	document.frmSearch.Proficiency.value = tmpPro;

	//alert(document.frmSearch.Proficiency.value);



// Professional Background

	var tmpExperience='';

	arrTemp=new Array();

	OptionsChecked=false;

	limit = document.frmSearch.PrevExperience.length;

	counter=0;

	for(i=0;i<limit;i++){

		//OptionsChecked = OptionsChecked || document.frmSearch.PrevExperience[i].checked;

		if(document.frmSearch.PrevExperience[i].checked==true){

			tmpExperience += document.frmSearch.PrevExperience[i].value+',';

			//counter++;

		}

	}

	/*if(OptionsChecked) {

		if(arrTemp.length > 1)

	    	document.frmSearch.ProfessionalBackground.value = arrTemp.join(",");

		else {

			document.frmSearch.ProfessionalBackground.value = arrTemp[0];

		}

	}*/

	if(tmpExperience.length > 1) {

		tmpL = tmpExperience.length;

		tmpExperience = tmpExperience.substr(0,tmpL-1);

	}

	document.frmSearch.ProfessionalBackground.value = tmpExperience;

	//alert(document.frmSearch.ProfessionalBackground.value);

	

return true;

}



function clearText(obj){

	obj.value='';	

}



function selectThisCandidate(obj,mem){

	if(mem=='')

	{

		alert('Login is required before selection is allowed. If you are new to our site, please Register with us and an e-mail with Login information will be sent to you.');

		return;

	}

	//alert(obj.value);

	tmp = document.frmSearch.sid.value;

	if(tmp=="") tmp = obj.value;

	else

	{

		sidArr = tmp.split(',');

		total = sidArr.length

		if(total==5)

		{

			alert('You can only select 5 candidates at a time.');

			obj.checked = false;

			return;

		}

		else

		{

			if(tmp.indexOf(obj.value)== -1)

				tmp = tmp+","+obj.value;

		}

	}

	

	document.frmSearch.sid.value = tmp;

	//alert(document.frmSearch.sid.value);

	document.frmSearch.act.value = '1';

	document.frmSearch.submit();

}



function unSelectThisCandidate(obj){

	tmp = document.frmSearch.sid.value;

	tmpL = tmp.length;

	if(tmpL>1){

		tmpArr = tmp.split(",");

		tmp='';

		tmpArrL = tmpArr.length;

		for(i=0;i<tmpArrL;i++){

			if(tmpArr[i]!=obj.value)

			tmp += tmpArr[i]+",";

		}

		tmpL = tmp.length;

		tmp = tmp.substr(0,tmpL-1);

	}

	else tmp="";

	document.frmSearch.sid.value = tmp;

	//alert(document.frmSearch.sid.value);

	document.frmSearch.act.value = '1';

	document.frmSearch.submit();

}



function stepOne(user_id, account_status, job_type){

	if(user_id=='-1') {

		alert('You must be logged in as an Employer before submission will be enabled.');

		return;

	}

	else if(user_id=='-2' && job_type=='2') {

		alert('Candidates cannot access Resumes.');

		return;

	}

	else if(user_id=='-2' && job_type=='1') {

		alert('Candidates cannot request Temporary Help.');

		return;

	}

	else if(account_status=='3') {

		alert('Thank you for using our service!\n We are excited you have selected so many of our qualified employees.\n However, you have exceeded our maximum resume limit (15).\n Your username and password are now temporarily disabled.\n Please call our office to reactivate your account.\n\n We’re sorry for the inconvenience.\n Princess Dental Staffing.');

		return;

	}

	else {

		document.frmSearch.action = 'step_one.php';

		document.frmSearch.act.value = '0';

		document.frmSearch.submit();

	}

}



function view_candidate_resume(resume, uid) {

	if(user_id=='-1') {

		alert('You must first log in before this button will be enabled.');

		return;

	}

	else

	   location.href='/siteadmin/truncated_resume/'+resume;

}



function additional_qualifications(chkID){

	total_elements = 4;

	for(i=0;i<total_elements;i++){

	    id = 'sub'+i;

		if(id!=chkID)

		document.getElementById(id).style.display = 'none';

	}

	document.getElementById(chkID).style.display = 'block';

}
