span00=0;
span01=0;
span02=0;
span03=0;
span04=0;
span05=0;
span06=0;
span07=0;
span08=0;

rateRow00=0;
rateRow01=0;
rateRow02=0;
rateRow03=0;
rateRow04=0;
rateRow05=0;
rateRow06=0;
rateRow07=0;
rateRow08=0;

span10=0;
span11=0;
span12=0;
span13=0;
span14=0;
span15=0;
span16=0;
span17=0;
span18=0;

rateRow10=0;
rateRow11=0;
rateRow12=0;
rateRow13=0;
rateRow14=0;
rateRow15=0;
rateRow16=0;
rateRow17=0;
rateRow18=0;

span20=0;
span21=0;
span22=0;
span23=0;
span24=0;
span25=0;
span26=0;
span27=0;
span28=0;

rateRow20=0;
rateRow21=0;
rateRow22=0;
rateRow23=0;
rateRow24=0;
rateRow25=0;
rateRow26=0;
rateRow27=0;
rateRow28=0;

span30=0;
span31=0;
span32=0;
span33=0;
span34=0;
span35=0;
span36=0;

span40=0;
span41=0;
span42=0;
span43=0;
span44=0;
span45=0;
span46=0;
span47=0;
span48=0;

rateRow40=0;
rateRow41=0;
rateRow42=0;
rateRow43=0;
rateRow44=0;
rateRow45=0;
rateRow46=0;
rateRow47=0;
rateRow48=0;

rateRow30=0;
rateRow31=0;
rateRow32=0;
rateRow33=0;
rateRow34=0;
rateRow35=0;
rateRow36=0;

maxSubTypes=0;
function showOnly (type,subtype) {
	if (type==0) { maxSubTypes=9 }
	else if (type==1) { maxSubTypes=8 }
	else if (type==2) { maxSubTypes=8 }
	else if (type==3) { maxSubTypes=7 }
	else if (type==4) { maxSubTypes=9 }

	for (i=0; i!=maxSubTypes; i++) {
		obj = eval("span" + type + "" + i);
		if (obj>0) {
			for (ii=0; ii!=obj+1; ii++) {
				skip=0;
				obj2 = eval("row" + type + "" + i + "" + ii);
				obj2.style.display="none";
				if (subtype==i || subtype==-1) { 
					if (skip==0) {
						obj2.style.display="inline";
					}
				}
			}
		}

		obj = eval("rateRow" + type + "" + i);
		if (obj>0) {
			for (ii=0; ii!=obj; ii++) {
				skip=0;
				obj2 = eval("xx" + type + "" + i + "" + ii);
				obj2.style.display="none";
				if (subtype==i || subtype==-1) { 
					if (skip==0) {
						obj2.style.display="inline";
					}
				}
			}
		}

	}
}

function updateRemain(obj1,obj2,sold) {
	obj=eval("remain_" + obj2);
	result = (obj1.value - sold);
	if (result<0) {result=0};
	obj.innerHTML = result;
}

if (document.layers) document.captureEvents(Event.MOUSEMOVE);
document.onmousemove=mtrack;

x=0;
y=0;
ns4=document.layers;
ns6=document.getElementById&&!document.all;
ie4=document.all;
function mtrack(e) {
  x=(ns4||ns6)?e.pageX:event.x+document.body.scrollLeft;
  y=(ns4||ns6)?e.pageY:event.y+document.body.scrollTop;
}

sI = new Array();
function incPopup(text,show,adjust) {
	if (text == "Z") { text = "Not available for booking" }
	else if (text == "SS") { text = "<img src='' align=absmiddle>&nbsp;Ring 0418 857892 to confirm availability" }
	else if (text == "Y") { text = "Sold out for this date" }
	else if (text == "X") { text = "Not available for this date" }

	if (text.indexOf("Z!Z")!=-1) {
		text = "Inclusions: " + sI[parseInt(text.substr(3,10))];
	}

	if (adjust==null) { adjust=0  }
	if (show==1) {
		x2=0;
		y2=20;
		if ( ( x + 240 ) > document.body.clientWidth) { x2 -= 210 }
		incHTML.style.left = x+x2;
		incHTML.style.top = y+(y2+adjust);
		incHTML.innerHTML = "<table width=200 bgcolor=#DDDDFF style='border:2px solid black'><tr><td>" + text + "</td></tr></table>";
		incHTML.style.display="inline";
	}
	else {
		incHTML.style.display="none";
	}
}

