// Medi-Cruit Web-Site V1.00
// JScript Library by Andy Martin

function loadFrame( strPage ) 
{
    parent.mainFrame.location = strPage;
    return false;
}

function loadFrame2( strPage ) 
{
    top.location = strPage;
    return false;
}

function highlightRow( strRow )
{
	var rowItem = document.getElementById( strRow );
	if( rowItem )
	{
		rowItem.style.backgroundColor="#888888";
	}
}

function resetRow( strRow )
{
	var rowItem = document.getElementById( strRow );
	if( rowItem )
	{
		rowItem.style.backgroundColor="#FFFFFF";
	}
}

function menuHover( strCell ) 
{ 
	var menuItem = document.getElementById( strCell );
	if ( menuItem )
	{
		menuItem.style.backgroundColor='#888888';
	}
} 

function menuOut( strCell ) 
{ 
	var menuItem = document.getElementById( strCell );
	if ( menuItem )
	{
		menuItem.style.backgroundColor='#000000';
	}
} 

function cellHover( strCell )
{
	var menuItem = document.getElementById( strCell );
	if ( menuItem )
	{
		menuItem.style.borderColor='Gray';
	}
}

function cellOut( strCell )
{
	var menuItem = document.getElementById( strCell );
	if ( menuItem )
	{
		menuItem.style.borderColor='#599eff';
	}
}

function loadArea( strArea )
{
 	var posSel = document.frmMain.jobSel.value;

 	
    if( posSel == "none" )
    {
    	window.alert( "You must choose a position type" );
    }
	else
	{
	 	var jobTitle = document.frmMain.jobSel.options[ document.frmMain.jobSel.selectedIndex ].text;
 	
 		var post_slug_array = jobTitle.split(" ");
		var post_slug = post_slug_array.join("_");
    
		frames["area"].location.href = "positionssplit.php?area=" + strArea + "&job=" + posSel + "&jobtitle=" + post_slug;
	}
}

function loadArea2( strArea )
{
    var obPositionSelection = document.getElementById( "jobSel" );

 	var posSel = obPositionSelection.value;
 	
    if( posSel == "none" )
    {
    	window.alert( "You must choose a position type" );
    }
	else
	{
	 	var jobTitle = obPositionSelection.options[ obPositionSelection.selectedIndex ].text;
 	
 		var post_slug_array = jobTitle.split(" ");
		var post_slug = post_slug_array.join("_");
    
		top.location = "findemp2.php?area=" + strArea + "&job=" + posSel + "&jobtitle=" + post_slug;
	}
}
function loadArea3( strArea ){    var obPositionSelection = document.getElementById( "jobSel" ); 	var posSel = obPositionSelection.value; 	    if( posSel == "none" )    {    	window.alert( "You must choose a position type" );    }	else	{	 	var jobTitle = obPositionSelection.options[ obPositionSelection.selectedIndex ].text; 	 		var post_slug_array = jobTitle.split(" ");		var post_slug = post_slug_array.join("_");    		top.location = "findempresult?area=" + strArea + "&job=" + posSel + "&jobtitle=" + post_slug;	}}
function loadPractices()
{
	 	//var pracSel = document.frmMain.pracSel.value;
	 	var areaSel = document.frmMain.areaSel.value;

		//loadFrame( "practices.php?filter=" + pracSel + "&area=" + areaSel );
		loadFrame( "practices.php?filter=0&area=" + areaSel );
}

function loadPractices2()
{
	 	//var pracSel = document.frmMain.pracSel.value;
	 	var areaSel = document.frmMain.areaSel.value;

		//loadFrame( "practices.php?filter=" + pracSel + "&area=" + areaSel );
		loadFrame2( "dental-practices?filter=0&area=" + areaSel );
}

function loadCareHomes()
{
	 	//var pracSel = document.frmMain.pracSel.value;
	 	var areaSel = document.frmMain.areaSel.value;

		//loadFrame( "practices.php?filter=" + pracSel + "&area=" + areaSel );
		loadFrame2( "carehomes.php?filter=0&area=" + areaSel );
}

