// JavaScript Document

// V2.02clem position automatique avec la souris



addLoadEvent(initMouseMove); 
function initMouseMove(){
	 document.onmousemove = mouseMove;
}
GnXMouse=0;
GnYMouse=0;
function mouseMove(e){
	  var _x=0;
	  var _y=0;
  
  
      if(e == undefined)
        e = event;

    if( e.pageX != undefined){ // gecko, konqueror,
        _x = e.pageX;
        _y = e.pageY;
    }else if(event != undefined && event.x != undefined && event.clientX == undefined){ // ie4 ?
        _x = event.x;
        _y = event.y;
    }else if(e.clientX != undefined ){ // IE6,  IE7, IE5.5
        if(document.documentElement){
           _x = e.clientX + ( document.documentElement.scrollLeft || document.body.scrollLeft);
            _y = e.clientY + ( document.documentElement.scrollTop || document.body.scrollTop);
        }else{
            _x = e.clientX + document.body.scrollLeft;
            _y = e.clientY + document.body.scrollTop;
        }
    /*}else if(event != undefined && event.x != undefined){ // IE6,  IE7, IE5.5
        tooltip.x = event.x + ( document.documentElement.scrollLeft || document.body.scrollLeft);
        tooltip.y = event.y + ( document.documentElement.scrollTop || document.body.scrollTop);
    */
    }else{
        _x = 0;
        _y = 0;
    }
	if(_x<=0){ _x=100;}
	if(_y<=0){ _y=100;}
	
	 GnXMouse=_x; 
    GnYMouse=_y ;
}



var rand_divalert;
function alertdiv(sIcone,sMessage,onclick){		
	
	
	
	
		//position scroll
		 var Left;
  var Top;
  var DocRef;

  if( window.innerWidth){
    with( window){
      Left   = pageXOffset;
      Top    = pageYOffset;
    }
  }
  else{ // Cas Explorer a part
    if( document.documentElement && document.documentElement.clientWidth)
      DocRef = document.documentElement;
    else
      DocRef = document.body;

    with( DocRef){
      Left   = scrollLeft;
      Top    = scrollTop;
    }
  }
		
		
		
	
		var rand=Math.round(Math.random()*100000);	
	   rand_divalert=rand;
	   var sBouton="";
	   if(onclick!='noclick'){
		 	sBouton="<br /><input id=\"boutonalert"+rand+"\" type=\"button\" value=\"Ok\" class=\"boutonblanc_off\" 	style=\"width:70px;\"	onmouseover=\"this.className='boutonblanc_on';\" onmouseout=\"this.className='boutonblanc_off';\"onclick=\"O_DivScroll  = '';document.getElementById('alert"+rand+"').style.display='none';document.getElementById('divalert_noclick"+rand+"').style.display='none';document.onmousemove = mouseMove;"+onclick+"\">";	
	   }else{
		  
		    sBouton="<img src=\"img/loading2.gif\" /><br /><input id=\"boutonalert"+rand+"\" type=\"hidden\" value=\"Ok\" class=\"boutonblanc_off\" 	style=\"width:70px;\"	onmouseover=\"this.className='boutonblanc_on';\" onmouseout=\"this.className='boutonblanc_off';\"onclick=\"O_DivScroll  = '';document.getElementById('alert"+rand+"').style.display='none';document.getElementById('divalert_noclick"+rand+"').style.display='none';document.onmousemove = mouseMove;"+onclick+"\">";
	   }
		
		var sColor;
		if(sIcone=='img/erreur.gif'){
		 	sColor='#ff5500';
		}else{
			sColor='#000000';
			
		}
	 var sPopup="<table><tr><td width=\"1\"><img src=\""+sIcone+"\"></td><td nowrap=\"nowrap\" style=\"text-align:center;padding-left:10px;color:"+sColor+";\">"+sMessage+"</td></tr><tr><td colspan=\"2\">"+sBouton+"</td></tr></table>";
	 
	
	
	

	
	popup = document.createElement("div");
	grise = document.createElement("div");	
	grise.style.cursor='not-allowed';
	
	grise.id="divalert_noclick"+rand;
	popup.id= "alert"+rand;	
	
	grise.style.position='absolute';
grise.style.backgroundImage="url('blank.gif')";
//grise.style.backgroundColor='#000000';

	popup.className="popupModule";	
	popup.innerHTML=sPopup;	
	popup.style.position='absolute';
	grise.style.zIndex=10000;
	popup.style.zIndex=10001;
	

	popup.style.textAlign="center";
	popup.style.left=-20000+"px";//'50%';	

	
	popup.className="popupModule";	
	popup.innerHTML=sPopup;	
	popup.style.position='absolute';
	
		
	popup.style.top='50%';

if(document.documentElement.scrollTop>0){	
	popup.style.top=(GnYMouse-75)+"px";
if((GnYMouse-75)<=25){
	popup.style.top="25px";
	
}
	}
	popup.style.textAlign="center";
	popup.style.left="50%";	
		
	grise.style.backgroundImage="url('blank.gif')";	
	grise.style.height = (document.documentElement.clientHeight-22)+"px";
	
	grise.style.width = 200+"px";
	grise.style.height = 200+"px";

	
	grise.style.zIndex=10000;
	popup.style.zIndex=10001;
	
	nBody=document.getElementsByTagName('body')[0];
	nBody.appendChild(grise);
	nBody.appendChild(popup);
	
	popup.style.display="block";
	
	if(onclick!='noclick'){
		document.getElementById("boutonalert"+rand).focus();	
	 }
	//popup.style.marginTop="-"+Math.round(alertdiv_getDivHeight(popup)/2)+"px";
	popup.style.marginLeft="-"+Math.round(alertdiv_getDivWidth(popup)/2)+"px";
	
		//popup.style.marginTop=(Top+250)+"px";
		//popup.style.left=-20000+"px";
		 //O_DivScroll  = new DIV_Scroll(popup.id);
		
	if (document.layers) document.captureEvents(Event.MOUSEMOVE); 
	if (document.layers || document.all) document.onmousemove = divalert_mousemove; 
	if (document.addEventListener) document.addEventListener('mousemove', divalert_mousemove, true); 
	return rand;

}







