/// Wait Element 

function MoveWaitElement()
{
	var scrollYT, scrollXT;
	if (!waitElement) CreateWaitElement();
	
	if (typeof(window.pageYOffset) == "number")
	{ 
		scrollYT = window.pageYOffset; 
		scrollXT = window.pageXOffset; 
	} 
	else if (document.body && document.documentElement && document.documentElement.scrollTop)
	{ 
		scrollYT = document.documentElement.scrollTop; 
		scrollXT = document.body.scrollLeft;
	}
	else if (document.body && typeof(document.body.scrollTop) == "number")
	{
		scrollYT = document.body.scrollTop; 
		scrollXT = document.body.scrollLeft; 
	} 
	if (scrollX != scrollXT || scrollY != scrollYT)
	{
		scrollX = scrollXT;
		scrollY = scrollYT;
		var width = document.body.clientWidth;
		waitElement.style.top = scrollYT + "px";
		waitElement.style.right = -scrollXT +  "px";
	}
}

function CreateWaitElement() 
{
	var elem = document.getElementById('__AjaxCall_Wait');
	if (!elem) {
		elem = document.createElement("div");
		elem.id = '__AjaxCall_Wait';
		elem.className = "loader";
		elem.innerHTML = 'Loading';
		elem.style.visibility = 'hidden';
		
		document.body.appendChild(elem);
		
	}
	waitElement = elem;
}
// end wait element		

function Anthem_PreCallBack()
{
	if(waitElement == null) CreateWaitElement();
	MoveWaitElement();
	waitElement.style.visibility = '';
}

function Anthem_PostCallBack() 
{
	waitElement.style.visibility = 'hidden';
	try
	{
		SetFocusUserLoginName();
		SetFocusUserPassword();
	}
	catch(e)
	{
		//we have no such the functions on the page
	}
	
}

if (window.addEventListener) 
{
	window.addEventListener('scroll', MoveWaitElement, false);
	window.addEventListener('resize', MoveWaitElement, false);
}
else if (window.attachEvent) {
	window.attachEvent('onscroll', MoveWaitElement);
	window.attachEvent('onresize', MoveWaitElement);
}

var waitElement;
var scrollX, scrollY = -1;

function ContentLoad(loaderName, contentName)
{
	var cLoader = document.getElementById(loaderName);
	var cForm   = document.getElementById(contentName);
	
	cLoader.style.display = "none";
	cForm.style.display   = "";
}
