<!--
function changeInsuranceType(fId)
{
	if(fId[fId.selectedIndex].value == '1') { 
		div_switch('divSingleTrip',true,true);
		div_switch('divAnnualTrip',false,true);
		div_switch('divFamilyChildren',false,true);
		//div_switch('divInsPolicy2a',false,true); div_switch('divInsPolicy2b',false,true); div_switch('divInsPolicy1a',true,true); div_switch('divInsPolicy1aTitle',true,true); div_switch('divInsPolicy1b',true,true);div_switch('singleInfo',true,true);div_switch('annualInfo',false,true);div_switch('divFamilyChildren',false,true);
	}else{ 
		div_switch('divAnnualTrip',true,true);
		div_switch('divSingleTrip',false,true);

		
		//div_switch('divInsPolicy1a',false,true); div_switch('divInsPolicy1aTitle',false,true); div_switch('divInsPolicy1b',false,true); div_switch('divInsPolicy2a',true,true); div_switch('divInsPolicy2b',true,true);div_switch('singleInfo',false,true);
	}
}
function checkInsuranceForm(fId)
{
	var bValid = true;
	if(fId.policy.value=='1' && fId.person_1.value=='0' && fId.person_2.value=='0') {
		alert('Please select at least 1 adult or 1 senior');
		bValid = false;		
	}
	if(fId.policy[fId.policy.selectedIndex].value == '1')
	{
		//if(checkValidDate(fId) == false) {
		//	alert("Please select an alternative trip start date!\nThe date you have selected is unavailable."); fId.startdate_d.focus(); bValid = false;
		//}	else if(checkTimeTravel(fId) == false) {
		//	alert("Please select an alternative trip end date!\nYour trip start date is after your trip end date."); fId.enddate_d.focus(); bValid = false;
		//}
	if (bValid) {
		if(fId.person_1.selectedIndex == 0 && fId.person_2.selectedIndex == 0 && fId.person_3.selectedIndex == 0 && fId.person_4.selectedIndex == 0 && fId.person_6.selectedIndex == 0) 
		//&& fId.person_5.selectedIndex == 0
		{
			alert("Please enter at least one person to be insured!"); fId.person_1.focus(); bValid = false;
		} else if(fId.person_1.selectedIndex == 0 && fId.person_2.selectedIndex == 0 && fId.person_3.selectedIndex == 0 && fId.person_6.selectedIndex >= 1) {
			alert("Infants can not be insured on their own!\nPlease select an accompanying adult."); fId.person_1.focus(); bValid = false;
		}
	}
	}
	return bValid;
}

function checkpaxinsurance(fld){
	var adultcount = document.getElementById('person_1').value;
	var seniorcount = document.getElementById('person_2').value;
	var childcount = document.getElementById('person_4').value;
	var infantcount = document.getElementById('person_6').value;
	if (childcount >0 || infantcount >0){
		if (adultcount + seniorcount <=1){
			alert('Children must be accompanied by 2 adults. Please call for single parent family rates.');
		adultcount = 2;
		}
	}
	document.getElementById('person_1').value = adultcount;
	document.getElementById('person_2').value = seniorcount;
	document.getElementById('person_4').value = childcount;
	document.getElementById('person_6').value = infantcount;
}

function checkAgeTxt(min_age, max_age, dobd, dobm, doby)
{
	var iDobd, iDodm, iDoby
	try { iDobd = dobd.value; }
	catch (er) { iDobd = 0; }
	
	try { iDobm = dobm.value; }
	catch (er) { iDobm = 0; }
	
	try { iDoby = doby.value; }
	catch (er) { iDoby = 0; }

	if(iDobd == 0 || iDobm.value == 0 || iDoby.value == 0) { return false; }
	else if(isDate(iDobd + '/' + iDobm + '/' + iDoby)==false)	{ return false; }
	else {
		dtTodaysDate = new Date();
		iMonth = dtTodaysDate.getMonth();              
		iDay = dtTodaysDate.getDate();                 
		iYear = dtTodaysDate.getYear();
		if(iYear < 1000) { iYear += 1900; }
		iHour = dtTodaysDate.getHours();
		iMinute = dtTodaysDate.getMinutes();
		iSecond = dtTodaysDate.getSeconds();   
		iBdy = iDoby;
		iBdm = iDobm;
		iBdd = iDobd;
		dtBDate = Date.UTC(iBdy,iBdm,iBdd,'1','0','0');
		if(iYear < 2000) { dtCDate = Date.UTC(iYear,iMonth,iDay,iHour,iMinute,iSecond); }
		else { dtCDate = Date.UTC(iYear,iMonth,iDay,iHour,iMinute,iSecond); }
		iAge = dtCDate - dtBDate + (1000*60*60*24*30);
		iAge_Years = parseInt(((((iAge/1000)/60)/60)/24)/365.25,10);
		iAge_Days = parseInt((((iAge/1000)/60)/60)/24,10);
		iAge_Hrs = parseInt(((iAge/1000)/60)/60,10);
		iAge_Mins = parseInt((iAge/1000)/60,10);
		iAge_Secs = parseInt(iAge/1000,10);
		if(iAge_Years > max_age || iAge_Years < min_age) { return false; }
		else { return true; }
	}
}
// -->