function alertdivconnexion(sIcone,sMessage,onclick){		
	
	
	
	
		//position scroll
		 var Left;
  var Top;
  var DocRef;

  if( window.innerWidth){
    with( window){
      Left   = pageXOffset;
      Top    = pageYOffset;
    }
  }
  else{ // Cas Explorer a part
    if( document.documentElement && document.documentElement.clientWidth)
      DocRef = document.documentElement;
    else
      DocRef = document.body;

    with( DocRef){
      Left   = scrollLeft;
      Top    = scrollTop;
    }
  }
		
		
		
	
		var rand=Math.round(Math.random()*100000);	
	   rand_divalert=rand;
	   var sBouton="";
	   if(onclick!='noclick'){
		 	sBouton="<br /><input id=\"boutonalert"+rand+"\" type=\"button\" value=\"Ok\" class=\"boutonblanc_off\" 	style=\"width:70px;\"	onmouseover=\"this.className='boutonblanc_on';\" onmouseout=\"this.className='boutonblanc_off';\"onclick=\"O_DivScroll  = '';document.getElementById('alert"+rand+"').style.display='none';document.getElementById('divalert_noclick"+rand+"').style.display='none';document.onmousemove = mouseMove;"+onclick+"\">";	
	   }else{
		  
		    sBouton="<img src=\"img/loading2.gif\" /><br /><input id=\"boutonalert"+rand+"\" type=\"hidden\" value=\"Ok\" class=\"boutonblanc_off\" 	style=\"width:70px;\"	onmouseover=\"this.className='boutonblanc_on';\" onmouseout=\"this.className='boutonblanc_off';\"onclick=\"O_DivScroll  = '';document.getElementById('alert"+rand+"').style.display='none';document.getElementById('divalert_noclick"+rand+"').style.display='none';document.onmousemove = mouseMove;"+onclick+"\">";
	   }
		
		var sColor;
		if(sIcone=='img/erreur.gif'){
		 	sColor='#ff5500';
		}else{
			sColor='#000000';
			
		}
	 var sPopup="<table><tr><td colspan=\"2\" align=\"right\" style=\";padding-right:10px;font-weight:bold;font-size:11px;\" >Vous utilisez actuellement le navigateur Internet Explorer</td></tr><tr><td width=\"70\" valign=\"top\"><br /><img src=\""+sIcone+"\"></td><td nowrap=\"nowrap\" style=\"text-align:left;padding-left:10px;padding-right:10px;color:"+sColor+";\">"+sMessage+"</td></tr><tr><td colspan=\"2\" align=\"right\" style=\";padding-right:10px;\" >"+sBouton+"</td></tr></table>";
	 
	
	
	

	
	popup = document.createElement("div");
	grise = document.createElement("div");	
	grise.style.cursor='not-allowed';
	
	grise.id="divalert_noclick"+rand;
	popup.id= "alert"+rand;	
	
	grise.style.position='absolute';
grise.style.backgroundImage="url('blank.gif')";
//grise.style.backgroundColor='#000000';

	popup.className="popupModule";	
	popup.innerHTML=sPopup;	
	popup.style.position='absolute';
	grise.style.zIndex=10000;
	popup.style.zIndex=10001;
	

	popup.style.textAlign="center";
	popup.style.left=-20000+"px";//'50%';	

	
	popup.className="popupModule";	
	popup.innerHTML=sPopup;	
	popup.style.position='absolute';
	
		
	popup.style.top='50%';

if(document.documentElement.scrollTop>0){	
	popup.style.top=(GnYMouse-75)+"px";
if((GnYMouse-75)<=25){
	popup.style.top="25px";
	
}
	}
	popup.style.textAlign="center";
	popup.style.left="50%";	
		
	grise.style.backgroundImage="url('blank.gif')";	
	grise.style.height = (document.documentElement.clientHeight-22)+"px";
	
	grise.style.width = 200+"px";
	grise.style.height = 200+"px";

	
	grise.style.zIndex=10000;
	popup.style.zIndex=10001;
	
	nBody=document.getElementsByTagName('body')[0];
	nBody.appendChild(grise);
	nBody.appendChild(popup);
	
	popup.style.display="block";
	
	if(onclick!='noclick'){
		document.getElementById("boutonalert"+rand).focus();	
	 }
	//popup.style.marginTop="-"+Math.round(alertdiv_getDivHeight(popup)/2)+"px";
	popup.style.marginLeft="-"+Math.round(alertdiv_getDivWidth(popup)/2)+"px";
	
		//popup.style.marginTop=(Top+250)+"px";
		//popup.style.left=-20000+"px";
		 //O_DivScroll  = new DIV_Scroll(popup.id);
		
	if (document.layers) document.captureEvents(Event.MOUSEMOVE); 
	if (document.layers || document.all) document.onmousemove = divalert_mousemove; 
	if (document.addEventListener) document.addEventListener('mousemove', divalert_mousemove, true); 
	return rand;

}











