var lName = "waiterLayer";

function CWaiter(text)
{	
	this.stat = 0;
	this.textRus = "ÏÎÆÀËÓÉÑÒÀ, ÏÎÄÎÆÄÈÒÅ ÏÎÊÀ ÇÀÃÐÓÇÈÒÑß ÑÒÐÀÍÈÖÀ";
	this.textEng = "PLEASE, WAIT WHILE PAGE IS LOADING";
	this.text = text;
	
	this.Show = ShowWaiter;
	this.Hide = HideWaiter;	
	this.Create = CreateWaiter;
	this.setMessage = setMessageWaiter;
	
	return this;
}

function CreateWaiter()
{
	var oLayer = document.createElement("DIV");
	var sFeatures = "";
	oLayer.setAttribute('id',lName);
	oLayer.style.position = "absolute";
	oLayer.style.overflow = "hidden";
	oLayer.style.zIndex = 100;
	oLayer.style.visibility = "hidden";
	sFeatures = '<table cellpadding="0" cellspacing="0" border="0" width="658" height="393"><tr><td valign="middle" align="center" CLASS="waitTxt">';
	sFeatures += this.textRus;
	sFeatures += '<br /><br /><TABLE WIDTH="400" BORDER="0" CELLSPACING="0" CELLPADDING="0" HEIGHT="50"><TR><TD bgcolor="#000000"><TABLE WIDTH="400" BORDER="0" CELLSPACING="1" CELLPADDING="0" HEIGHT="50"><TR><TD valign="middle" align="center" bgcolor="#ffffff" class="message" id="waiterMessage">';

	
	sFeatures += this.text;
	
	sFeatures += '</TD></TR></TABLE></TD></TR></TABLE><br /><br />';
	sFeatures += this.textEng;
	sFeatures += '</td></tr></table>';
	oLayer.innerHTML = sFeatures;
	document.body.appendChild(oLayer);
	this.stat = 1;
	this.Show();
}

function ShowWaiter()
{
	if(document.all && this.stat > 0)
	{
		document.all[lName].style.left = document.all.wBrowser.offsetLeft + 1;
		document.all[lName].style.top = document.all.wBrowser.offsetTop + 1;
		top.document.all.browserLayer.style.visibility = "hidden";
		document.all[lName].style.visibility = "visible";		
	}	
}

function HideWaiter()
{
	if(document.all && this.stat > 0)
	{
		document.all[lName].style.visibility = "hidden";
		top.document.all.browserLayer.style.visibility = "visible";
		this.setMessage('ÇÀÃÐÓÇÊÀ / LOADING');
	}
}

function setMessageWaiter(text)
{
	if(document.all && this.stat > 0)
	{
		this.text = text;
		document.all.waiterMessage.innerHTML = this.text;
	}
}
