<!--
//Utilisation des fonctions getElement sur tous les navigateurs
if (!document.getElementById) document.getElementById = function (id) {
  return eval("document.all."+id);
  }
if(!document.getElementsByName) document.getElementsByName = function (name) {
var el = document.all;
result = new Array(),j=0;
for(var i=0;i<el.length;i++) 
	if(el[i].name.toLowerCase()==name.toLowerCase()) result[j++]=el[i];
		return result;
}
if(!document.getElementsByTagName) document.getElementsByTagName = function (tagName) {
		var el = document.all;
		result = new Array();
		j=0;
		for(var i=0;i<el.length;i++) 
		if(el[i].tagName.toLowerCase()==tagName.toLowerCase()) 
			result[j++]=el[i];
			return result;
}

var divOpenComp = 0;
var xmlhttpreq = null;
function MakeTTC(prixTTC) {
var chaine = '';
	chaine = '<table cellspacing=0 cellpadding=0><tr><td nowrap class=normal>Soit ' + prixTTC + ' &euro; ttc net</td></tr></table>';
	return chaine;
}
function MakeArray(c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12) {
var chaine = '';
	chaine = '<table border=1 bordercolor="#FF7823" cellspacing=0 cellpadding=2>'
	chaine = chaine + '<tr class=TabQteTitre><td colspan=3 nowrap>Prix selon la qté commandée</td></tr>'
	chaine = chaine + '<tr><td class=prix nowrap>à partir de</td><td class=prix nowrap>&euro; ht</td></tr>'
	if (c1>0) chaine = chaine + '<tr><td class=quantite nowrap>' + c1 + '</td><td class=prixselonqte1 nowrap>' + c2 + '</td></tr>'
	if (c4>0) chaine = chaine + '<tr><td class=quantite nowrap>' + c4 + '</td><td class=prixselonqte1 nowrap>' + c5 + '</td></tr>'
	if (c7>0) chaine = chaine + '<tr><td class=quantite nowrap>' + c7 + '</td><td class=prixselonqte1 nowrap>' + c8 + '</td></tr>'
	if (c10>0) chaine = chaine + '<tr><td align=center nowrap>' + c10 + '</td><td align=right nowrap>' + c11 + '</td></tr>'
	chaine = chaine + '</table>'
	return chaine;
}

