function validate(selectedForm,aType)
		{var flag=true,a,s,m,d,cm,cd;
				a=parseInt(selectedForm.Age.value,10);
				s=selectedForm.spouseAge.value!=""?parseInt(selectedForm.spouseAge.value,10):0;
				x=parseInt(selectedForm.MaxPolicyLimit.value,10);
				if(x==26000)x=50000;if(x==51000)x=75000; if(x==101000)x=499000; if(x==0)x=25000;
				d=parseInt(selectedForm.Deductible.value,10);
				if(selectedForm.CountryofCitizenship)
				{if(selectedForm.CountryofCitizenship[0]&&selectedForm.CountryofCitizenship[1])ctz=selectedForm.CountryofCitizenship[0].checked==true?parseInt(selectedForm.CountryofCitizenship[0].value,10):parseInt(selectedForm.CountryofCitizenship[1].value);
				else ctz=selectedForm.CountryofCitizenship.value;}
				else ctz=2;
				
				if(selectedForm.monthsOfCoverage)cm=parseInt(selectedForm.monthsOfCoverage.value,10);
				if(selectedForm.daysOfCoverage)cd=parseInt(selectedForm.daysOfCoverage.value,10);
				
				if(a==""||isNaN(a)||a<1||a>99)	{alert(aType+"\'s Age is mandatory and it should be in numeric format in the range 1-99.");
					 selectedForm.Age.focus();		 flag=false;	return false;}
				if(s!=""&&(isNaN(s)||s<18||s>99))	{alert("Spouse Age should be in numeric format in the range 18-99.");
					 selectedForm.spouseAge.focus();	 flag=false;	return false;	}
				if(cm>12||(cm==12&&cd>0)||(cm==11&&cd>31)||cm<0||cd<0||cd>31){alert("Coverage period can not be more than one year(12 months)."); selectedForm.monthsOfCoverage.focus(); return false;}
				
				if((a>80||s>80)&&((x >100000&&ctz==1)||(x >50000&&ctz==2)))	{alert("For travelers who are 80 yrs and above, the maximum coverage amount has to be $25,000 or $50,000 or $100,000(US citizen and deductible $50).\n\n		Please change your selection and then click \"Get Quote\"");
					 selectedForm.MaxPolicyLimit.focus(); flag= false; return false;}
				if((a>70||s>70)&&((x >250000&&ctz==1)||(x >100000&&ctz==2)) )	{alert("For travelers who are 70 yrs and above, the maximum coverage amount has to be $25,000, $50,000 or $100,000(Non-US citizen) or $250,000(US citizen).\n\n		Please change your selection and then click \"Get Quote\"");
					 selectedForm.MaxPolicyLimit.focus(); flag= false; return false;}
				if((a>80||s>80) && d==0 && x==50000)	{alert("For all travelers who are 80 yrs and above requiring a $0 deductible, maximum policy coverage has to be $25,000.\n\n		Please change your selection and then click \"Get Quote\"");
					 selectedForm.Deductible.focus(); flag= false;	return false;}
				if( ((a>70&&a<80)||(s>70&&s<80)) && d==0 && x==25000)	{alert("For all travelers between 70-79 yrs requiring a $0 deductible, maximum policy coverage has to be $50,000 or more.\n\n		Please change your selection and then click \"Get Quote\"");
					 selectedForm.Deductible.focus(); flag= false;	return false;}
				
			if(flag==true)	{//selectedForm.quote.disabled=true;
				 selectedForm.submit(); return true;}
		}
function numbersonly(e)
		{var unicode=document.all? e.keyCode : e.which;
		if(unicode!=8&&(unicode<48||unicode>57))return false ;
		}
function FixGender(g,w)
		{if(w=="p"){document.globalForm.sgender.value=g=="F"?"M":"F";}
		 if(w=="s"){document.globalForm.pgender.value=g=="F"?"M":"F";}
		}
function validateGlobal()
		{var flag=true,a,s;
		a=document.globalForm.Age.value;
		s=document.globalForm.spouseAge.value;
		if(a==""||isNaN(a)||a<1||a>74)	{alert("Visitor\'s Age is mandatory and it should be in numeric format in the range 1-74.");
			document.globalForm.Age.focus();		flag=false;		return false;	}
		if(s!=""&&(isNaN(s)||s<10||s>74)){alert("Spouse Age should be in numeric format in the range 18-74.");
			document.globalForm.spouseAge.focus();	flag=false;		return false;	}
		if(flag==true)	{//document.globalform.quote.disabled=true;
				document.globalForm.submit();	}
		}
		
function validateTrip()
		{var a1=document.tripForm.Age1.value, a2=document.tripForm.Age2.value, t1=document.tripForm.TripCost1.value, t2=document.tripForm.TripCost2.value;
		if(a1==""){alert("Please enter the age of the first traveler and then click Get Quote.");return false;}
		if(document.tripForm.CountryOfResidence.value==""){alert("Please select the correct place of residence.");	return false;}
		if((a1!=""&&t1=="")||(a1==""&&t1!="")){alert("Please enter the trip cost for the first traveler and then click Get Quote.");	return false;}
		if((a2!=""&&t2=="")||(a2==""&&t2!="")){alert("Please enter the trip cost for the second traveler and then click Get Quote.");	return false;}
		document.tripForm.submit();
		}

