
slash = "";

bgcolor="white";
srFound=0;

// builds the rates in the browser
function drawRates() {
	if (r.length==0) { sr.innerHTML = "+ No search results to display."; return 1 }

	headerRow = "<tr class=searchTopRow style='text-align:center' valign=bottom><td rowspan=2 title='Your searched location'><b>" + searchArea + "</b></td><td rowspan=2 title='The normal full rate for the hotel'><b>Full<br>Rate</b></td><td colspan=15>";
	headerRow += "<table cellpadding=0 cellspacing=0 border=0 width=100%><tr><td width=150 nowrap>";
	if (rangeStart>1)	{
		headerRow += "<a href='' onClick=\"rangeStart-=7; drawRates(); return false\"><img src='/SBR2/images/Last7Days.gif' alt='View the previous 7 days' border=0></a>";
	}
	headerRow += "</td><td width=100% align=center title='The rates indicated below include tax and are stated per night per room'><b>Tax Inclusive Rate Per Room " + theCurrency + " $</b></td><td width=150 nowrap align=right>";
	if (rangeStart<15)	{
		headerRow += "<a href='' onClick=\"rangeStart+=7; drawRates(); return false\"><img src='/SBR2/images/Next7Days.gif' alt='View the next 7 days' border=0></a>";
	}
	headerRow += "</td></tr></table>";
	headerRow += "</td></tr><tr class=XsTRD>";

	for (i=rangeStart-1; i!=rangeStart+13; i++) {
		headerRow += "<td align=center><b>" + dates[i] + "</b></td>";
	}
	if (rangeStart>14) {
		headerRow += "<td><img src='/SBR2/images/quote_top.gif' alt='Request a Quote'></td>";
	}
	headerRow += "</tr>";

	counter=9;

	rows = "<table width=100% cellspacing=1 border=0 cellpadding=4 class=searchTableBackground>";

	onRequest=new Array();

	for (i=0; i!=r.length; i++) {

		tmp = new Array();
		tmp = r[i].split("|");
		// 0=index,1=title,2=rating,3=suburb,4=full rate,5=room types,6=ratesUnique,7=ratesSequence,8=incUnique,9=inc sequence,10=inc room sequence (using room types/5),11=jack attack sequence,12=hide offers,13=self-rated

		if (tmp[6]=="-1") {
			onRequest[onRequest.length]=r[i];
		}
		else {

			if (counter==9) {
				rows+=headerRow;
				counter=0;
			}

			ratesUnique = new Array();
			ratesUnique = tmp[6].split("^");
			ratesSequence = new Array();
			ratesSequence = tmp[7].split("^");
			incUnique = new Array();
			incUnique = tmp[8].split("^");
			incSequence = new Array();
			incSequence = tmp[9].split("^");
			incRoomSequence = new Array();
			incRoomSequence = tmp[10].split("^");
			fullRatesRooms = new Array();
			fullRatesRooms = tmp[5].split("~");
//			jackSequence = new Array();
//			jackSequence = tmp[11].split("^");

			fullRates="";
			
			tmp3 = new Array();

			for (ii=0; ii!=fullRatesRooms.length; ii++) {
				tmp3 = fullRatesRooms[ii].split("^");
				if (tmp3[0] != "") {
					fullRates += "<tr bgcolor=" + bgcolor + "><td nowrap>" + tmp3[0] + ": $" + tmp3[1] + "</td></tr>";
					if (bgcolor=="white") { bgcolor="#EAEAEA" }
					else { bgcolor="white" }
				}
			}
			fullRates = "<table cellpadding=4 cellspacing=1 border=0><tr><Td nowrap><b>Full Rates for Room Types:</b></td></tr>" + fullRates + "</table>";

			rows += "<tr bgcolor=white style='font-family:tahoma; font-size:12px; text-align:center'><td align=left width=100%><a href='" + slash + "index.cgi?act=info&i=" + tmp[0] + "' onmouseover=\"p2('" + tmp[3] + "')\" onMouseout=k()><b>" + tmp[1] + "</b></a><br>";
			
			rows += "<table cellpadding=0 cellspacing=0 border=0 width=100%><tr><td>" + starRating(tmp[2],tmp[13]) + "</td><td align=right><a href='" + slash + "index.cgi?act=info&i=" + tmp[0] + "'><img src='/SBR2/images/Book_Now.gif' border=0m alt='Book now at " + tmp[1] + "'></a></td></tr></table></td><td width=50 nowrap onmouseover=\"p2('" + fullRates + "')\" onmouseout=k() style='font-size:12px'>$" + parseInt(tmp[4]) + "</td>";

			rows2="";
			
			srFound=1;
			for (ii=rangeStart-1; ii!=rangeStart+13; ii++)	{
				styling="";
				link1 = "<a href='" + slash + "index.cgi?act=info&i=" + tmp[0] + "'>";
				if (incUnique[incSequence[ii]]!="" && tmp[11].substr(ii,1)==0) {
					styling = " class=searchInclusionBG";
				}
//				if (jackSequence[ii]==1) {
				if (tmp[11].substr(ii,1)==1) {
					styling = " class=jsRate";
					link1+="<span class=okjJAS>";
				}
				if (ratesUnique[ratesSequence[ii]]!=-1) {
					theRate = "$" + ratesUnique[ratesSequence[ii]];
				}
				else {
					theRate = "<img src='/SBR2/images/sold.gif' border=0>";
					incUnique[incSequence[ii]]="No rooms available for this night";
					styling = "";
					link1="";
				}
				rows2 += "<td onMouseover=\"p2('" + incUnique[incSequence[ii]] + "')\" onMouseout='k()' width=48 height=43 nowrap" + styling + ">" + link1 + theRate + "</a></td>";
			}
		
			rows+=rows2;
			
			if (rangeStart>14) {
				rows+="<td><a href='" + slash + "index.cgi?act=quote&i=" + tmp[0] + "'><img src='/SBR2/images/quote.gif' alt='Request a Quote at " + tmp[1] + "' border=0></a></td>";
			}

			rows += "</tr>";

			counter++;
		}
	}

	counter=9;

	if (onRequest.length>0)	{
		rows+= "<tr><td colspan=17 align=left bgcolor=white>";
		if (srFound==1)	{
			rows+= "<br><br><b><big>More Properties on Request</big></b>";
		}
		else {
			rows+= "<b><big>Properties on Request</big></b>";
		}
		rows+= "<br><br>The following properties do not have 28 days specials listed. Click (On Request) to receive a quote for any days in advance.<br><br></td></tr>";
		for (i=0; i!=onRequest.length; i++) {

			tmp = new Array();
			tmp = onRequest[i].split("|");
			// 0=index,1=title,2=rating,3=suburb,4=full rate,5=room types,6=ratesUnique,7=ratesSequence,8=incUnique,9=inc sequence,10=inc room sequence (using room types/5),11=jack attack sequence,12=hide offers

			fullRatesRooms = new Array();
			fullRatesRooms = tmp[5].split("~");
			fullRates="";
			for (ii=0; ii!=fullRatesRooms.length; ii++) {
				tmp3 = fullRatesRooms[ii].split("^");
				if (tmp3[0] != "") {
					fullRates += "<tr bgcolor=" + bgcolor + "><td nowrap>" + tmp3[0] + ": $" + tmp3[1] + "</td></tr>";
					if (bgcolor=="white") { bgcolor="#EAEAEA" }
					else { bgcolor="white" }
				}
			}
			fullRates = "<table cellpadding=4 cellspacing=1 border=0><tr><Td nowrap><b>Full Rates for Room Types:</b></td></tr>" + fullRates + "</table>";

			if (counter==9) {
				rows+= "<tr class=searchTopRow valign=bottom style='font-size:12px'><td align=center><b>" + searchArea + "</b></td><td><b>Full<br>Rate</b></td><td colspan=15></td></tr>";
				counter=0;
			}

			counter++;
			rows+= "<tr bgcolor=white bgcolor=white style='font-family:tahoma; font-size:12px'><td align=left>";
			rows+= "<a href='" + slash + "index.cgi?act=info&i=" + tmp[0] + "' onMouseover=\"p2('" + tmp[3] + "')\" onMouseout=k()><b>" + tmp[1] + "</b></a><br>" + starRating(tmp[2]) + "</td><td onMouseover=\"p2('" + fullRates + "')\" onMouseout=k() style='font-size:12px'>\$" + parseInt(tmp[4]) + "</td><td align=left nowrap colspan=15><a href='" + slash + "index.cgi?act=quote&i=" + tmp[0] + "'><img src='/SBR2/images/OnRequest.gif' border=0 alt='Request a quote at " + tmp[1] + "' align=absmiddle></a>";

			if (tmp[12]!="1") {
				rows+= "&nbsp;&nbsp;<b>Or</b>&nbsp;&nbsp;";
				rows+= "<a href='" + securePath + "index.cgi?act=tenderagree&i=" + tmp[0] + "&nowrap=1' onClick=\"window.open(this.href,'','width=575,height=600,scrollbars=yes');return false\"><img src='/SBR2/images/MakeAnOffer.gif' border=0 alt='Make an offer at " + tmp[1] + "' align=absmiddle></a>";
			}
			rows+= "</td></tr>";
		}
	}

	document.getElementById("sr").innerHTML = rows + "</table>";

}











