<!--

// page for reservation
var resformpage = "http://www.bookdirect.com.au/Res.asp";

// get querystring variables returned from quotecalc 
var argstr,args,list,i
//alert(window.location.search);
var availability = "";
var cost = "";
var ratecode = "";
var propcode = "";
var arrivaldate = "";
var departuredate = "";
var unittype = "";
var adult = "";
var child = "";


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] == "availability")  { availability = list[1] }
if (list[0] == "lowrate") { ratecode = list[1]}
if (list[0] == "lowcost") { cost = list[1]}
if (list[0] == "propcode") { propcode = list[1]}
if (list[0] == "arrivaldate") { arrivaldate = list[1]}
if (list[0] == "departuredate") { departuredate = list[1]}
if (list[0] == "adult") { adult = list[1]}
if (list[0] == "child") { child = list[1]}
if (list[0] == "unittype") { unittype = list[1]}

}

if (availability == "excess") {availability = "Too many persons for this room type"}

cost = cost.replace(",","")
ratecode = ratecode.replace("\%20"," ")

function CheckCookie()
// returns the value of the cookie bkgcookie
{
	var thiscookie,i
	
	if (document.cookie != "")
	{
	thiscookie = document.cookie.split("; ")
	for (i=0; i<thiscookie.length ; i++)
	{
	if (thiscookie[i].split("=")[0] == "bkgcookie")     { return thiscookie[i].split("=")[1]} 
	}
//	return "Yes"  // include this line if cookie problems
	}
   else { return "No"; }   //  set to yes if cookie problems ie because of security across frames
 
}

function CurrencyPopup()
  {
    fromcurrency = "AUD"
    QueryString = "Amount=" + cost + "&amp;From=" + "AUD"
    CurrencyWindow = window.open ('', 'CurrencyWindow', 'toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=1,height=170,width=600')
    CurrencyWindow.focus()
    CurrencyWindow.location.href = 'http://www.xe.net/ecc/input.cgi?Template=sw&'+QueryString
  }

function makereservation(){
  	var strRes = ""
  	if (CheckCookie() == "Yes") 
 	{
	strRes = resformpage + "?propcode=" + propcode + "&arrivaldate=" + arrivaldate + "&departuredate=" + departuredate 
	strRes = strRes + "&adult=" + adult + "&child=" + child + "&unittype=" + unittype
	strRes = strRes + "&cost=" + cost + "&ratecode=" + ratecode + "&source=web"
	BookingWindow = window.open ('', 'BookingWindow', 'toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,height = 600,width = 800,resizable=1')
	BookingWindow.focus()
	BookingWindow.location.href = strRes
	
	}
 	
 	else
 	{
	alert ("Cannot make booking - cookies are not enabled or session has expired")
	} 
}

function bodyhtml()
{
	if (availability != "")
	{
	document.writeln("Available:&nbsp;<font color=\"" + fcolor + "\">" + availability + "</font> </p> <p align=\"left\"> ")
	if (cost < 1) {document.writeln(ratecode)};
	if (cost > 0) 
 		{
 		document.writeln("Cost: $Aus&nbsp;<font color=\"" + fcolor + "\">" + cost + "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font> </p> <p align=\"left\"> \
	 	<a href=\"javascript:CurrencyPopup()\"> Currency Converter</a>&nbsp; \
	 	</p><p align=\"center\">")
		if (CheckCookie() == "Yes") 
	 		{
	 		document.writeln("<input type=\"button\" style=\"width: 100; font-size: 8pt\"  value= \"Book Now\" name=\"Booking\" onclick = \"makereservation(document.form2)\" ")
	 		}
			else
 			{
			document.writeln("You cannot make a booking because cookies are not enabled or this session has expired")
	 		}
		}
	

	}
	else
	{
	document.writeln("When you Click on the Quote button, availability and pricing will appear in this window. If there is availability click the Book Now button to make a booking. If it appears with no availability please contact our office direct for a booking on (07) 4099 5662. Int: 61 7 4099 5662, or info@pdo.com.au") 
	}

}

-->
