function ConstructWaitInfo() {
		ConstructWaitInfoDontRemove()
		window.setTimeout("RemoveWaitInfo()",15000);
}
function RemoveCache(){
	document.body.removeChild(document.getElementById('cache'));
	removeEventOnObject(window.document, 'onkeypress', KeyPress);
	removeEventOnObject(window.document, 'onkeydown', KeyDown);
	removeEventOnObject(window, 'onscroll', ScrollCache);
	removeEventOnObject(window, 'onresize', ReSizeCache);
	document.body.style.cursor = 'default';
	window.document.body.style.overflow='';
	ChangeAllElementVisibility("select",'visible',0,0,document.body.offsetWidth,document.body.offsetHeight);
}
function RemoveCacheIntersticiel(){
	document.body.removeChild(document.getElementById('cacheIntersticiel'));
	removeEventOnObject(window.document, 'onkeypress', KeyPress);
	removeEventOnObject(window.document, 'onkeydown', KeyDown);
	removeEventOnObject(window, 'onscroll', ScrollCache);
	removeEventOnObject(window, 'onresize', ReSizeCache);
	document.body.style.cursor = 'default';
	window.document.body.style.overflow='';
	ChangeAllElementVisibility("select",'visible',0,0,document.body.offsetWidth,document.body.offsetHeight);
}
function RemoveWaitInfo(){
	RemoveCache();
	window.clearTimeout(window.time1);
	window.clearTimeout(window.time2);
	window.clearTimeout(window.time3);
	window.clearInterval(window.interval);
}
function Cache(id){
	var oCache = document.createElement("div");
	oCache.id = id;
	oCache.style.height = (document.body.clientHeight>document.body.scrollHeight?document.body.clientHeight:document.body.scrollHeight);
	oCache.style.width = document.body.offsetWidth;
	oCache.style.left = 0;
	oCache.style.top = 0;
	oCache.style.position = "absolute";
	oCache.style.zIndex	= 1000;
	window.document.body.style.overflow='hidden';
	document.body.appendChild(oCache);
	for (var i = 0; i < document.getElementsByTagName("select").length; i++)
		document.getElementsByTagName("select")[i].style.visibility="hidden";
	addEventOnObject(oCache, 'onselectstart', function(){return false;});
	addEventOnObject(window, 'onresize', ReSizeCache);
	addEventOnObject(window, 'onscroll', ScrollCache);
	addEventOnObject(window.document, 'onkeydown', KeyDown);
	addEventOnObject(window.document, 'onkeypress', KeyPress);
}
function CacheFiltre(opacity, p_color,p_id) {
	var oCacheFiltre = document.createElement("div");
	oCacheFiltre.style.top 		= 0;
	oCacheFiltre.style.left 	= 0;
	oCacheFiltre.style.width 	= "100%";
	oCacheFiltre.style.height 	= "100%";
	oCacheFiltre.style.backgroundColor = p_color;
	if (window.addEventListener)
		oCacheFiltre.style.opacity = opacity/100;
	else
		oCacheFiltre.style.filter = "progid:DXImageTransform.Microsoft.Alpha(opacity="+opacity+")";
	document.getElementById(p_id).appendChild(oCacheFiltre);
}
function ConstructWaitInfoDontRemove() {
		Cache('cache');
		CacheFiltre("50", "transparent",'cache');
		window.setTimeout("ShowWaitInfo()",500);
		document.body.style.cursor = 'wait';
}
function ConstructIntersticielDontRemove() {
		Cache('cacheIntersticiel');
		CacheFiltre("50", "transparent",'cacheIntersticiel');
		window.setTimeout("ShowIntersticiel(false)",500);
		document.body.style.cursor = 'wait';
}
function ConstructIntersticielDontRemoveCB() {
		Cache('cacheIntersticiel');
		CacheFiltre("50", "transparent",'cacheIntersticiel');
		window.setTimeout("ShowIntersticiel(true)",0);
		document.body.style.cursor = 'wait';
		window.setTimeout("RemoveCacheIntersticiel()",5000);
}
function ReSizeCache(){
	var oCache = document.getElementById('cache');	
	oCache.style.height = (document.body.clientHeight>document.body.scrollHeight?document.body.clientHeight:document.body.scrollHeight);
	oCache.style.width = (document.body.clientWidth>document.body.scrollWidth?document.body.clientWidth:document.body.scrollWidth);
	ScrollCache();
}
function ShowWaitInfo(){
	WaitInfo();
}
function ShowIntersticiel(p_cb){
	var oIntersticiel = Box('intersticiel','cacheIntersticiel');
	if(p_cb==false){
		oIntersticiel.innerHTML	="<img src='../../img/intersticiel/tarif.jpg' width='695px' height='265px' /><br />";
	}else{
		oIntersticiel.innerHTML	="<img src='../../img/paiement/intersticiel_cb.jpg' width='695px' height='265px' /><br />";
	}
	oIntersticiel.innerHTML	+= "<img src='../../img/intersticiel/wait.gif' width='155px' height='25px' />";
	document.body.style.cursor 	= 'wait';
	addEventOnObject(oIntersticiel, 'onblur',function(){setFocus(document.getElementById('waitInfo'));});
	ScrollCache();
	setFocus(oIntersticiel);
}
function WaitInfo(){
	var oWaitInfo = Box('waitInfo','cache');
	oWaitInfo.innerHTML	="<img src='../../img/ajax.gif' width='16px' height='16px' />";
	oWaitInfo.innerHTML	+= "&nbsp;Veuillez patienter";
	document.body.style.cursor 	= 'wait';
	addEventOnObject(oWaitInfo, 'onblur',function(){setFocus(document.getElementById('waitInfo'));});
	ScrollCache();
	setFocus(oWaitInfo);
}
function ChangeContentWaitInfo(text){
	if (document.body.all)
		document.getElementById('waitInfoWithTimeout').innerText = text;
	else
		document.getElementById('waitInfoWithTimeout').textContent = text;
}
function ScrollCache(){
	var oWindow;
	oWindow = document.getElementById('waitInfo');
	if (oWindow!=null) {
		oWindow.style.left = document.body.scrollLeft + (document.body.offsetWidth - oWindow.scrollWidth) / 2;
		oWindow.style.top = document.body.scrollTop + (document.body.clientHeight - oWindow.scrollHeight) / 2;
	}
}
function Box(id,p_idcache){
	var oBox 	= document.createElement("div");
	var oCache	= document.getElementById(p_idcache);	
	oBox.id = id;
	oBox.style.position='absolute';
	oBox.style.top="7%";
	oBox.style.zIndex	= 1001;
	oCache.appendChild(oBox);
	ScrollCache();	
	return oBox;
}
function submitAndWait(){
	window.setTimeout("ConstructWaitInfo()",2000);
}
function submitIntersticiel(){
	window.setTimeout("ConstructIntersticielDontRemove()",2000);
}
function submitIntersticielCB(){
	ConstructIntersticielDontRemoveCB();
}
function KeyDown(p_event) {
	return false;
}
function KeyPress(p_event) {
	if (p_event.preventDefault)
        p_event.preventDefault();
}