// JavaScript Document. Copyright Tim Heaps, Blythweb Limited February 2004

function checkage()
{
	if (document.page1.yy.value.length<4)
	{
		document.page1.yy.value="19"+document.page1.yy.value
	}
if(document.page1.yy.value<1927)
	{
		alert("Please check you date of birth is correct");
		document.page1.dd.focus();
		return false
	}
var mm = document.page1.mm.value-1
var dd = document.page1.dd.value
var yy = document.page1.yy.value
var unixage = new Date(yy,mm,dd)
var unixnow = new Date()
var unixold = unixnow - unixage
var yearsold = Math.floor(unixold/(1000*60*60*24*365.25))
document.page1.age.value = yearsold

}

function checkdoc()
{

if (document.page1.surname.value=="" )
	{
	alert("Please enter your last or family name.")
	document.page1.surname.focus() 
	return false
	}
if (document.page1.forenames.value=="" )
	{
	alert("Please enter your first name(s) in full.")
	document.page1.forenames.focus() 
	return false
	}	
if (document.page1.addr1.value=="" )
	{
	alert("Please make sure you have completed your address")
	document.page1.addr1.focus() 
	return false
	}		
if (document.page1.addr2.value=="" )
	{
	alert("Please make sure you have completed your address")
	document.page1.addr2.focus() 
	return false
	}
if (document.page1.tel.value=="" )
	{
	alert("Please tell us your daytime telephone number. \nPlease enter ‘NONE’ if you are unable to provide any of the telephone or fax numbers requested.")
	document.page1.tel.focus() 
	return false
	}	
if (document.page1.telpm.value=="" )
	{
	alert("Please tell us your evening telephone number. \nPlease enter ‘NONE’ if you are unable to provide any of the telephone or fax numbers requested.")
	document.page1.telpm.focus() 
	return false
	}
if (document.page1.mobile.value=="" )
	{
	alert("Please tell us your mobile (cell) telephone number. \nPlease enter ‘NONE’ if you are unable to provide any of the telephone or fax numbers requested.")
	document.page1.mobile.focus() 
	return false
	}	
if (document.page1.fax.value=="" )
	{
	alert("Please tell us a fax number we can use for you. \nPlease enter ‘NONE’ if you are unable to provide any of the telephone or fax numbers requested.")
	document.page1.fax.focus() 
	return false
	}	
if (document.page1.appemail.value=="" )
	{
	alert("Please tell us your email address. \nIf you do not enter an email address we will not be able to send you notification of receipt of your application with your application number and password.  If you do not have an email address then we will attempt to call you on the phone number you have provided.")
	document.page1.appemail.focus() 
	return false
	}	
if (document.page1.tel.value=="NONE" && document.page1.mobile.value=="NONE" && document.page1.appemail.value=="NONE"  )
	{
	alert("If you do not enter an email address we will not be able to send you notification of receipt of your application with your application number and password.  If you do not have an email address then we will attempt to call you on the phone number you have provided.")
	document.page1.tel.focus() 
	return false
	}	
	
checkage()

if (document.page1.age.value<20 )
	{
	alert("Please check your age. You must be at least 20 to work for Christies Care Ltd")
	document.page1.dd.focus() 
	return false
	}
	
if (document.page1.mumname.value=="" )
	{
	alert("Please enter your mother's maiden name which we use as a security check if you forget your password.")
	document.page1.mumname.focus() 
	return false
	}
if (document.page1.othernames.value=="" )
	{
	alert("Please enter details of any previous names you have been known by. If there are none please put NONE.")
	document.page1.othernames.focus() 
	return false
	}
if (document.page1.cwlth.value=="XX" )
	{
	alert("Please tell us if you are a citizen of a Commonwealth or a European Country by choosing from the drop down list. \nIf you are not a citizen of a Commonwealth or EU country please choose this option at the end of the list.")
	document.page1.cwlth.focus() ;
	return false
	}	

if (document.page1.pport[0].checked==false && document.page1.pport[1].checked==false )
	{
	alert("Please tell us if you have a valid passport.")
	document.page1.pport[0].focus() 
	return false
	}	

if (document.page1.visa.value=="XX" )
	{
	alert("Please tell us what type of visa you will have.")
	document.page1.visa.focus() 
	return false
	}	
		
	
if (document.page1.natnl.value=="" )
	{
	alert("Please tell us your Nationality")
	document.page1.natnl.focus() 
	return false
	}		
if (document.page1.lang[0].checked==false && document.page1.lang[1].checked==false )
	{
	alert("Please tell us if English is your first or second language")
	document.page1.lang[1].focus() 
	return false
	}		

if (document.page1.smoke[0].checked==false && document.page1.smoke[1].checked==false )
	{
	alert("Please tell us if you smoke")
	document.page1.smoke[1].focus() 
	return false
	}	
if (document.page1.drive[0].checked==false && document.page1.drive[1].checked==false )
	{
	alert("Please tell us if you drive")
	document.page1.drive[1].focus() 
	return false
	}
if (document.page1.drive[0].checked==true && document.page1.drvint.value=="XXX" )
	{
	alert("Please tell us what driving licence you hold")
	document.page1.drvint.focus() 
	return false
	}
if (document.page1.drive[0].checked==true && document.page1.drvtype[0].checked==false && document.page1.drvtype[1].checked==false )
	{
	alert("Please tell us whether you can drive a manual car or just an automatic")
	document.page1.drvtype[0].focus() 
	return false
	}
if (document.page1.drive[0].checked==true && document.page1.drvuk[0].checked==false && document.page1.drvuk[1].checked==false )
	{
	alert("Please tell us if you will drive in the UK")
	document.page1.drvuk[0].focus() 
	return false
	}
if (document.page1.drive[0].checked==true && document.page1.drvuk[0].checked==false)
{
	if (confirm("We can offer you more work if you are prepared to drive in the UK! \nWould you like to change your mind about driving in UK? \n Click OK to indicate that you would be prepared to drive in the UK. \n Click Cancel to keep your present answer."))
	{
		document.page1.drvuk[0].checked=true;
	}
}

document.page1.SubmitBtn.style.cssText="display:none;";
alert("Please wait whilst the information is processed. Page 2 will be displayed shortly.");
return true
}



function makegrey(varid)
{
var chngevar = document.getElementById(varid);
chngevar.className="greyout"	
}

function makered(varid)
{
var chngevar = document.getElementById(varid);
chngevar.className="reqd"	
}


function driveyes()
{
	makered("drive1")
	makered("drive2")
	makered("drive3")
}
function driveno()
{
	makegrey("drive1")
	makegrey("drive2")
	makegrey("drive3")
}

function drvukno()
{
	if (confirm("We can offer you more work if you are prepared to drive in the UK! \nWould you like to change your mind about driving in UK? \n Click OK to indicate that you would be prepared to drive in the UK. \n Click Cancel to keep your present answer."))
	{
		document.page1.drvuk[0].checked=true;
	}
}