function loadVacancy( strID )
{
/*	var vacFrame = document.getElementById( 'desc' );
	if ( vacFrame )
	{
		vacFrame.location = "vacancydetail.php?id=" + strID;
	}*/
	frames["desc"].location.href = "vacancydetail.php?id=" + strID;
}

function loadNews( strID )
{
	frames["desc"].location.href = "newsdetail.php?id=" + strID;
}

function loadHomeItem( strID )
{
	/*var vacFrame = document.getElementById( 'desc' );
	if ( vacFrame )
	{
		vacFrame.location = "homedetail.php?id=" + strID;
	}*/
	frames["desc"].location.href = "homedetail.php?id=" + strID;
}

function openPositionForm( strCounty, strPosition )
{
	top.frames[1].location = "positionform.php?county=" + strCounty + "&position=" + strPosition;
}

function openPositionForm2( strCounty, strPosition )
{
	top.location = "positionform2?county=" + strCounty + "&position=" + strPosition;
}

function valNewCandForm()
{
	var strEnter = "You must enter a";

	var comp = document.getElementById( "Company" );
	var contact = document.getElementById( "Contact" );
	var address1 = document.getElementById( "Address" );
	var postcode = document.getElementById( "PostCode" );
	var phone = document.getElementById( "Phone" );
	var field9 = document.getElementById( "ContactTime" );

	if( comp.value == "" )
	{
		window.alert( strEnter + " company name" );
		return false;
	}
	
	if( contact.value == "" )
	{
		window.alert( strEnter + " contact name" );
		return false;
	}
	
	
	if( address1.value == "" )
	{
		window.alert( strEnter + "n address" );
		return false;
	}
	
	if( postcode.value == "" )
	{
		window.alert( strEnter + " postcode" );
		return false;
	}
	
	if( phone.value == "" )
	{
		window.alert( strEnter + " contact number" );
		return false;
	}
	
	if( field9.value == "" )
	{
		window.alert( strEnter + " contact time" );
		return false;
	}
	
	return true;
}

function valNewForm()
{
	var strEnter = "You must enter a";

	var sname = document.getElementById( "Surname" );
	var fname = document.getElementById( "Firstname" );
	var field1 = document.getElementById( "CurrentPos" );
	//var email = document.getElementById( "Email" );
	var address1 = document.getElementById( "Address" );
	var postcode = document.getElementById( "PostCode" );
	var phone = document.getElementById( "HomePhone" );
	var field2 = document.getElementById( "MobilePhone" );
	var field3 = document.getElementById( "WorkPhone" );
	var field4 = document.getElementById( "DateOfBirth" );
	var field7 = document.getElementById( "Permit" );
	var field8 = document.getElementById( "Working" );
	var field9 = document.getElementById( "ContactTime" );

	if( sname.value == "" )
	{
		window.alert( strEnter + " surname" );
		return false;
	}
	
	if( fname.value == "" )
	{
		window.alert( strEnter + " forename" );
		return false;
	}
	
	if( field1.value == "" )
	{
		window.alert( strEnter + " current position" );
		return false;
	}
	
	if( address1.value == "" )
	{
		window.alert( strEnter + "n address" );
		return false;
	}
	
	if( postcode.value == "" )
	{
		window.alert( strEnter + " postcode" );
		return false;
	}
	
	if( phone.value == "" && field2.value == "" )
	{
		if( field3.value == "" )
		{
			window.alert( strEnter + " contact number" );
			return false;
		}
	}
	
	if( field4.value == "" )
	{
		window.alert( strEnter + " date of birth" );
		return false;
	}

	if( field9.value == "" )
	{
		window.alert( strEnter + " contact time" );
		return false;
	}
	
	return true;
}

