var anima = new Image();
anima.src = '/images/animation.gif';
function overLayer(){
	this.show =function(){
		try {
			if (document.getElementById("ajax_HideSelect") == null) {
				$("body").append("<iframe id='ajax_HideSelect'></iframe><div id='ajax_overlay'></div>");
			}
			this.showOverlay();
			$("body").append("<div id='ajax_load'><img src='"+anima.src+"' /></div>");
			this.load_position();
		}catch(e){}
	}
	this.showTopOverLayer = function(flashfile, width, height){
	    try {
			if (document.getElementById("ajax_HideSelect") == null) {
				$("body").append("<iframe id='ajax_HideSelect'></iframe><div id='ajax_overlay'></div>");
			}
			this.showOverlay();
			var flashcode = '<object id="overswf" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,28,0" width="'+width+'" height="'+height+'"><param name="movie" value="'+flashfile+'" /><param name="quality" value="high" /><embed src="'+flashfile+'" quality="high" pluginspage="http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" width="'+width+'" height="'+height+'"></embed></object>';
			$("body").append("<div id='ajax_load'>"+flashcode+"</div>");
			this.load_position();
	   }catch(e){}
	}
	this.showOverlay = function(){
		if (window.innerHeight && window.scrollMaxY || window.innerWidth && window.scrollMaxX) {
			yScroll = window.innerHeight + window.scrollMaxY;
			xScroll = window.innerWidth + window.scrollMaxX;
			var deff = document.documentElement;
			var wff = (deff&&deff.clientWidth) || document.body.clientWidth || window.innerWidth || self.innerWidth;
			var hff = (deff&&deff.clientHeight) || document.body.clientHeight || window.innerHeight || self.innerHeight;
			xScroll -= (window.innerWidth - wff);
			yScroll -= (window.innerHeight - hff);
		} else if (document.body.scrollHeight > document.body.offsetHeight || document.body.scrollWidth > document.body.offsetWidth){
			yScroll = document.body.scrollHeight;
			xScroll = document.body.scrollWidth;
		} else {
			yScroll = document.body.offsetHeight;
			xScroll = document.body.offsetWidth;
		}
		var pagesize = this.getPageSize();
		if(yScroll < pagesize[1]){
			yScroll = pagesize[1];
		}
		if(xScroll < pagesize[0]){
			xScroll = pagesize[0];
		}
		$("#ajax_overlay").css({"height":yScroll +"px", "width":xScroll +"px"});
		$("#ajax_HideSelect").css({"height":yScroll +"px","width":xScroll +"px"});
	}
	this.hideOverlay = function(){
	    $("#overswf").remove();
		$("#ajax_HideSelect,#ajax_overlay").remove();
		$("#ajax_load").remove();
	}
	this.load_position = function() {
		var pagesize = this.getPageSize();
		var arrayPageScroll = this.getPageScrollTop();
		var t_width = $("#ajax_load").width();
		var t_height = $("#ajax_load").height();
		$("#ajax_load")
		.css({left: (arrayPageScroll[0] + (pagesize[0] - t_width)/2)+"px", top: (arrayPageScroll[1] + ((pagesize[1]-t_height)/2))+"px" })
		.css({display:"block"});
	}
	this.getPageSize = function(){
		var de = document.documentElement;
		var w = window.innerWidth || self.innerWidth || (de&&de.clientWidth) || document.body.clientWidth;
		var h = window.innerHeight || self.innerHeight || (de&&de.clientHeight) || document.body.clientHeight
		arrayPageSize = new Array(w,h)
		return arrayPageSize;
	}
	this.getPageScrollTop = function(){
		var yScrolltop;
		var xScrollleft;
		if (self.pageYOffset || self.pageXOffset) {
			yScrolltop = self.pageYOffset;
			xScrollleft = self.pageXOffset;
		} else if (document.documentElement && document.documentElement.scrollTop || document.documentElement.scrollLeft ){	 // Explorer 6 Strict
			yScrolltop = document.documentElement.scrollTop;
			xScrollleft = document.documentElement.scrollLeft;
		} else if (document.body) {// all other Explorers
			yScrolltop = document.body.scrollTop;
			xScrollleft = document.body.scrollLeft;
		}
		arrayPageScroll = new Array(xScrollleft,yScrolltop)
		return arrayPageScroll;
	}
}
var overLayer = new overLayer();