<!-- Hide code from non-js browsers
//25/05/07 Sacha added seniorsExtra.  disabled SNfamily
//First set up some global variables
var adults=0
var adultsPlus=0
var seniors=0
var over80=0
var children=0
var kids=0
var babies=0
var locale=0
var days =0
	 
function getQuote(formObj) {
if(validateForm(formObj)){
document.stquote.action="WWTswitcher.php"
document.stquote.submit()
}
else {return}
}

function autoSelectArea(formObj)
{

//Note this does not do anything as auto selection of area may cause more confusion than help?

}


function validateForm(formObj)
{
	document.stquote.partner.value=partner
	adults=cleanAndSet("document.stquote.a")
	adultsPlus=cleanAndSet("document.stquote.ap")
	seniors=cleanAndSet("document.stquote.s")
	seniorsPlus=cleanAndSet("document.stquote.sp")
	seniorsExtra=cleanAndSet ("document.stquote.se")
	children=cleanAndSet("document.stquote.c")
	kids=cleanAndSet("document.stquote.k")
	babies=cleanAndSet("document.stquote.b")
	locale=getSelectValue(document.stquote.l)
	mainAreaCode=getSelectValue(document.stquote.l0)
	//alert ("locale is "+locale+", mainAreaCode is "+mainAreaCode)
	//SNfamily=getRadioValue(document.stquote.SNfamily)
	//alert ("SNfamily is "+SNfamily)
	period=document.stquote.days.selectedIndex
	ski=getRadioValue(document.stquote.ski)
	//alert("period="+period)
	if (period==0) {days=1}
	if (period==1) {days=3}
	if (period==2) {days=5}
	if (period>2) {
		days=((period-2)*7)+3
	}
	if (period==5) {days=23}
	//alert("days="+days)
	document.stquote.d.value=days
	
	//alert ("over80="+over80+"\nlocale="+locale)
	noAdults=(adults+adultsPlus+seniors+seniorsPlus+seniorsExtra)
	
	//alert(adults+adultsPlus+seniors+seniorsPlus+children+kids)
	if ((adults+adultsPlus+seniors+seniorsPlus+seniorsExtra+children+kids)<1)
	{
		alert("We can only give a quote if you tell us how many people there are in the party\nPlease try again");
		return false;
	}
	if (noAdults<1)
	{
   		alert("We can not sell you this policy on-line as there are no adults in the party\nPlease phone us on 0870 112 8100 or email us at enquiry@worldwideinsure.com")
   		return false
	}
	
	if (seniorsExtra>0 && ski==1)
	{
   		alert("Sorry, we can not add wintersports cover for the oldest band of people on this policy\nIf you have a mxed party (of older and younger travellers) please purchase separate policies")
   		return false
	}
	if (seniorsExtra>0 && days>31)
	{
   		alert("Sorry, we can not offer more than 31 days cover for the oldest band of people on this policy\nIf you have a mxed party (of older and younger travellers) please purchase separate policies")
   		return false
	}
	/*
	if (noAdults==seniorsPlus && locale==0)
	{
   		alert("Sorry - We can not sell travel insurance for worldwide travel to older senior citizens")
   		return false
	}
	if (seniorsPlus>0 && (locale==0||locale==3||locale==4))
	{
   		alert("Sorry - We can not sell travel insurance for this area to older senior citizens\nYou can get a quote for the remainder of the party by removing the older senior citizens")
   		return false
	}
	//I don't think this should be here SBW if ((seniors>0 ||seniorsPlus>0) && (locale==0||locale==3||locale==4))
	//{
   		//alert("Sorry - We can not sell travel insurance for this area to older senior citizens\nYou can get a quote for the remainder of the party by removing the older senior citizens")
   		//return false
	//}
	*/
	//if(SNfamily==1) {
	//	if (noAdults!=SNfamily) {
   	//		alert("You can only have 1 adult on a single parent family policy\nPlease select another policy type at the top of the page")
   	//		return false
	//	}
	//	if (children==0) {
   	//		alert("A single parent family policy must have some of your children (babies under 2 are free)\nPlease select another policy type at the top of the page")
   	//		return false
	//	}
	//}
	//if(SNfamily==2) {
	//	if (noAdults!=SNfamily) {
   	//		alert("You can only have 2 adults on a  family policy (babies under 2 are free)\nPlease select another policy type at the top of the page")
   	//		return false
	//	}
	//	if (children==0) {
   	//		alert("A family policy must have some of your children\nPlease select another policy type at the top of the page")
   	//		return false
	//	}
	
	//alert ("mainArea is "+mainArea)
	if (mainAreaCode==9) {
		alert("Please select the principal country that you are travelling to")
		return false
	}
		
	if(locale!=0) {
		if (mainAreaCode==0) {
			alert("The principal country that you are travelling to is not in the area that you have selected\nPlease select an appropriate area ('Worldwide including USA/Canada')")
			return false
		}
		if (mainAreaCode==1 && (locale != 1 && locale != 4)) {
			alert("The principal country that you are travelling to is not in the area that you have selected\nPlease select an appropriate area ('Worldwide including USA/Canada', 'Europe', or 'Worldwide excluding USA/Canada')")
			return false
		}
		if (mainAreaCode==2 && locale == 3) {
			alert("The principal country that you are travelling to is not in the area that you have selected\nPlease select an appropriate area ('Worldwide including USA/Canada', 'Europe', 'UK etc' or 'Worldwide excluding USA/Canada')")
			return false
		}
		if (mainAreaCode==3 && (locale != 3 && locale != 4)) {
			alert("The principal country that you are travelling to is not in the area that you have selected\nPlease select an appropriate area ('Worldwide including USA/Canada', 'Australia and New Zealand', or 'Worldwide excluding USA/Canada')")
			return false
		}
		if (mainAreaCode==4 && locale != 4) {
			alert("The principal country that you are travelling to is not in the area that you have selected\nPlease select an appropriate area ('Worldwide including USA/Canada' or 'Worldwide excluding USA/Canada')")
			return false
		}
	}
	mainArea=document.stquote.l0.options[document.stquote.l0.selectedIndex].text
	//alert ("mainarea is "+mainArea)
	document.stquote.mainArea.value=mainArea
	return true
}	
// end hiding -->