function valNewContactForm()
{
	var strEnter = "You must enter a";

	var sname = document.getElementById( "surName" );
	var fname = document.getElementById( "firstName" );
	var field1 = document.getElementById( "contactNumber" );
	var email = document.getElementById( "emailAddress" );
	
	if( fname.value == "" )
	{
		window.alert( strEnter + " first name" );
		return false;
	}
	
	if( sname.value == "" )
	{
		window.alert( strEnter + " surname" );
		return false;
	}
	
	if( field1.value == "" )
	{
		window.alert( strEnter + " contact number" );
		return false;
	}
	
	if( email.value == "" )
	{
		window.alert( strEnter + "n email address" );
		return false;
	}
		
	return true;
}

function valNewPracForm()
{
	var strEnter = "You must enter a";

	var sname = document.getElementById( "Surname" );
	var fname = document.getElementById( "Firstname" );
	var email = document.getElementById( "E-Mail" );
	var address1 = document.getElementById( "Address" );
	var postcode = document.getElementById( "PostCode" );
	var phone = document.getElementById( "dayPhone" );
	var field2 = document.getElementById( "evePhone" );
	var field3 = document.getElementById( "otherPhone" );
	var field9 = document.getElementById( "ContactTime" );

	if( sname.value == "" )
	{
		window.alert( strEnter + " surname" );
		return false;
	}
	
	if( fname.value == "" )
	{
		window.alert( strEnter + " forename" );
		return false;
	}
	
	if( email.value == "" )
	{
		window.alert( strEnter + "n email address" );
		return false;
	}
	
	if( address1.value == "" )
	{
		window.alert( strEnter + "n address" );
		return false;
	}
	
	if( postcode.value == "" )
	{
		window.alert( strEnter + " postcode" );
		return false;
	}
	
	if( phone.value == "" && field2.value == "" )
	{
		if( field3.value == "" )
		{
			window.alert( strEnter + " contact number" );
			return false;
		}
	}

	if( field9.value == "" )
	{
		window.alert( strEnter + " contact time" );
		return false;
	}
	
	return true;
}

function openLink( strLink )
{
	window.open( strLink );
}

function goTo( strLink )
{
	top.frames[1].location = strLink;
}


function getCheckboxStringList(f) 
{ 
    var i, strList = ""; 

    for(i = 0; i < f.elements.length; i++) 
		{ 
        if(f.elements[i].type == "checkbox" && f.elements[i].checked == true) 
				{ 
            strList = strList + "#" + f.elements[i].id; 
        } 
    } 
    
    window.alert( strList );
    return strList;
} 

function openPositions( strJob, f )
{
    var i, strList = ""; 

    for(i = 0; i < f.elements.length; i++) 
		{ 
        if(f.elements[i].type == "checkbox" && f.elements[i].checked == true) 
				{ 
          	if( strList == "" )
						{
							strList = f.elements[i].id;
						}
						else
						{
            	strList = strList + ",%20" + f.elements[i].id; 
            }
        } 
    } 
	
		top.frames[1].location.href = "positionform.php?position=" + strJob + "&counties=" + strList;
}

function openPositions2( strJob, f )
{
    var i, strList = ""; 

    for(i = 0; i < f.elements.length; i++) 
		{ 
        if(f.elements[i].type == "checkbox" && f.elements[i].checked == true) 
				{ 
          	if( strList == "" )
						{
							strList = f.elements[i].id;
						}
						else
						{
            	strList = strList + ",%20" + f.elements[i].id; 
            }
        } 
    } 
	
		top.location.href = "positionform2?position=" + strJob + "&counties=" + strList;
}

function openPracticesForm( f )
{
    var i, strList = ""; 

    for(i = 0; i < f.elements.length; i++) 
		{ 
        if(f.elements[i].type == "checkbox" && f.elements[i].checked == true) 
				{ 
						if( strList == "" )
						{
							strList = f.elements[i].id;
						}
						else
						{
            	strList = strList + ",%20" + f.elements[i].id; 
            }
        } 
    } 
	
		top.frames[1].location.href = "practiceform.php?ref=" + strList;
}