setTO=0;
function iP(text,show,adjust,hotdeal) {
	if (setTO) { clearTimeout(hmmIP) }
	d();
	text2=text;
	if (text == "Z") { text = "Not available for booking" }
	else if (text == "SS") { text = "<img src='/ntstandby/phone.png' align=left>&nbsp;Ring 0418 857 892 to confirm availability" }
	else if (text == "Y") { text = "Sold out for this date" }
	else if (text == "X") { text = "Not available for this date" }
	if (text.indexOf("Z!Z")!=-1) {
		text = sI[parseInt(text.substr(3,10))];
	}

	if (text2 != "Z" && text2 != "Y" && text2 != "X" && text2 != "SS") {
		text = "Inclusions: " + text;
	}

	if (text == "Inclusions: SS") { text = "<img src='/ntstandby/phone.png' align=left>&nbsp;Ring 0418 857 892 to confirm availability" }

	text = text.replace(/\^/g,"tour");
	text = text.replace(/\{/g,"Darwin");
	text = text.replace(/\@/g,"seat");
	text = text.replace(/\}/g,"left");

	if (adjust==null) { adjust=0  }
	if (show==1) {
		x2=0;
		y2=20;
		if ( ( x + 240 ) > document.body.clientWidth) { x2 -= 210 }
		incHTML.style.left = x+x2;
		incHTML.style.top = y+(y2+adjust);
		tag="";
		if (text.indexOf("available for booking")==-1) {
			if (hotdeal==1) { tag = "<font color=red><b>** SPECIAL **</b></font> " }
		}

		incHTML.innerHTML = "<table width=200 bgcolor=#DDDDFF style='border:2px solid black'><tr><td>" + tag + text + "</td></tr></table>";
		incHTML.style.display="inline";
	}
	else {
		incHTML.style.display="none";
	}

	hmmIP=setTimeout("d()",3000);
	setTO=1;
}

function d() {
	incHTML.style.display="none";
}

function imgPopup(text,show,adjust) {
	if (adjust==null) { adjust=0  }
	if (show==1) {
		x2=0;
		y2=20;
		if ( ( x + 240 ) > document.body.clientWidth) { x2 -= 210 }
		incHTML.style.left = x+x2;
		incHTML.style.top = y+(y2+adjust);
		incHTML.innerHTML = "<font face=Tahoma size=1>" + text + "</font>";
		incHTML.style.display="inline";
	}
	else {
		incHTML.style.display="none";
	}
}

function clearCheckBoxes(obj) {
	for (i=0; i!=document.form001.elements.length; i++) {
		if (document.form001.elements[i].name.indexOf("book_")!=1 && document.form001.elements[i].name!=obj.name) {
			document.form001.elements[i].checked=false;
		}
	}
}

var altText="";
var currentImage=0;
var tmp = new Array();
var imagesD = new Array();
function rotateImages() {
	if (currentImage==4) { currentImage=0 }
	if (imageText.length!=0) {
		if (imageText[currentImage].length!=0) {
			altText = imageText[currentImage];
		}
	}

	if (imagesD[currentImage] != null) {
		tmp = imagesD[currentImage].split("|");
		document.getElementById("img1").innerHTML="<div align=center xstyle='width:200px'><a href='" + tmp[1] + "' target=_blank><img src='" + tmp[0] + "' border=0 style='border:1px solid black' alt=\"" + altText + " - click to enlarge\"></a><br><font size=1>" + altText + "</font><br></div>";
	}

	if (imageText.length!=0) {
		if (imageText[currentImage+1].length!=0) {
			altText = imageText[currentImage+1];
		}
	}

	if (imagesD[currentImage+1] != null) {
		tmp = imagesD[currentImage+1].split("|");
		document.getElementById("img2").innerHTML="<div align=center xstyle='width:200px'><a href='" + tmp[1] + "' target=_blank><img src='" + tmp[0] + "' border=0 style='border:1px solid black' alt=\"" + altText + " - click to enlarge\"></a><br><font size=1>" + altText + "</font><br></div>";
	}
	currentImage+=2;
	if (imagesD.length>2) {
		yeh = setTimeout("rotateImages()",9000);
	}
}

