﻿jQuery(document).ready(function() {
	jQuery(".SafeLinkUrl").each(function() {
		var $this = jQuery(this);
		if ($this.attr("disabled")) return this;
		$this.bind("click", clearScreenAndWait);

		function safeLinkEventHandler() {
			var $this = jQuery(this);
			var jsOnClick = $this.attr("jsOnClick");
			if (jsOnClick && jsOnClick !== "") {
				jsOnClick = jsOnClick.replace(/&#34;/g, "\"");
				jsOnClick = jsOnClick.replace(/&#39;/g, "'");
				if (eval(jsOnClick) === false) return false;
			}

			//Foll chunk of code to avoid javascript errors at runtime.
			if ("undefined" != typeof (ValidatorOnSubmit))
				if (Page_ClientValidate() == false)
				return false;

			if (this.disabled == true) return false;
			var cloneEle = jQuery(this).clone().attr("disabled", "disabled");
			jQuery(this).hide().after(cloneEle);
			return true;
		}
	});

	jQuery(document.body).bind("keypress", function(e) {
		if (e.which == 13) {
			jQuery(".defaultSubmit").click();
		}
	});
});

jQuery(document).ready(function(){
	var htmlContent = '<center><DIV id="__lblPleaseWait" ms_positioning="FlowLayout" style="display:none">';
	htmlContent += '<TABLE height="300" cellSpacing="0" cellPadding="0" width="300" border="0" ms_1d_layout="TRUE">';
	htmlContent += '<TR><TD><TABLE height="554" cellSpacing="0" cellPadding="0" width="554" border="0" bgcolor="#FFFFFF">';
	htmlContent += '<TR><TD ><center><OBJECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="https://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"';
	htmlContent += 'WIDTH="554" HEIGHT="554" id="myMovieName" VIEWASTEXT><PARAM NAME="movie" VALUE="https://www.bluesombrero.com/images/bluesombrero_loading.swf">';
	htmlContent += '<PARAM NAME="quality" VALUE="high"><PARAM NAME="bgcolor" VALUE="#FFFFFF"><EMBED src="https://www.bluesombrero.com/images/bluesombrero_loading.swf" quality="high" bgcolor="#FFFFFF" WIDTH="554" HEIGHT="554" ';
	htmlContent += 'NAME="myMovieName" ALIGN="" TYPE="application/x-shockwave-flash" PLUGINSPAGE="https://www.macromedia.com/go/getflashplayer">';
	htmlContent += '</EMBED></OBJECT><br/></TD></TR></TABLE></TD></TR></TABLE></DIV></center>';
	jQuery("form").after(htmlContent);
});

//Function to disable all links (hrefs) on the containing page after click.
function disableLink(linkId)
{
	window.setTimeout("disableAfterTimeout('" + linkId + "')",0);
	return;
}

//Function called by disableLink. Called immediately after postback is fired.
//Created: Mon 31 Jan 2005 
//Author: Rahul
function disableAfterTimeout(linkId)
{
	var linkNodes = document.getElementsByTagName("a");
	for( i = 0; i < linkNodes.length; i++)
	{
		linkNodes.item(i).disabled = true;
		linkNodes.item(i).href = '#';
	}
	return;
}

//Function to clear the screen and display 'Please Wait...'
//Created: Tue 1 Feb 2005 
//Author: Rahul
function clearScreenAndWait()
{
	var $this = jQuery(this);
	var jsOnClick = $this.attr("jsOnClick");
	if (jsOnClick && jsOnClick !== ""){
		jsOnClick = jsOnClick.replace(/&#34;/g, "\"");
		jsOnClick = jsOnClick.replace(/&#39;/g, "'");
		if(eval(jsOnClick) === false) return false;
	}

	//Foll chunk of code to avoid javascript errors at runtime.
	if("undefined" != typeof(ValidatorOnSubmit))
		if(Page_ClientValidate()==false)
			return false;

	var linkId = this.id;

	if(document.all[linkId].disabled == true) return;
	jQuery("form").hide();
	document.all['__lblPleaseWait'].style.display="inline"
	return true;
}