function openPracticesForm2( f )
{
    var i, strList = ""; 

    for(i = 0; i < f.elements.length; i++) 
		{ 
        if(f.elements[i].type == "checkbox" && f.elements[i].checked == true) 
				{ 
						if( strList == "" )
						{
							strList = f.elements[i].id;
						}
						else
						{
            	strList = strList + ",%20" + f.elements[i].id; 
            }
        } 
    } 
	
	top.location.href = "practiceform2?ref=" + strList;
}

function OpenCareHomesForm(f) {
    var i, strList = "";

    for (i = 0; i < f.elements.length; i++) {
        if (f.elements[i].type == "checkbox" && f.elements[i].checked == true) {
            if (strList == "") {
                strList = f.elements[i].id;
            }
            else {
                strList = strList + ",%20" + f.elements[i].id;
            }
        }
    }

    top.location.href = "carehomeform.php?ref=" + strList;
}


function loadCandForm( f )
{
	var dp = f.dentist_perm.checked;
	var dl = f.dentist_locum.checked;
	var dnp = f.dentalnurse_perm.checked;
	var dnl = f.dentalnurse_locum.checked;
	var pmp = f.pracmanager_perm.checked;
	var pml = f.pracmanager_locum.checked;
	var rp = f.receptionist_perm.checked;
	var rl = f.receptionist_locum.checked;
	var hp = f.hygenist_perm.checked;
	var hl = f.hygenist_locum.checked;
	var rmp = f.regmanager_perm.checked;
	var rml = f.regmanager_locum.checked;
	var ip = f.implantolagist_perm.checked;
	var il = f.implantolagist_locum.checked;
	var ep = f.endoontist_perm.checked;
	var el = f.endoontist_locum.checked;
	var pep = f.periodontist_perm.checked;
	var pel = f.periodontist_locum.checked;
	var osp = f.oral_surgeon_perm.checked;
	var osl = f.oral_surgeon_locum.checked;
	var prp = f.prostodontist_perm.checked;
	var prl = f.prostodontist_locum.checked;
	var op = f.orthodontist_perm.checked;
	var ol = f.orthodontist_locum.checked;
	var apmp = f.apm_perm.checked;
	var apml = f.apm_locum.checked;
	var gpmp = f.gpm_perm.checked;
	var gpml = f.gpm_locum.checked;
	var php = f.pharm_perm.checked;
	var phl = f.pharm_locum.checked;
	var pprtp = f.pprt_perm.checked;
	var pprtl = f.pprt_locum.checked;
	var ptp = f.pt_perm.checked;
	var ptl = f.pt_locum.checked;
	var pop = f.pod_perm.checked;
	var pol = f.pod_lodum.checked;

	var strUrl = "candform.php?";
		strUrl += "&dp=" + dp;
		strUrl += "&dl=" + dl; 
		strUrl += "&dnp=" + dnp;
		strUrl += "&dnl=" + dnl;
		strUrl += "&pmp=" + pmp;
		strUrl += "&pml=" + pml;
		strUrl += "&rp=" + rp; 
		strUrl += "&rl=" + rl;
		strUrl += "&hp=" + hp; 
		strUrl += "&hl=" + hl; 
		strUrl += "&rmp=" + rmp;
		strUrl += "&rml=" + rml;
		strUrl += "&ip=" + ip; 
		strUrl += "&il=" + il; 
		strUrl += "&ep=" + ep; 
		strUrl += "&el=" + el; 
		strUrl += "&pep=" + pep;
		strUrl += "&pel=" + pel;
		strUrl += "&osp=" + osp;
		strUrl += "&osl=" + osl;
		strUrl += "&prp=" + prp;
		strUrl += "&prl=" + prl;
		strUrl += "&op=" + op; 
		strUrl += "&ol=" + ol;
		strUrl += "&apmp=" + apmp;
		strUrl += "&apml=" + apml; 
		strUrl += "&gpmp=" + gpmp; 
		strUrl += "&gpml=" + gpml; 
		strUrl += "&php=" +	php;
		strUrl += "&phl=" +	phl;
		strUrl += "&pprtp=" + pprtp;
		strUrl += "&pprtl=" + pprtl;
		strUrl += "&ptp=" +	ptp;
		strUrl += "&ptl=" +	ptl;
		strUrl += "&pop=" +	pop;
		strUrl += "&pol=" +	pol;
		 	
	loadFrame( strUrl );
}