Xoffset=-60;
Yoffset= 20;
var old,skn,iex=(document.all),yyy=-1000;
var ns4=document.layers;
var ns6=document.getElementById&&!document.all;
var ie4=document.all;

if (ns4) { skn=document.dek }
else if (ns6) { skn=document.getElementById("dek").style }
else if (ie4) { skn=document.all.dek.style }
if (ns4) { document.captureEvents(Event.MOUSEMOVE) }
else { skn.visibility="visible"; skn.display="none" }
document.onmousemove=get_mouse;

incCompression = new Array("Bedroom|!1","and|{","FREE|}","from|[","with|]","bedroom|!2","Room|!3","Queen|!4","per|_","for|~","Apartment|!4","breakfast|!5","free|\@","Free|=","the|+");
function p2(msg) {
  
	if (msg=="") { return 1	}

	tmp = new Array();
	for (i=0; i!=incCompression.length; i++) {
		tmp = incCompression[i].split("|");
		msg = msg.replace(tmp[1],tmp[0]);
	}

	yyy=Yoffset;
  
	content = "<TABLE WIDTH=150 BORDER=0 bgcolor=black CELLPADDING=1 CELLSPACING=1><TD aLIGN=center bgcolor=white>" + msg + "</TD></TABLE>";
	
	if(ns4){ skn.document.write(content);skn.document.close();skn.visibility="visible" }
  if(ns6){ document.getElementById("dek").innerHTML=content;skn.display='' }
  if(ie4){ document.all("dek").innerHTML=content;skn.display='' }
}