maxImages=0;
function rotateImages2() {
	if ((currentImage)==4) { currentImage=0 }

	exists=0;
	for (var i=0; i!=4; i++) {
		if ( document.getElementById("imgi"+ (i+1) ) ) {
			document.getElementById("imgi"+ (i+1) ).style.display="none";
		}
	}

	if (document.getElementById("imgi"+(currentImage+1))) {
		setTimeout("document.getElementById('imgi'+" + (currentImage+1) + ").style.display=''",250);
	}
	if (document.getElementById("imgi"+(currentImage+2))) {
		setTimeout("document.getElementById('imgi'+" + (currentImage+2) + ").style.display=''",250);
	}

	currentImage+=2;
	if (maxImages>2) {
		setTimeout("rotateImages2()",9000);
	}

}

	value=2;
	function nextNearest(value,fix) {
		value = parseFloat(value);
		value2 = value+"";
		value2 = value2.substr(value2.length-1,1);
		value = value.toFixed(1)*2;
		value = (value).toFixed(2) / 2;
		if (value2 > 5) {
//			value -= 0.10;
		}

		if (fix == 0) {
			return value;
		}
		else {
			return value.toFixed(2);
		}
	}

	function checkChild(obj,dateC) {
		obj1 = eval("document.form001.qty_" + dateC);
		obj2 = eval("document.form001.qtyC_" + dateC);
		val1 = obj1.options[obj1.selectedIndex].value;
		val2 = obj2.options[obj2.selectedIndex].value;
		max = obj2.options[obj2.options.length-1].value;
		if ((parseInt(val1) + parseInt(val2)) > max) {
			alert("The maximum number of persons for this date is " + max + ".\n\nPlease adjust your Adult and Children numbers and try again.");
		}
	}

	function urlConvert(text) {
		text = text.replace(/=/g,"~");
		text = text.replace(/&/g,"|");
		text = text.replace("?","*");
		return text;
	}

	deals404=0;
	theDate="";
	function p(rc,op,prod,fr,incs,requestOnly,type) { // draw print range for search results
		tmp = new Array();
		tmp = incs.split("|");
		obj = document.getElementById("rc" + rc);
		html = "<table cellpadding=0 width=100% id=rC border=0><tr height=30>";
		html += "<td class=fRC style='background:white'>$" + fr + "</td>";
		for (var i=0; i!=tmp.length; i++) {
			tmp2 = new Array();
			tmp2 = tmp[i].split("^");
			styling="";
			if (tmp2[2]==1) {
				styling = " id=hotdeal style='background-image:url(/ntstandby/flame4.gif)'";
//				tmp2[1]=1000;
			}
			if (parseInt(tmp2[1])>0) {
				if (window.location.href.indexOf("search")>-1 || deals404==1) {
					link="<a href='index.cgi?act=info&i=" + op + "&h=" + prod + "'>$" + tmp2[1] + "</a>";
				}
				else {
					if (requestOnly==0) {
						theDate = clickDates[i] + "";
						theMonth = parseInt(theDate.substr(4,2)-1);
						if (theMonth<10) { theMonth = "0" + theMonth }
						theDate = theDate.substr(0,4) + theMonth + theDate.substr(6,2);
						link="<a href='index.cgi?act=book&i=" + op + "&h=" + prod + "&bi=-1&d=" + theDate + "'>$" + tmp2[1] + "</a>";
					}
					else {
						link="<a href='index.cgi?act=future&i=" + prod + "&t=" + type + "&d=" + clickDates[i] + "'>$" + tmp2[1] + "</a>";
					}
				}
				if (requestOnly==0) { link = "<b>" + link + "</b>" }
				html += "<td onMouseover=\"iP('" + tmp2[0] + "',1,0,"+parseInt(tmp2[2])+"); \" onMouseout='d()'" + styling + ">" + link + "</td>";
			}
			else {
				styling="";
				link=tmp2[1];
				if (requestOnly==0) { link = "<b>" + link + "</b>" }
				html += "<td onMouseover=\"iP('" + tmp2[0] + "',1,0,"+parseInt(tmp2[2])+")\" onMouseout='d()'" + styling + ">" + link + "</td>";
			}
		}
		html += "</tr></table>";
		obj.innerHTML = html;
	}