function loadCandForm2()
{
    var vTest = document.getElementById( "dentist_perm" );

	var dp = document.getElementById( "dentist_perm" ).checked;
	var dl = document.getElementById( "dentist_locum" ).checked;
	var dnp = document.getElementById( "dentalnurse_perm" ).checked;
	var dnl = document.getElementById( "dentalnurse_locum" ).checked;
	var dsp = document.getElementById( "dentalsales_perm" ).checked;
	var dsl = document.getElementById( "dentalsales_locum" ).checked;
	var dtp = document.getElementById( "dentaltechnician_perm" ).checked;
	var dtl = document.getElementById( "dentaltechnician_locum" ).checked;
	var pmp = document.getElementById( "pracmanager_perm" ).checked;
	var pml = document.getElementById( "pracmanager_locum" ).checked;
	var rp = document.getElementById( "receptionist_perm" ).checked;
	var rl = document.getElementById( "receptionist_locum" ).checked;
	var hp = document.getElementById( "hygenist_perm" ).checked;
	var hl = document.getElementById( "hygenist_locum" ).checked;
	var rmp = document.getElementById( "regmanager_perm" ).checked;
	var rml = document.getElementById( "regmanager_locum" ).checked;
	var ip = document.getElementById( "implantolagist_perm" ).checked;
	var il = document.getElementById( "implantolagist_locum" ).checked;
	var ep = document.getElementById( "endoontist_perm" ).checked;
	var el = document.getElementById( "endoontist_locum" ).checked;
	var pep = document.getElementById( "periodontist_perm" ).checked;
	var pel = document.getElementById( "periodontist_locum" ).checked;
	var osp = document.getElementById( "oral_surgeon_perm" ).checked;
	var osl = document.getElementById( "oral_surgeon_locum" ).checked;
	var prp = document.getElementById( "prostodontist_perm" ).checked;
	var prl = document.getElementById( "prostodontist_locum" ).checked;
	var op = document.getElementById( "orthodontist_perm" ).checked;
	var ol = document.getElementById( "orthodontist_locum" ).checked;
	var apmp = document.getElementById( "apm_perm" ).checked;
	var apml = document.getElementById( "apm_locum" ).checked;
	var gpmp = document.getElementById( "gpm_perm" ).checked;
	var gpml = document.getElementById( "gpm_locum" ).checked;
	var php = document.getElementById( "pharm_perm" ).checked;
	var phl = document.getElementById( "pharm_locum" ).checked;
	var pprtp = document.getElementById( "pprt_perm" ).checked;
	var pprtl = document.getElementById( "pprt_locum" ).checked;
	var ptp = document.getElementById( "pt_perm" ).checked;
	var ptl = document.getElementById( "pt_locum" ).checked;

	var strUrl = "candform2.php?";
		strUrl += "&dp=" + dp;
		strUrl += "&dl=" + dl; 
		strUrl += "&dnp=" + dnp;
		strUrl += "&dnl=" + dnl;
		strUrl += "&dsp=" + dsp;
		strUrl += "&dsl=" + dsl;
		strUrl += "&dtp=" + dtp;
		strUrl += "&dtl=" + dtl;
		strUrl += "&pmp=" + pmp;
		strUrl += "&pml=" + pml;
		strUrl += "&rp=" + rp; 
		strUrl += "&rl=" + rl;
		strUrl += "&hp=" + hp; 
		strUrl += "&hl=" + hl; 
		strUrl += "&rmp=" + rmp;
		strUrl += "&rml=" + rml;
		strUrl += "&ip=" + ip; 
		strUrl += "&il=" + il; 
		strUrl += "&ep=" + ep; 
		strUrl += "&el=" + el; 
		strUrl += "&pep=" + pep;
		strUrl += "&pel=" + pel;
		strUrl += "&osp=" + osp;
		strUrl += "&osl=" + osl;
		strUrl += "&prp=" + prp;
		strUrl += "&prl=" + prl;
		strUrl += "&op=" + op; 
		strUrl += "&ol=" + ol;
		strUrl += "&apmp=" + apmp;
		strUrl += "&apml=" + apml; 
		strUrl += "&gpmp=" + gpmp; 
		strUrl += "&gpml=" + gpml; 
		strUrl += "&php=" +	php;
		strUrl += "&phl=" +	phl;
		strUrl += "&pprtp=" + pprtp;
		strUrl += "&pprtl=" + pprtl;
		strUrl += "&ptp=" +	ptp;
		strUrl += "&ptl=" +	ptl;
		 	
	loadFrame2( strUrl );
}