function k() {
	if(ns4){ skn.document.close();skn.visibility="hidden" }
  if(ns6){ skn.display='none' }
  if(ie4){ skn.display='none' }
}

function get_mouse(e) {
  var x=(ns4||ns6)?e.pageX:event.x+document.body.scrollLeft;
  if (x>120) {
		skn.left=x-120;
	}
  var y=(ns4||ns6)?e.pageY:event.y+document.body.scrollTop;
  skn.top=y+yyy;
}

// builds star ratign
starRatingsVenue=new Array("5","4.5","4","3.5","3","2.5","2","1.5","1");
function starRating(rating,ratingHide) {
	if (rating=="") { rating=0 }
	returnString="";
	tmp2 = new Array();
	tmp2 = starRatingsVenue[rating].split(".");
	if (ratingHide==1) {
		if (tmp2[1] == "5") {
			return "<img src='/SBR2/images/selfrated_" + tmp2[0] + "h.gif'>";
		}
		else {
			return "<img src='/SBR2/images/selfrated_" + tmp2[0] + ".gif'>";
		}
	}
	else {
		for (ii=0; ii!=tmp2[0]; ii++) {
			returnString += "<img src='/SBR2/images/star.gif' style='padding:2px'>";
		}
		if (tmp2[1]>0) {
			returnString += "<img src='/SBR2/images/star-half.gif'>";
		}
	}
	return returnString;
}



rangeStart=1;
drawRates();

