<!-- Hide code from non-js browsers
var minMonths=2
var maxMonths=18
var maxMonthsSenior=12
var maxMonthsSeniorPlus=12

/*
children, c <18
adults, a = 18 to 45
*/
var buypolicy=false
//First set up some global variables
var Worldwide=0
var Europe=0
var Australia=0
var WorldwideWk=0
var EuropeWk=0
var AusWk=0

	 

function getQuote(formObj) {

buypolicy=false
if(validateForm(formObj)){
	document.apply.action="WWTswitcher.php"
	document.apply.submit()
}
else {return}
}


function validateForm(formObj)
{
	document.apply.partner.value=partner
	adults=cleanAndSet("document.apply.a")
	adultsPlus=cleanAndSet("document.apply.ap")
	seniors=cleanAndSet("document.apply.s")
	seniorsPlus=cleanAndSet("document.apply.sp")
	children=cleanAndSet("document.apply.c")
	weeks=parseInt(getSelectValue(document.apply.hw))
	months=parseInt(getSelectValue(document.apply.hm))
	WSweeks=parseInt(getSelectValue(document.apply.ww))
	WSmonths=parseInt(getSelectValue(document.apply.wm))
	UKdepart=getRadioValue(document.apply.UKdepart)
	locale0=document.apply.l0.options[document.apply.l0.selectedIndex].value
	locale=document.apply.l.selectedIndex
	//alert ("locale0 is "+locale0+", locale is "+locale) 
	
	if (UKdepart!=1) {
		alert("Sorry, you can only buy this policy if you originally departed from, and will return to, the UK or EU")
		return false
	}
	
	if (months<minMonths) {
		alert("Sorry, you need to request at least "+minMonths+" months of cover")
		return false
	}
	
	if ((months > maxMonths) || (months==maxMonths && weeks>0) )
	{
		//alert ("here")
		alert("Sorry we can't provide this policy for over "+maxMonths+" months\nPlease try again");
		return false;
	}
	
	if ((WSmonths > months) || (WSmonths==months && WSweeks>0) )
	{
		//alert ("here")
		alert("Sorry you can't have wintersports extra cover that exceeds the period of your travel experience\nPlease try again");
		return false;
	}
	
	if(seniors>0 && (months>maxMonthsSenior || (months==maxMonthsSenior && weeks>0)) )
	{
		alert("Sorry people aged 50 to 54 are limited to "+maxMonthsSenior+" months cover" )
		return false
	}
	
	if(seniorsPlus>0 && (months>maxMonthsSeniorPlus || (months==maxMonthsSeniorPlus && weeks>0)) )
	{
		alert("Sorry aged 55 to 59 are limited to "+maxMonthsSeniorPlus+" months cover" )
		return false
	}
	if (locale0 == "z") {
		alert ("Please tell us where you are now")
		document.apply.l0.focus
		return false
	}
	
	if (locale0 != locale && locale!=0) {
		if (!confirm ("As the area where you are now is in a different policy area to the one the you are travelling to we will quote for Wordwide cover"))
		{
			document.apply.l0.focus
			return false
		}
		else 
		{
			document.apply.l.options[0].selected=true
		}
	}
	
	if ((adults+adultsPlus+seniors+seniorsPlus)==0)
	//if ((adults+adultsPlus)==0)
	{
		alert("We can only give a quote if there is at least one adult in the party\nPlease try again");
		return false;
	}
	
	homeTxt=document.apply.l0.options[document.apply.l0.selectedIndex].text
	document.apply.homeTxt.value=homeTxt
	return true
	
}	
// end hiding -->
