function GetId(id){ return document.getElementById(id); }
function GetValue(id){ return GetId(id).value; }
//function Verif(O,T){ if(GetValue(O) == '') { ajaxhtml("/ajax/formulaire.php","MESSAGE="+GetId(+"ddsklds,kl'\""); }else return true; }
function fulldisplay() { scroll = getScrollPosition(); container = document.createElement("div"); container.setAttribute("id","fulldisplay"); container.setAttribute("class","fulldisplay"); container.style.position = "absolute"; container.style.width = '100%'; container.style.height = '100%'; container.style.top = scroll[1] +'px'; container.style.left = scroll[0] + 'px'; document.body.appendChild(container); PremierPlan(container); return container; }
var infobulle=false;

function move(e) { if(infobulle) { if (navigator.appName!="Microsoft Internet Explorer") { GetId("curseur").style.left=e.pageX +15 +"px"; GetId("curseur").style.top=e.pageY + 15+"px"; } else { if(document.documentElement.clientWidth>0) { GetId("curseur").style.left=20+event.x+document.documentElement.scrollLeft+"px"; GetId("curseur").style.top=10+event.y+document.documentElement.scrollTop+"px"; } else { GetId("curseur").style.left=20+event.x+document.body.scrollLeft+"px"; GetId("curseur").style.top=10+event.y+document.body.scrollTop+"px"; } } } }

function ibshow(text) { if(infobulle==false) { GetId("curseur").style.visibility="visible"; GetId("curseur").innerHTML = text; infobulle=true; } }
function ibhidden() { if(infobulle==true) { GetId("curseur").style.visibility="hidden"; infobulle=false; } }
function getScrollPosition() { return Array((document.documentElement && document.documentElement.scrollLeft) || window.pageXOffset || self.pageXOffset || document.body.scrollLeft,(document.documentElement && document.documentElement.scrollTop) || window.pageYOffset || self.pageYOffset || document.body.scrollTop); }
function WDopen(html,container){
	WD = document.createElement("div");
	WD.setAttribute("id","WD"); WD.innerHTML = html; 
	
if(container) { container.appendChild(WD); } else { document.body.appendChild(WD); }
WDcenter(WD); }

function WDcenter(WD){ PremierPlan(WD); 
var scroll = getScrollPosition();
WD.style.position = "absolute"; 
WD.style.top = '50%';  WD.style.left = '50%';  
var position = findPos(WD);

WD.style.left = (position[0] - (WD.offsetWidth/2) + scroll[0])  + 'px';  
WD.style.top = (position[1] - (WD.offsetHeight/2) + scroll[1]) + 'px'; 

}
 
 
function WDclose(Fenetre){ document.body.removeChild(Fenetre); }
function findPos(obj){ 	var curleft = curtop = 0; 	if (obj.offsetParent) { X = obj.offsetLeft; Y = obj.offsetTop; while (obj = obj.offsetParent) { X += obj.offsetLeft; Y += obj.offsetTop; } }	return [X,Y]; }
function PremierPlan(obj) { var elements = document.getElementsByTagName('*'); var zIndex = 0; for( var i=0; i < elements.length; i++) { zIndex = Math.max(zIndex,elements[i].style.zIndex); } obj.style.zIndex = zIndex + 1; }

document.onmousemove=move;

function ajaxhtml(URL,DATA,CONTAINER,LOADING) {
	if(LOADING) LOAD = loading(LOADING);
	var xhtml; if(window.XMLHttpRequest) { xhtml = new XMLHttpRequest(); } else if(window.ActiveXObject) { xhtml = new ActiveXObject("Microsoft.XMLHTTP"); } else { WDopen("Votre navigateur ne supporte pas les objets XMLHTTPRequest..."); return; }
	xhtml.open("POST", URL, true); if(DATA) { xhtml.setRequestHeader("Content-Type", "application/x-www-form-urlencoded"); } if(DATA) { xhtml.send(DATA); }
	xhtml.onreadystatechange = function(){ if(xhtml.readyState == 4) { if(xhtml.responseText != "") { html = xhtml.responseText } else { html = "Erreur de communication."; } 
	if(CONTAINER) { WDopen(html,CONTAINER); } else {  WDopen(html); } GetId("buttonOK").focus(); if(LOADING) document.body.removeChild(LOAD); } } }


function gallery(id){ ajaxhtml("/ajax/gallery.php","ID="+id); }

function message(){ ajaxhtml("/ajax/message.php","MESSAGE="+ GetId("MESSAGE").value +"&EMAIL="+GetId("EMAIL").value +"&CIVILITE="+GetId("CIVILITE").value +"&NAME="+GetId("NAME").value +"&NICKNAME="+GetId("NICKNAME").value,false,GetId("FORM1")); }
function temoignage(){ ajaxhtml("/ajax/temoignage.php","TEMOIGNAGE="+ GetId("TEMOIGNAGE").value +"&EMAIL="+GetId("EMAIL").value +"&CIVILITE="+GetId("CIVILITE").value +"&NAME="+GetId("NAME").value +"&NICKNAME="+GetId("NICKNAME").value,false,GetId("FORM1")); }


function loading(bloc){
	POST=findPos(bloc);
	LOAD = document.createElement("div");	
	LOAD.setAttribute("class","loading2");
	LOAD.setAttribute("style","top:"+POST[1]+"px; left:"+POST[0]+"px; width:"+bloc.offsetWidth+"px; height:"+bloc.offsetHeight+"px;");	
	document.body.appendChild(LOAD);
	PremierPlan(LOAD);
	return LOAD;
 }

function PopupImage(img) {
	w=open("Gallerie Photo",'image','weigth=toolbar=no,scrollbars=no,resizable=yes, width=815, height=615');	
	w.document.write("<HTML><BODY onblur=\"window.close();\"><IMG src='"+img+"'>");
	w.document.write("</BODY></HTML>");
	w.document.close();
}

