// www.pixele.fr //
/* DHTML */
function fadeIn(opacity){
	if (document.getElementById) {
		obj = document.getElementById('confirm');
		obj.style.display = "";
		if (opacity <= 100){
			setOpacity(opacity);
			opacity += 4;
			window.setTimeout("fadeIn("+opacity+")", 2);}
		}}

function fadeOut(opacity){
	if (document.getElementById) {
		obj = document.getElementById('confirm');
		if (opacity >= 0){
			setOpacity(opacity);
			opacity -= 4;
			window.setTimeout("fadeOut("+opacity+")", 2);}
		else{obj.style.display = "none";}
		}}

function setOpacity(opacity) {
	obj = document.getElementById('confirm');
	opacity = (opacity == 100)?99.999:opacity;
	obj.style.filter = "alpha(opacity="+opacity+")";
	obj.style.KHTMLOpacity = opacity/100;
	obj.style.MozOpacity = opacity/100;
	obj.style.opacity = opacity/100;
}


function sendData(data, page, action, cible){
	if(document.all){var XhrObj = new ActiveXObject("Microsoft.XMLHTTP");}else{var XhrObj = new XMLHttpRequest();}
	var content = document.getElementById(cible);
	if(data == 'null'){XhrObj.open("GET", page);}
	else{XhrObj.open("GET", page+"?"+data);}
	XhrObj.onreadystatechange = function(){if(XhrObj.readyState == 4 && XhrObj.status == 200){
		content.innerHTML = XhrObj.responseText;
		if(action == "confirm" ){
			fadeIn(0);
			}
		else if(action == "redir"){
			location.reload(); 
			}
	}}    
	XhrObj.send(null);
	}


function Cart(){
		var qte	= document.getElementById('qte').value;
		var id	= document.getElementById('id_prod').value;
		sendData("v_art="+id+"&v_qte="+qte+"&increment=1", url+"inc/_panier.php" , "confirm","cart");
	}

function Upd(id,qte){
	sendData("v_art="+id+"&v_qte="+qte, url+"inc/_panier.php" , "redir","cart");
	}

function Del(id){
	sendData("del="+id+"&display=no", url+"inc/_panier.php" , "redir" , "cart");
	}
	

function zoom(src){
	window.open(url+"inc/viewer.php?pic="+src,"pic","width=10, height=10");
}

function sameadress(){
	document.f_adr.liv_nom.value = document.f_adr.nom.value;
	document.f_adr.liv_prenom.value = document.f_adr.prenom.value;
	document.f_adr.liv_civilite.selectedIndex = document.f_adr.civilite.selectedIndex; 
	document.f_adr.liv_adresse.value = document.f_adr.adresse.value;
	document.f_adr.liv_adresse2.value = document.f_adr.adresse2.value;
	document.f_adr.liv_code_postal.value = document.f_adr.code_postal.value;
	document.f_adr.liv_ville.value = document.f_adr.ville.value;
	document.f_adr.liv_tel.value = document.f_adr.tel.value;
	document.f_adr.liv_tel2.value = document.f_adr.tel2.value;
}
