<!--

// get target page for quoteresult
var thisPage;
var intLen;
thispage = window.document.location.toString();
intLen = thispage.indexOf('QuoteRequest');
resultpage = thispage.substring(0, intLen) + 'QuoteResult.html' ;

// target page for quote calculation
var calcpage = "http://www.bookdirect.com.au/QuoteCalc.asp";

// get the values of any querystring variables passed to this page 
var argstr,args,list,i,propcode,persons,arrdate
var mindays = 1
var days = 1
	argstr = decodeURI(location.search.substring( 1, location.search.length ));
	args = argstr.split( '&' );
	for( i = 0; i < args.length; i++ )
	{
	list = args[i].split( '=' );
	if (list[0] == "propcode") { propcode = list[1]}
	if (list[0] == "mindays") {  mindays = list[1]}
	if (list[0] == "arrivaldate")  {arrdate = new Date(list[1]) }
	if (list[0] == "persons") { persons = list[1]}
	if (list[0] == "days") {  days = list[1]}
	}

if (!arrdate) { arrdate = new Date() };
if (days < mindays) { days = mindays };

function setselected(arrdate){
var arryear,arrmonth,arrday,curryear
arryear = arrdate.getFullYear();
arrmonth = arrdate.getMonth();
arrday = arrdate.getDate();
curryear = new Date();
curryear = curryear.getFullYear();
document.form1.year.options[(arryear-curryear)].selected = true;
document.form1.month.options[arrmonth].selected = true;
document.form1.day.options[(arrday-1)].selected = true;
document.form1.Days.value = days ;
if (persons) { document.form1.Adult.value = persons  };

}

function populate(objForm,selectIndex) {
timeA = new Date(objForm.year.options[objForm.year.selectedIndex].text, objForm.month.options[objForm.month.selectedIndex].value,1);
timeDifference = timeA - 86400000;
timeB = new Date(timeDifference);
var daysInMonth = timeB.getDate();
for (var i = 0; i < objForm.day.length; i++) {
objForm.day.options[0] = null;
}
for (var i = 0; i < daysInMonth; i++) {
objForm.day.options[i] = new Option(i+1);
objForm.day.value[i] = new Option(i+1);
}
}


function getYears() {

for (var i = 0; i < document.form1.year.length; i++) {
document.form1.year.options[0] = null;
}

timeC = new Date();
currYear = timeC.getFullYear();
var years = new Array (currYear,currYear+1,currYear+2,currYear+3)

for (var i = 0; i < years.length; i++) {
document.form1.year.options[i] = new Option(years[i]);
}
}

<!-- Routines for validating and  submitting form-->


function requestquote(theForm)
{
var rqstring,arrivaldate,days,adult,child,unittype;
if (isNaN(parseInt(theForm.Days.value)) || parseInt(theForm.Days.value) < mindays  ) {
	alert ("Minimum booking is " + mindays + " Nights"); 
	return; }
if (parseInt(theForm.Days.value) > 99  ) {
	alert ("Max Days is 99"); 
	return; }
if (isNaN(parseInt(theForm.Adult.value)) || parseInt(theForm.Adult.value) < 1  ) {
	alert ("Must be at least 1 adult"); 
	return; }
if (parseInt(theForm.Adult.value) > 9  ) {
	alert ("Max Adult is 9"); 
	return; }
if (theForm.Child.value == "" ) {theForm.Child.value = 0}  
if (isNaN(parseInt(theForm.Child.value)) ) {
 	 alert ( "Child must be 0 or a number");
	return; }
if (parseInt(theForm.Child.value) > 9  ) {
	alert ("Max Child is 9"); 
	return; }
adult = parseInt(theForm.Adult.value)
child = parseInt(theForm.Child.value)
arrivaldate = theForm.day.options[theForm.day.selectedIndex].text + " " + theForm.month.options[theForm.month.selectedIndex].text + " " + theForm.year.options[theForm.year.selectedIndex].text;
days = parseInt(theForm.Days.value)
unittype = getRadioValue("UType")
rqstring = calcpage + "?propcode=" + propcode + "&arrivaldate=" + arrivaldate + "&days=" + days + "&adult=" + adult + "&child=" + child + "&unittype=" + unittype + "&resultpage=" + resultpage

// set cookie to test if cookies enabled and ensure booking can only be made in next 20 min
expireDate = new Date();
expireDate.setMinutes(expireDate.getMinutes()+20)
document.cookie = "bkgcookie=Yes;expires=" + expireDate.toGMTString() + ";";
//document.cookie = "bkgcookie=Yes;domain=.bookdirect.com.au;expires=" + expireDate.toGMTString() + ";";

// parent.frames["Result"].document.location.href = rqstring
parent.document.getElementById('Result').src = rqstring;
}

function getRadioValue(radioName) {
  var collection;
  collection = document.all[radioName];
  for (i=0;i<collection.length;i++) {
    if (collection[i].checked)
    return(collection[i].value);
  }
}

-->
