var nTimerId = 0;

// This routine displays a "please wait" message to the end user when the 3 second 
// timer has expired and still waiting for the response from the server.  
// This routine will display a blank page with only the "please wait" message. 
function pleaseWait()
{
	if (PWdsapp_bIsIE) {
		// Hide all controls.  In IE, select controls and buttons show through the "please wait" div.
		var selectcontrols = document.getElementsByTagName("SELECT");
		var inputcontrols = document.getElementsByTagName("INPUT");

		for (i=0; i < selectcontrols.length; i++) {
			selectcontrols[i].style.visibility = 'hidden';
		}

		// Disable all input box controls.
		for (i=0; i < inputcontrols.length; i++) {
			if (inputcontrols[i].type != "hidden") {
				inputcontrols[i].style.visibility = 'hidden';
			}
		}
	}

	// Replaces the current page with the blank "please wait" Cover Page so that
	// all the links on this page will be invisible.
	var cover = document.getElementById("cover");
	if(cover!=null)
	{
		cover.style.backgroundColor = GetRuleStyle(".CoverBkColor", "backgroundColor");
		cover.style.zIndex=100;
	
		// Draw the Please Wait page.
		var sTxt;
		sTxt = "<DIV id='CoverTop' align=center STYLE='position:relative; height:0; width:0; '>";
		sTxt += "<TABLE  border=0 cellpadding='0' cellspacing='0'>";
		sTxt +=	"<TR height=100px >";
		sTxt +=	"<TD width=100px></TD>";
		sTxt += "<TD>";
		sTxt += "<TABLE width='100%' border=0 class='PleaseWait' cellpadding='0' cellspacing='0'>";
		sTxt +=	"<tr height=15px>";
		sTxt +=	"<td class='Tab2'></td>";
		sTxt +=	"</tr>";
		sTxt += "</TABLE>";
		sTxt += "<TABLE border=0 class='PleaseWait' cellpadding='0' cellspacing='0'>";
		sTxt +=	"<TR height=100px >";
		sTxt +=	"<TD width=100px></TD>";
		sTxt += "<TD>";
		sTxt += "<FONT class='B2020H3'>";
		sTxt += resPleaseWait;
		sTxt += "</FONT>";
		sTxt += "</TD>";
		sTxt +=	"<TD width=100px></TD>";
		sTxt +=	"</TR>";
		sTxt += "</TABLE>";
		sTxt +=	"</TD>";
		sTxt +=	"<TD width=100px></TD>";
		sTxt += "</TR>";
		sTxt += "</TABLE>";
		sTxt += "</DIV>";

		cover.innerHTML = sTxt;
		cover.style.visibility = "visible";
		nTimerId = 0;
		bFullScreen = false;
		resizeCover();
	}	
}

function HidePleaseWait()
{
    if (document.getElementById("CoverTop")) {
        document.getElementById("cover").style.visibility = "hidden";
	    document.getElementById("CoverTop").style.visibility = "hidden";
	}
	if (typeof(onLocalPageUnload) == "function") {
		onLocalPageUnload();
	}
}

function executeWait(object)
{
	if (nTimerId != 0)
		clearTimeout(nTimerId);
	nTimerId = setTimeout("pleaseWait();", 3000);
	object.submit();
}
