﻿var viewPoint={
	calc:function(){
		var ie = document.all && !window.opera
		var domclientWidth = document.documentElement && parseInt(document.documentElement.clientWidth) || 100000 //Preliminary doc width in non IE browsers
		this.standardbody=(document.compatMode=="CSS1Compat")? document.documentElement : document.body //create reference to common "body" across doctypes
		this.scroll_top=(ie)? this.standardbody.scrollTop : window.pageYOffset
		this.scroll_left=(ie)? this.standardbody.scrollLeft : window.pageXOffset
		this.docwidth=(ie)? this.standardbody.clientWidth : (/Safari/i.test(navigator.userAgent))? window.innerWidth : Math.min(domclientWidth, window.innerWidth-16)
		this.docheight=(ie)? this.standardbody.clientHeight: window.innerHeight
	}
}

function _body_onload(){
	veilOff();
}

function _body_onunload(){
	veilOn();
}

function veilOn(){
	var opacity = document.getElementById('divOpacity');
	var loader =  document.getElementById('divLoader');
	var v = viewPoint;

	v.calc();
	docheightcomplete = (v.standardbody.offsetHeight > v.standardbody.scrollHeight) ? v.standardbody.offsetHeight : v.standardbody.scrollHeight;
	opacity.style.width = v.docwidth + "px";
	opacity.style.height = this.docheightcomplete + "px";
	opacity.style.display = "block";
	loader.style.display = "block";

}
function veilOff(){
	var opacity = document.getElementById('divOpacity');
	var loader =  document.getElementById('divLoader');
	opacity.style.display = "none";
	loader.style.display = "none";
}
function veilOffAlert(){
	setTimeout('veilOff()',100);
}