function divalert_mousemove(evt){
var element=document.getElementById("divalert_noclick"+rand_divalert);
	if (document.layers) { 
		x=evt.x; 
		y=evt.y; 
	} 
	if (document.all) { 
	x=event.clientX; 
	y=event.clientY; 
	} else { 
		if (document.getElementById) { 
			x=evt.clientX;
			y=evt.clientY; 
		}
	}
	element.style.left = (x-50)+"px" ; 
	element.style.top  =(y-25)+"px" ;
	
	
	
}

function alertdiv_getWindowHeight() { 
	var windowHeight=0; 
	if (typeof(window.innerHeight)=='number') { 
		windowHeight=window.innerHeight; 
	} else { 
		if (document.documentElement && document.documentElement.clientHeight) { 
			windowHeight = document.documentElement.clientHeight; 
		} else { 
			if (document.body&&document.body.clientHeight) { 
				windowHeight=document.body.clientHeight; 
			} 
		} 
	} 
	return windowHeight;
} 
function alertdiv_getDivHeight(element) { 

	var elementHeight=0; 
	elementHeight=element.clientHeight;	
	return elementHeight;
} 

function alertdiv_getDivWidth(element) { 
	var elementHeight=0; 
	elementHeight=element.clientWidth;	
	return elementHeight;
} 



