﻿AjaxProtect = function(imgPath, indexZ)
{
	this.protect = utilObj.createEl("DIV");
	this.protect.style.position = "absolute";
	this.protect.style.width = "100%";
	this.protect.style.top = "0px";
	this.protect.style.left = "0px";
	this.protect.className = "protect";
	this.protect.style.display = "none";
	
	this.img = utilObj.createEl("IMG");
	this.img.src = imgPath;
	this.img.style.margin = "auto"
	this.img.style.position = "absolute";
	
	if(indexZ == undefined)
	{
		this.protect.style.zIndex = 10001;
		this.img.style.zIndex = 10002;
	}
	else
	{
		this.protect.style.zIndex = indexZ;
		this.img.style.zIndex = indexZ + 1;
	}
};

AjaxProtect.prototype = 
{
	init : function()
	{
		document.body.appendChild(this.protect);
		document.body.appendChild(this.img);
		this.hide();
	},
	
	show : function()
	{
		this.protect.style.top = utilObj.getDocumentScroll().scrollTop + "px";
		this.protect.style.height = utilObj.getDocument().clientHeight + "px";
		this.protect.style.display = "";
		this.img.style.display = "";
		this.img.style.top = utilObj.getElPosCenterWebPage(this.img).Y + "px";
		this.img.style.left =  utilObj.getElPosCenterWebPage(this.img).X + "px";
	}, 
	
	hide : function()
	{
		this.protect.style.display = "none";
		this.img.style.display = "none";
	}
};