function valCVForm()
{
	var strEnter = "You must enter a";

	var surname = document.getElementById( "Surname" );
	var firstname = document.getElementById( "Firstname" );
	var nation = document.getElementById( "Nationality" );
	var email = document.getElementById( "Email" );
	var desc1 = document.getElementById( "Descriptive1" );
	var desc2 = document.getElementById( "Descriptive2" );
	var desc3 = document.getElementById( "Descriptive3" );
	var desc4 = document.getElementById( "Descriptive4" );
	var desc5 = document.getElementById( "Descriptive5" );
	
	var workmon = document.getElementById( "MondayHours" );
	var worktue = document.getElementById( "TuesdayHours" );
	var workwed = document.getElementById( "WednesdayHours" );
	var workthu = document.getElementById( "ThursdayHours" );
	var workfri = document.getElementById( "FridayHours" );
	var worksat = document.getElementById( "SaturdayHours" );
	var worksun = document.getElementById( "SundayHours" );
	

	if( surname.value == "" )
	{
		window.alert( strEnter + " surname" );
		return false;
	}
	
	if( firstname.value == "" )
	{
		window.alert( strEnter + " firstname" );
		return false;
	}
	
	
	if( nation.value == "" )
	{
		window.alert( strEnter + " nationality (n/a if British)" );
		return false;
	}
	
	if( desc1.value == "" )
	{
		window.alert( strEnter + "ll 5 descriptive words" );
		return false;
	}
	
	if( desc2.value == "" )
	{
		window.alert( strEnter + "ll 5 descriptive words" );
		return false;
	}
	
	if( desc3.value == "" )
	{
		window.alert( strEnter + "ll 5 descriptive words" );
		return false;
	}
	
	if( desc4.value == "" )
	{
		window.alert( strEnter + "ll 5 descriptive words" );
		return false;
	}
	
	if( desc5.value == "" )
	{
		window.alert( strEnter + "ll 5 descriptive words" );
		return false;
	}
	
	if( workmon.value == "" )
	{
		window.alert( strEnter + "ll present working hours (n/a if none)" );
		return false;
	}
	
	if( worktue.value == "" )
	{
		window.alert( strEnter + "ll present working hours (n/a if none)" );
		return false;
	}
	
	if( workwed.value == "" )
	{
		window.alert( strEnter + "ll present working hours (n/a if none)" );
		return false;
	}
	
	if( workthu.value == "" )
	{
		window.alert( strEnter + "ll present working hours (n/a if none)" );
		return false;
	}
	
	if( workfri.value == "" )
	{
		window.alert( strEnter + "ll present working hours (n/a if none)" );
		return false;
	}
	
	if( worksat.value == "" )
	{
		window.alert( strEnter + "ll present working hours (n/a if none)" );
		return false;
	}
	
	return true;
}

