/** Requires: lightBoxCommon.js **/
/** Requires: lightBox.js **/

/** PUBLIC FUNCTIONS **/
var C_WAIT_DELAY_SEARCH = 2500;
var C_WAIT_DELAY_FILTER = 2500;
var C_WAIT_DELAY_RS = 2500;

function htlInitWaitMessage(timeout) {
	setTimeout('htlDoWaitMessage();', timeout);
}
/** PRIVATE FUNCTIONS **/
function htlCreateWaitDiv() {
	var waitDiv = document.createElement("div");
	waitDiv.id="dynWaitMsgDiv";
	waitDiv.style.backgroundColor="#ffffff";
	waitDiv.style.height="170px";
	waitDiv.style.width="265px";
	waitDiv.style.zIndex=96;
	waitDiv.style.fontFamily="arial";
	waitDiv.style.fontSize="16px";
	waitDiv.style.fontWeight="bold";
	waitDiv.style.color="#000000";
	waitDiv.style.textAlign="center";
	waitDiv.style.border="4px solid #525252";
	waitDiv.style.position="absolute";
	waitDiv.style.visibility="hidden";
	waitDiv.style.display="none";
	waitDiv.innerHTML = "<Br><img src=\"content/graphics/ajax-loader.gif\" width=\"32\" height=\"32\" alt=\"Loading\" />" + 
						"<br /><br />Please wait...<br><br>Your updated hotel search<br>will be ready in a few seconds.";
	document.body.appendChild(waitDiv);
}
function htlDoWaitMessage() {
	tgHtmlLightBoxOpt("dynWaitMsgDiv", 265, 170, false);
}
function htlInitWaitCode(pg) {
	htlCreateWaitDiv();
	switch (pg) {	//set the onclick for any links we need
		case "LIST":
			var tLinks = document.getElementById("maincontent").getElementsByTagName("a");
			for ( var i=0; i < tLinks.length; i++) {
				if ((tLinks[i].href.toLowerCase().indexOf("avascript:") < 0) && (tLinks[i].href!="#") && (tLinks[i].href!=window.location.href+"#")&& (tLinks[i].href!=window.location.href))
					addEventHandler (tLinks[i], "click", function() { htlInitWaitMessage(C_WAIT_DELAY_FILTER);});
			}
			break;	
		case "RATE_SEL":
			if (document.getElementById("prevButton"))
				addEventHandler (document.getElementById("prevButton"), "click", function() { htlInitWaitMessage(C_WAIT_DELAY_SEARCH);});
			break;
	}
}