function resizeResult(){
    var divresultat = document.getElementById('texteopaque1');
	var transparent = document.getElementById('fondtranslucide1');
	var centre = document.getElementById('centre');
	var taresultat = document.getElementById('tabresultat');
	var recherche = document.getElementById('rechercheconso');
	     	
	if (taresultat)
	{
		
	    taresultat.style.width = centre.offsetWidth -10 + "px";
	    transparent.style.width = centre.offsetWidth -10 + "px";
	    transparent.style.height = taresultat.offsetHeight + "px" ;
	    //alert(taresultat.offsetHeight);
	    if ((taresultat.offsetHeight +120) < 600)
	    {
	     if (recherche )
	        {
	        centre.style.height =recherche.offsetHeight+ 620 + "px" ;
	        }
	      else
	        {
	         centre.style.height = 620 + "px" ;
	        }  
	    }
	    else{
	        if (recherche)
	        {
	        centre.style.height = recherche.offsetHeight+taresultat.offsetHeight +140 + "px" ;
	        }
	        else
	        {
	         centre.style.height = taresultat.offsetHeight +140 + "px" ;
	        }
	    }
	}
	//alert (centre.offsetHeight);
	deplacecopyright();
}
function deplacecopyright(){
var bottom=0;
	var allDiv = document.getElementsByTagName("DIV");
	for (i=0;i<allDiv.length;i++) {
    	if (bottom < allDiv[i].offsetTop + allDiv[i].offsetHeight)
			{
			bottom = allDiv[i].offsetTop + allDiv[i].offsetHeight;
			//alert (allDiv[i].offsetTop);
			}
    }
	bottom += 17;
	document.getElementById("pied").style.top = bottom +"px";
    //alert(bottom);
}
function newdetailDivpanierajout(id,qte,Boutique,min) {
    if ((qte % min) == 0){
    var divDestination = document.getElementById('Divcontenupanier');
    affichagepanier(divDestination,id,qte,Boutique);
    }
}
function affichagepanier(objDiv,id,qte,Boutique) {
    if (window.XMLHttpRequest) {
        xmlhttpreq = new XMLHttpRequest();
        if (xmlhttpreq.overrideMimeType) xmlhttpreq.overrideMimeType("text/xml");
    }
    else if (window.ActiveXObject) {
        try {
            xmlhttpreq = new ActiveXObject("Msxml2.XMLHTTP");
        }
        catch (e) {
            try {
                xmlhttpreq = new ActiveXObject("Microsoft.XMLHTTP");
            }
            catch (e){}
        }
    }
    var mili = Math.floor(Math.random()*10000000);
    var argument = '?AjouterRef='+id+'&AjouterQte='+qte+'&Boutique='+Boutique+'&mili='+mili;
	xmlhttpreq.open('GET','/main/detailpanier.asp'+argument, true);
	xmlhttpreq.setRequestHeader("Content-Type","text/html; charset=iso-8859-1");
	xmlhttpreq.onreadystatechange = function() {
	 	if ( xmlhttpreq.readyState == 4 ) {
	    	objDiv.innerHTML = xmlhttpreq.responseText;
	    	
	    }   
    }
	xmlhttpreq.send(null);
}
function affichageinfopanierHP(id,qte,Boutique,min) {
    var xmlhttpreq = null;
    var objDivpanier = document.getElementById("infopanier"+id)
    if (window.XMLHttpRequest) {
        xmlhttpreq = new XMLHttpRequest();
        if (xmlhttpreq.overrideMimeType) xmlhttpreq.overrideMimeType("text/xml");
    }
    else if (window.ActiveXObject) {
        try {
            xmlhttpreq = new ActiveXObject("Msxml2.XMLHTTP");
        }
        catch (e) {
            try {
                xmlhttpreq = new ActiveXObject("Microsoft.XMLHTTP");
            }
            catch (e){}
        }
    }
    var mili = Math.floor(Math.random()*10000000);
    if ((qte % min) == 0){
    var argument = '?passs=ok&id='+id+'&min='+min+'&AjouterQte='+qte+'&Boutique='+Boutique+'&mili='+mili;}
    else
    {
    var argument = '?passs=ko&id='+id+'&min='+min+'&AjouterQte='+qte+'&Boutique='+Boutique+'&mili='+mili;}
    
	xmlhttpreq.open('GET','/main/infopanier.asp'+argument, true);
	xmlhttpreq.setRequestHeader("Content-Type","text/html; charset=iso-8859-1");
	xmlhttpreq.onreadystatechange = function() {
	 	if ( xmlhttpreq.readyState == 4 ) {
	    	document.getElementById("infopanier"+id).innerHTML = xmlhttpreq.responseText;
	    }   
    }
	xmlhttpreq.send(null);
	document.getElementById("infopanier"+id).style.display = 'block';
}
function AddBasket(id, val) {
	var obj = document.getElementById('Qte_'+ id); 
	x = eval(obj.value);
	obj.value = x + val;
	if (x + val < 0) obj.value = 0;
}
function validStock() {
if (document.form3.Email.value != '') {
		document.form3.nOnglet.value = document.frmliste.nOnglet.value;
		document.form3.submit();
	}
else {
	alert('Le champ EMail est obligatoire.');
	}
}
function validQuestion() {
if (document.form4.Email.value != '' && document.form4.Question.value.length > 4) {
		document.form4.nOnglet.value = document.frmliste.nOnglet.value;
		document.form4.submit();
	}
else {
	alert('Merci de formuler une question !');
	}
}
function showDiv(strobj) {
	var obj = document.getElementById(strobj);
	obj.style.display = 'block';
}
function hideDiv(strobj) {
	var obj = document.getElementById(strobj);
	obj.style.display = 'none';
}
function AjoutListePanier(strOnglet) {
	document.FrmListeAnnexe.nOnglet.value = strOnglet;
	document.FrmListeAnnexe.submit();
}
function resizeDetail(){
    var largeurPage = (document.all ? document.body.clientWidth : document.width);
    var centre = document.getElementById('centre');
	var taresultat = document.getElementById('tabresultat');
	centre.style.width = largeurPage - 20 - 220 + "px" ;
}
function CompareProduit() {
if (nbComp > 1) {
	var j=1;
	var strURL = '/main/comparer.asp?cmp=ok';
	var listeProduit = document.FrmResult.elements;
	if (listeProduit!=null)
		for (i=0; i < listeProduit.length; i++) {
			if (listeProduit[i].name.indexOf('OMPARER')>0) {
				newvaleur = parseInt(listeProduit[i].value);
				if (isNaN(newvaleur)) newvaleur = 0;
				if (listeProduit[i].checked==true) {
					strURL += '&prodid'+j+'='+newvaleur;
					j++
					}
				}
			}
	parent.fenCentre(strURL,'fenComparaison',780,510,'oui')
	}
else
	alert('Vous devez sélectionner au moins 2 produits.');
}
var nbComp = 0;

function SelectProduit(elt) {
if (nbComp < 4 || !elt.checked) {
	if (elt.checked) 
		nbComp++;
	else
		nbComp--;
	}
else {
	alert('Maximum 4 produits comparés');
	elt.checked = false;
	}
}
function fenCentre(Url,nomFen,tailleX,tailleY,scrol) {
	var remote;
	if (scrol=='oui')
		param = '\'toolbar=0,location=0,directories=0,menubar=0,scrollbars=-1,resizable=0,status=0,width='+tailleX+',height='+tailleY+',top=0,left=0\'';
	else
		param = '\'resizable=-1,width='+tailleX+',height='+tailleY+'\'';		
	ecranX=screen.width;
	ecranY=screen.height;
	posX=(ecranX-tailleX)/2;
	posY=(ecranY-tailleY)/2;
	remote = window.open(Url,nomFen,param);
	remote.focus();
}
function MakePromo(DatePromo, PrixTTC) {
var chaine = '';
	chaine = '<table cellspacing=0 cellpadding=0><tr><td><img src="/images/promo.gif"></td><td class="promo" valign=middle align=center>Valable jusqu\'au ' + DatePromo + '</td></tr><tr><td colspan=2 nowrap class=normal>Soit ' + PrixTTC + ' € ttc</td></tr></table>';
	return chaine;
}
//-->