function confirmdiv(sIcone,sMessage,onclickOk,onclickAnnuler){		
	
	var param;


		
			//position scroll
		 var Left;
  var Top;
  var DocRef;

  if( window.innerWidth){
    with( window){
      Left   = pageXOffset;
      Top    = pageYOffset;
    }
  }
  else{ // Cas Explorer a part
    if( document.documentElement && document.documentElement.clientWidth)
      DocRef = document.documentElement;
    else
      DocRef = document.body;

    with( DocRef){
      Left   = scrollLeft;
      Top    = scrollTop;
    }
  }
		
		
		var rand=Math.round(Math.random()*100000);	
	   rand_divalert=rand;
		var sBoutonOk="<br /><input id=\"boutonconfirmok"+rand+"\" type=\"button\" value=\"Ok\" class=\"boutonblanc_off\" 	style=\"width:70px;\"	onmouseover=\"this.className='boutonblanc_on';\" onmouseout=\"this.className='boutonblanc_off';\"onclick=\"O_DivScroll  = '';document.getElementById('alert"+rand+"').style.display='none';document.getElementById('divalert_noclick"+rand+"').style.display='none';document.onmousemove = mouseMove;"+onclickOk+"\">";	
		
		var sBoutonAnnuler="<input id=\"boutonconfirmannuler"+rand+"\" type=\"button\" value=\"Annuler\" class=\"boutonblanc_off\" 	style=\"width:70px;\"	onmouseover=\"this.className='boutonblanc_on';\" onmouseout=\"this.className='boutonblanc_off';\"onclick=\" O_DivScroll  = '';document.getElementById('alert"+rand+"').style.display='none';document.getElementById('divalert_noclick"+rand+"').style.display='none';document.onmousemove = mouseMove;"+onclickAnnuler+"\">";	
		
		
	 var sPopup="<div class=\"popupModule\"><table ><tr><td width=\"1\"><img src=\""+sIcone+"\"></td><td nowrap=\"nowrap\" style=\"text-align:center;padding-left:10px;\">"+sMessage+"</td></tr><tr><td colspan=\"2\" nowrap=\"nowrap\">"+sBoutonOk+"&nbsp;&nbsp;&nbsp;"+sBoutonAnnuler+"</td></tr></table></div><br /><br /><br />";
	 
	
	
	
	
	
	popup = document.createElement("div");
	grise = document.createElement("div");		
	
	grise.id="divalert_noclick"+rand;
	popup.id= "alert"+rand;	
	
	grise.style.position='absolute';
	grise.style.left='0px';
	grise.style.top='0px';

	grise.style.cursor='not-allowed';

	

	
	

	//popup.className="popupModule";	
	popup.innerHTML=sPopup;	
	popup.style.position='absolute';
	grise.style.backgroundImage="url('blank.gif')";

	popup.style.top='50%';

if(document.documentElement.scrollTop>0){	
	popup.style.top=(GnYMouse-75)+"px";
if((GnYMouse-75)<=25){
	popup.style.top="25px";
	
}
	}
	

	popup.style.textAlign="center";
	//popup.style.left=(GnXMouse)+"px";
	popup.style.left="50%";
	
	//popup.style.left='50%';		
	
	
		grise.style.backgroundImage="url('blank.gif')";	
	grise.style.height = (document.documentElement.clientHeight-22)+"px";
	grise.style.width = 200+"px";
	grise.style.height = 200+"px";
	
	grise.style.zIndex=10000;
	popup.style.zIndex=10001;
	
	nBody=document.getElementsByTagName('body')[0];
	nBody.appendChild(grise);
	nBody.appendChild(popup);
	
	
	
	document.getElementById("boutonconfirmannuler"+rand).focus();	
	//popup.style.marginTop="-"+Math.round(alertdiv_getDivHeight(popup)/2)+"px";

	popup.style.marginLeft="-"+Math.round(alertdiv_getDivWidth(popup)/2)+"px";
	
		//popup.style.marginTop=(Top+250)+"px";
			//popup.style.left=-20000+"px";
		// O_DivScroll  = new DIV_Scroll(popup.id);
		
		
	if (document.layers) document.captureEvents(Event.MOUSEMOVE); 
	if (document.layers || document.all) document.onmousemove = divalert_mousemove; 
	if (document.addEventListener) document.addEventListener('mousemove', divalert_mousemove, true); 

}
function divalert_mousemove(evt){
var element=document.getElementById("divalert_noclick"+rand_divalert);
	if (document.layers) { 
		x=evt.x; 
		y=evt.y; 
	} 
	if (document.all) { 
	x=event.clientX; 
	y=event.clientY; 
	} else { 
		if (document.getElementById) { 
			x=evt.clientX;
			y=evt.clientY; 
		}
	}
	element.style.left = (x-50)+"px" ; 
	element.style.top  =(y-25)+"px" ;

	
	
}

