// 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 == "panier" ){
			document.location.href= url+"cad1/";
			}
		else if(action == "redir"){
			location.reload(); 
			}
	}}    
	XhrObj.send(null);
	}

function Cart(id){
		qte = document.add.v_qte.value;
		size = document.add.v_size.value;
		color = document.add.v_color.value;
		sendData("v_art="+id+"&v_qte="+qte+"&v_size="+size+"&v_color="+color+"&increment=1", url+"inc/_panier.php" , "panier","cart");
	}

function Upd(id,qte,size,color){
	sendData("v_art="+id+"&v_qte="+qte+"&v_size="+size+"&v_color="+color+"&display=no", url+"inc/_panier.php" , "redir","cart");
	}

function Del(id){
	sendData("del="+id+"&display=no", url+"inc/_panier.php" , "redir" , "cart");
	}
	
	
function swap(ph){
	document.getElementById('zone').src='photos/m/'+ph;
}	

function NewsL(){
		email_newsletter = document.getElementById('email_newsletter').value;
		sendData("email_newsletter="+email_newsletter, url+"inc/blk_newsletter.php" , "","NewsL");
}

function zoom2(){
	src = document.getElementById('zone').src;
	src = src.replace("/m/", "/l/");
	window.open(url+"inc/viewer.php?pic="+src,"pic","width=10, height=10");
}

function zoom(src){
	window.open(url+"inc/viewer.php?pic="+src,"pic","width=10, height=10");
}

function tableaufrais(){
	window.open(url+"frais_de_port.php","frais","width=400, height=500, scrollbars=yes");
}

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.societe_livr.value = document.f_adr.societe_fact.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_pays.selectedIndex = document.f_adr.pays.selectedIndex;
	document.f_adr.liv_tel.value = document.f_adr.tel.value;
	document.f_adr.liv_tel2.value = document.f_adr.tel2.value;
}
