﻿if (!document.getElementById('waiting'))
  		create_div_wait();

function create_div_wait() {
	dv = document.createElement('div');
	dv.style.backgroundColor="white";
	dv.setAttribute('id',"waiting");
	dv.setAttribute('z-index',"1000");
	dv.style.zIndex="1000";
	dv.style.display="block";
	dv.style.position="absolute";
	dv.style.top="0px";
	dv.style.left="0px";
	dv.style.width="100%";
	dv.style.height="100%";
	dv.style.textAlign ="center";
	dv.style.paddingTop="100px";
	dv.style.filter="alpha(opacity=50)";
	dv.style.opacity="0.5";
	document.body.appendChild(dv);

	dv2 = document.createElement('div');
	dv2.setAttribute('id',"waitingMessage");
	dv2.setAttribute('z-index',"1001");
	dv2.style.zIndex="1001";
	dv2.style.display="block";
	dv2.style.position="absolute";
	dv2.style.top="0px";
	dv2.style.left="0px";
	dv2.style.width="100%";
	dv2.style.height="100%";
	dv2.style.textAlign ="center";
	dv2.style.paddingTop="100px";
	document.body.appendChild(dv2);	
	dv2.innerHTML="<IMG SRC='http://"+document.domain+"/admin/images/ajax-loader.gif' BORDER='0' style='margin:10px;'>";
}

function hideWaiting() { 
	dv = document.getElementById('waiting');
   	dv.style.display="none";
	dv2 = document.getElementById('waitingMessage');
	dv2.style.display="none";
}
function showWaiting() { 
	dv.style.display="";
	dv2.style.display="";
}

if (window.onload) {
	var tst = window.onload+"";
	var deb=tst.indexOf("{")+1;
	tst = tst.substr(deb,tst.indexOf("}")-deb)+"hideWaiting();";
	window.onload = function() {eval(tst);}
} else {
	window.onload = function() {
	hideWaiting();
	}
}

