var page=function(Doc) {
	this.cover="page_disable";this.Doc=Doc||document;
	this.Width=this.Doc.body.clientWidth;this.Height=this.Doc.body.clientHeight;
	this.disable=function(){this.set_content();this.getElement().style.width=(this.Doc.body.scrollWidth) + 'px';this.cover.style.height=(this.Doc.body.scrollHeight) + 'px';this.cover.style.display='';this.hide_select(true);window.__pageControl=this;window.onresize=function(){window.__pageControl.resize();}};
	this.enable=function() {this.getElement().style.display='none';this.hide_select(false);};
	this.enableFragments = function()
	{
		if (this.fragments == null)
			return;

		var obj_list = this.fragments
		var temp_cover;
		while ((obj = obj_list.shift()))
		{
			if (typeof(obj) == "string")
				obj = document.getElementById(obj);

			temp_cover = obj.cover;

			if (temp_cover != null)
				temp_cover.parentNode.removeChild(temp_cover);

			temp_cover = obj.cover = null;
		}
		this.fragments = obj_list;
	}
	this.disableFragments = function(obj_or_list, alternateText, html)
	{
		if (typeof(obj_or_list) == "undefined")
			return;
		if (typeof(html) == "undefined" || html == "")
			html = this.getDefault_HTML(alternateText);
		var obj_list = [], obj, temp_cover;
		if (typeof(obj_or_list) == "string")
			obj_list.push(document.getElementById(obj_or_list));
		else if (Co_Tools.IsArray(obj_or_list))
			obj_list = obj_or_list;
		else
			obj_list.push(obj_or_list);

		for (var i = 0; obj = obj_list[i]; i++)
		{
			if (typeof(obj) == "string")
				obj = document.getElementById(obj);

			if (!obj.cover)
			{
				//top499left255width666height458
				bounds = Co_Tools.GetObjectBoundaries(obj);
				temp_cover = obj.cover = obj.ownerDocument.createElement("DIV");

				temp_cover.className = "fragmentCover";
				temp_cover.style.position = "absolute";
				temp_cover.style.top = bounds.top + "px";
				temp_cover.style.left = bounds.left + "px";
				temp_cover.style.width = bounds.width + "px";
				temp_cover.style.height = bounds.height + "px";
				temp_cover.innerHTML = html;

				obj.ownerDocument.body.appendChild(temp_cover);
			}
		}
		if (this.fragments == null)
			this.fragments = [];
		this.fragments.push.apply(this.fragments, [].concat(obj_list));
	}
	this.getElement=function(){if (typeof(this.cover)=='string') this.cover=this.Doc.getElementById(this.cover); if (!this.cover) this.cover=this.create_element(); return this.cover;};
	this.create_element=function(){if (this.cover) return this.cover; var A=this.Doc.createElement('DIV');this.Doc.body.appendChild(A);A.className="page_over";A.style.cssText="position:absolute;top: 0px;left: 0px;background-color:#DEE3E7;z-index:98;filter: alpha(opacity=70);-moz-opacity: 0.7; opacity: 0.7;text-align: center;vertical-align: middle;";A.style.display="none";return A;};
	this.getDefault_HTML=function(){return '<table border="0" cellpadding="0" cellspacing="0" height="100%" width="100%" id="AjaxWhileLoadingTable"><tr><td align="center" height="100%"><img src="/spider/jewishaggiescom/ajax_loader_indicator_big_000000.gif" width="32" height="32" border="0" align="middle"><br><div style="font-weight:bold;margin-top:10px;" id="LoadingText">Loading, Please wait...</div></td></tr></table>';}
	this.set_content=function(html){if (this.getElement().innerHTML!="") return; if (html) this.getElement().innerHTML=html; else this.getElement().innerHTML=this.defaultHTML;};
	this.clear_content=function(){this.getElement().innerHTML="";};
	this.disable_actions=function(){this.onclick=document.onclick;this.onmousemove=document.onmousemove;this.oncontextmenu=document.oncontextmenu;this.ondblclick=document.ondblclick;this.onkeydown=document.onkeydown;document.onclick=this.block_action;document.onmousemove=this.block_action;document.oncontextmenu=this.block_action;document.ondblclick=this.block_action;document.onkeydown=this.keypress;}
	this.enable_actions=function(){document.onclick=this.onclick;document.onmousemove=this.onmousemove;document.oncontextmenu=this.oncontextmenu;document.ondblclick=this.ondblclick;document.onkeydown=this.onkeydown;}
	this.resize=function(){this.get_dimensions();this.getElement().style.width=(this.Width>this.Doc.body.scrollWidth?this.Width:this.Doc.body.scrollWidth)+'px';this.cover.style.height=(this.Height>this.Doc.body.scrollHeight?this.Height:this.Doc.body.scrollHeight)+'px';/*this.Width=this.Doc.body.clientWidth;this.Height=this.Doc.body.clientHeight;*/};
	this.block_action=function(){return false;}
	this.keypress=function(A) {if (!A) A=window.event;var ctrlKey=(A.ctrlKey||A.metaKey),shiftKey=(A.shiftKey),altKey=(A.altKey);
	var keyCode=A.keyCode||A.which;
	if ((keyCode==65||keyCode==65+32)&&ctrlKey) {if (A.preventDefault) return A.preventDefault();A.returnValue=false;A.cancelBubble=true;return false;}
	}
	this.get_dimensions=function(){
		var w=0,h=0;var win=this.Doc.parentWindow||this.Doc.defaultView;
	  if(typeof(win.innerWidth)=='number') {w=win.innerWidth;h=win.innerHeight;}
		else if(this.Doc.documentElement && (this.Doc.documentElement.clientWidth||this.Doc.documentElement.clientHeight)) {w=this.Doc.documentElement.clientWidth;h=this.Doc.documentElement.clientHeight;}
		else if(this.Doc.body&&(this.Doc.body.clientWidth||this.Doc.body.clientHeight)){w=this.Doc.body.clientWidth;h=this.Doc.body.clientHeight;}
		this.Width=w;this.Height=h;
	}
	this.hide_select=function(vSwitch) {
	  vSwitch=(vSwitch?'hidden':'visible');if (document.all) {var elm=this.Doc.getElementsByTagName('SELECT');for (var i=elm.length-1;i>=0;i--) if (!elm[i].co_popup_donothide) elm[i].style.visibility=vSwitch;}
	  var elm=this.Doc.getElementsByTagName('OBJECT');for (var i=elm.length-1;i>=0;i--) elm[i].style.visibility=vSwitch;var elm=this.Doc.getElementsByTagName('EMBED');for (var i=elm.length-1;i>=0;i--) elm[i].style.visibility=vSwitch;
	};
	this.get_dimensions();
	this.defaultHTML=this.getDefault_HTML();
}

