<!--
/**
*
* Released under the GNU General Public License
* copyright http://xlinfo.fr
* 
*/

//redimensionnement des images

function zoom(image){
	if(image.getAttribute("src") != "images/"){ //en cas d'image absente
	//image.removeAttribute('height')
	//image.parentNode.className="image"
	//image.parentNode.childNodes[1].style.display="none"
	document.getElementById("divimage").style.display="block"
	document.getElementById("image").src=image.getAttribute('src')
	lightbox("divimage")
	}
}
function dezoom(){
		razlightbox("divimage")
		}	

//mise à jour du premier champ d'option (prix)

function maj_option(option,id){
	if(option.indexOf(":") != -1){
	options=option.split(':')
	document.getElementById("prix"+id).innerHTML="<br />"+options[1]
	}
}

function resetforms(){
	for(i=0;i<document.forms.length;i++)
	document.forms[i].reset()
}

//fonctions mail...
function XMLHttpPOST(url){
	var xmlHttpReq = null;
	if(window.XMLHttpRequest){
		xmlHttpReq=new XMLHttpRequest();
	}
	else if(window.ActiveXObject){
		xmlHttpReq=new ActiveXObject("Microsoft.XMLHTTP");
	}
	xmlHttpReq.open('POST', url, true);
	xmlHttpReq.setRequestHeader('Content-Type','application/x-www-form-urlencoded'); 
	xmlHttpReq.onreadystatechange=function(){
	if(xmlHttpReq.readyState==4){
		updatepage(xmlHttpReq.responseText)
		}
	}
	xmlHttpReq.send(postquerystring());
}

function updatepage(str){
	alert(str);
	document.getElementById("valider").style.cursor='default'
		if(str.indexOf("Merci",0) > -1){
			document.getElementById("valider").disabled=true
			document.getElementById("annuler").value='Fermer'
		}
}

function postquerystring(){
	nom=document.getElementById("nom").value;
	email=document.getElementById("email").value;
	objet=document.getElementById("objet").value;
	message=document.getElementById("message").value;
	qstr= 'nom='+ escape(nom) + '&email=' + escape(email) + '&objet=' + escape(objet) + '&message=' + escape(message);
	return qstr;
}

function lightbox(div){
	document.getElementById(div).style.display='block'
	document.getElementById(div).style.left=(document.body.offsetWidth - document.getElementById(div).offsetWidth)/2 +"px"
	document.getElementById(div).style.top=(document.body.offsetHeight - document.getElementById(div).offsetHeight)/2 +"px"
	
	if(document.all){
	for (i=0;i<document.getElementsByTagName("div").length-1;i++){
		document.getElementsByTagName("div")[i].style.filter = "alpha(opacity=30)"
		 }
	document.getElementById(div).style.filter = "alpha(opacity=100)"
	}
	else {
		for (i=0;i<document.body.childNodes.length;i++){
			if(document.body.childNodes[i].nodeName == "DIV"){
				document.body.childNodes[i].style.opacity = "0.3"
			}
		}
		document.getElementById(div).style.opacity = "1"
	}
		
}	
	
function razlightbox(div){
	document.getElementById(div).style.display='none'
	if(document.all){
	for (i=0;i<document.getElementsByTagName("div").length;i++)
		document.getElementsByTagName("div")[i].style.filter = "alpha(opacity=100)"
	}
	else
	{
	for (i=0;i<document.body.childNodes.length;i++){
			if(document.body.childNodes[i].nodeName == "DIV")
				document.body.childNodes[i].style.opacity = "1"
			}
	}
}

function contact(e){
	var ie= document.all;
	var dom= document.getElementById && !document.all;
	elt= dom ? e.target : event.srcElement;
	if (elt.className == "liencontact"){
		lightbox("contact")		
		}
}


function fermerContact(){
	razlightbox("contact")
	document.getElementById("valider").disabled=false
	document.getElementById("annuler").value='Annuler'
}


document.onmousedown=contact
//document.getElementById("image").onclick=function(){razlightbox("divimage")}
//-->