function alertdivat(sIcone,sMessage,onclick,x,y){		
	
		var rand=Math.round(Math.random()*100000);	
	   rand_divalert=rand;
		var sBouton="<br /><input id=\"boutonalert"+rand+"\" type=\"button\" value=\"Ok\" class=\"boutonblanc_off\" 	style=\"width:70px;\"	onmouseover=\"this.className='boutonblanc_on';\" onmouseout=\"this.className='boutonblanc_off';\"onclick=\"document.getElementById('alert"+rand+"').style.display='none';document.getElementById('divalert_noclick"+rand+"').style.display='none';document.onmousemove = mouseMove;;"+onclick+"\">";	
		
		
	 var sPopup="<table><tr><td width=\"1\"><img src=\""+sIcone+"\"></td><td nowrap=\"nowrap\" style=\"text-align:center;padding-left:10px;\">"+sMessage+"</td></tr><tr><td colspan=\"2\">"+sBouton+"</td></tr></table>";
	 
	
	
	
	
	
	popup = document.createElement("div");
	grise = document.createElement("div");		
	
	grise.id="divalert_noclick"+rand;
	popup.id= "alert"+rand;	
	
	grise.style.position='absolute';
grise.style.backgroundImage="url('blank.gif')";
	grise.style.cursor='not-allowed';
//grise.style.backgroundColor='#000000';

	popup.className="popupModule";	
	popup.innerHTML=sPopup;	
	popup.style.position='absolute';
	grise.style.zIndex=10000;
	popup.style.zIndex=10001;
	popup.style.top=y+'px';

	popup.style.textAlign="center";
	popup.style.left=x+'px';	

	
	grise.style.height = '100px';	
	grise.style.width = '100px';
	
	nBody=document.getElementsByTagName('body')[0];
	nBody.appendChild(grise);
	nBody.appendChild(popup);
	
	popup.style.display="block";
	
	document.getElementById("boutonalert"+rand).focus();	

	
	if (document.layers) document.captureEvents(Event.MOUSEMOVE); 
	if (document.layers || document.all) document.onmousemove = divalert_mousemove; 
	if (document.addEventListener) document.addEventListener('mousemove', divalert_mousemove, true); 

}