
<!--
var maxMonthDays = new Array(31,28,31,30,31,30,31,31,30,31,30,31,31,28,31,30,31,30,31,31,30,31,30,31);
function updateCalendars(fId,bDoDuration)
{
	//Local variables
	yFr=fId.startdate_y; mFr=fId.startdate_m; dFr=fId.startdate_d;
	yTo=fId.enddate_y; mTo=fId.enddate_m; dTo=fId.enddate_d;
	//Check depart date
	maxDaysInFrMonth=maxMonthDays[mFr.selectedIndex + (yFr.selectedIndex * 12)];
	if(dFr.selectedIndex >= maxDaysInFrMonth) { dFr.selectedIndex = maxDaysInFrMonth - 1 }
	if(bDoDuration==true)
	{
		//Alter durations
		if(dFr.selectedIndex + 8 > maxDaysInFrMonth) { dToNew = (dFr.selectedIndex + 7) - maxDaysInFrMonth; mToNew = mFr.selectedIndex + 1; }
		else { dToNew = dFr.selectedIndex + 7; mToNew = mFr.selectedIndex; }
		if(dFr.selectedIndex > dToNew && mFr.selectedIndex == 11 && yFr.selectedIndex == 1) { dToNew = 30; mToNew = 11; yToNew = 1; dFr.selectedIndex = 23; mFr.selectedIndex = 11; yFr.selectedIndex = 1; }
		else if(mFr.selectedIndex == 11 && dFr.selectedIndex > dToNew) { mToNew = 0; yToNew = 1; }
		else { yToNew = yFr.selectedIndex; }
		dTo.selectedIndex = dToNew; mTo.selectedIndex = mToNew; yTo.selectedIndex = yToNew;
	}
	else
	{
		//Check return date
		maxDaysInToMonth=maxMonthDays[mTo.selectedIndex + (yTo.selectedIndex * 12)];
		if(dTo.selectedIndex >= maxDaysInToMonth) { dTo.selectedIndex = maxDaysInToMonth - 1 }
	}
}
function checkTimeTravel(fId)
{
	//Local variables
	yFr=fId.startdate_y.selectedIndex; mFr=fId.startdate_m.selectedIndex; dFr=fId.startdate_d.selectedIndex;
	yTo=fId.enddate_y.selectedIndex; mTo=fId.enddate_m.selectedIndex; dTo=fId.enddate_d.selectedIndex;
	if( (yFr==yTo && mFr==mTo && dFr>=dTo) || (yFr==yTo && mFr>mTo) || (yFr>yTo) )
	{ return false; }
	else
	{ return true; }
}
function checkDateBlackout(fId)
{
	if(fId.startdate_y.selectedIndex == 0 && ((fId.startdate_m.selectedIndex < 2) || (fId.startdate_m.selectedIndex == 2 && fId.startdate_d.selectedIndex <= 12)))
	{ return false; }
	else
	{ return true; }
}
function showCalendar3(calTitle,calTarget,calInit,bDoDuration) {
	if(bDoDuration==null) { bDoDuration = true; }
	if(calInit!=null) {
		calendarWin=window.open("/includes/calendar.asp?initDate=" + eval("document." + calInit + "_d.value") + "/" + eval("document." + calInit + "_m.value") + "/" + eval("document." + calInit + "_y.value") + "&title=" + escape(calTitle) + "&field=" + escape(calTarget)+"&doduration="+bDoDuration,"calendarWin","width=204,height=202,left=" + ((screen.width-210)/2) + ",top=" + ((screen.height-240)/2) + ",status=no,toolbar=no,menubar=no,scrollbars=no,resizable=no");
	} else { 
		calendarWin=window.open("/includes/calendar.asp?initDate=" + eval("document." + calTarget + "_d.value") + "/" + eval("document." + calTarget + "_m.value") + "/" + eval("document." + calTarget + "_y.value") + "&title=" + escape(calTitle) + "&field=" + escape(calTarget)+"&doduration="+bDoDuration,"calendarWin","width=204,height=202,left=" + ((screen.width-210)/2) + ",top=" + ((screen.height-240)/2) + ",status=no,toolbar=no,menubar=no,scrollbars=no,resizable=no");
	}
	if(!calendarWin.opener) calendarWin.opener=self;
}
function checkAge(min_age, max_age, dobd, dobm, doby)
{
	if(dobd.selectedIndex == 0 || dobm.selectedIndex == 0 || doby.selectedIndex == 0)
	{ 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 = (doby[doby.selectedIndex].value);
		iBdm = (dobm[dobm.selectedIndex].value);
		iBdd = (dobd[dobd.selectedIndex].value);
		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; }
	}
}
// -->