
function P (p,t,v,b,r,ca,cp,q,rf) { 
this.p = p;
this.t = t; 
this.v = v; 
this.b = b; 
this.r = r; 
this.ca = ca;	
this.cp = cp; 
this.q = q;  }

var sSelectReference = '';
var sSelectCodeVente = '';
var sTaillePrecedent = 0;
var sObjTailleIdPrecedent = '';
var ProduitIdPrecedent = 0;
var bTailleSelectProd = false;

function InitTailleSelect(){
	bTailleSelectProd = false;
}

var pGlobalPM = "";
var tDivSGlobalPM = "";
var iColGlobalPM = "";
var siteGlobalPM = "";

var pGlobal = "";
var tDivSGlobal = "";
var iColGlobal = "";
var siteGlobal = "";
function ATC(p,tDivS,iCol,site) { 
var nbTailleSansStock = 0;
var bUneSeuleTailleDispo = false;
//alimente les varialbes réexploiter dans le function : alertContents!
pGlobal = p;
tDivSGlobal = tDivS;
iColGlobal = iCol;
siteGlobal = site;
if (iCol >= 0) { 			 
	var sTaille = ""; 
	var dcID = ""; 
	var addon = ""; 
	var z = "";	
	var bTailleSelect = false;
	if (TP[p][iCol].length == 1 && iSilhouetteId == 0) {
	    addon = "select";
	}
	document.getElementById('span_enstock').style.display = ''
	var disponibilite 
	if(site=='FR_FR')
	{disponibilite = "Non disponible";}
	if(site=='ES_ES')
	{disponibilite = "Agotado";}
	if(site=='IT_IT')
	{disponibilite = "Esaurito";}

	//permet de selectionner par défaut la taille des produits n'ayant qu'une seule taille dispo
	for (z = 0; z < TP[p][iCol].length; z++) {
		if (TP[p][iCol][z].q == 1){
			nbTailleSansStock += 1;
		}
	}	
	if (nbTailleSansStock == (TP[p][iCol].length - 1)){
		bUneSeuleTailleDispo = true;
	}
	
	for (z = 0; z < TP[p][iCol].length; z++) {
	    document.getElementById('span_enstock').style.display = ''
        if (TP[p][iCol][z].q == 1) 
        {
			sTaille = sTaille + "<div id='dc"+p+z+"' class='pasdispo"+addon+"'><a class=info style='background:none'>" + TP[p][iCol][z].t + "<span class=colori>" + disponibilite + "</span></a></div>";
		    sTaille = sTaille + "<div class='t_sep'>&nbsp;</div>";		
		    hidebouton(p);			
		    addon="";	// on vide le addon1 (il n'y a qu'une taille indisponible selectionnée) 	
        } 
        else 
        { 
	       document.getElementById('span_enstock').style.display = ''
	       //alert(sTaillePrecedent +' | '+ TP[p][iCol][z].t);
		    //alert(sTaillePrecedent);

            /*if (sTaillePrecedent == TP[p][iCol][z].t) {
                sObjTailleIdPrecedent = 'dc' + p + z
                addon = "select";
            }*/
            
            if ((TP[p][iCol].length == 1 && bTailleSelectProd == false) || bUneSeuleTailleDispo)
	        {
	            addon = "select";
	        }

	            if (TP[p][iCol][z].t.length >= 6) 
                {
                    sTaille = sTaille + "<div onclick=\"ns_onclick(this,'','fp.choix-taille','clickout','kiabi');chargerInfos('taille','" + TP[p][iCol][z].t + "');ST(" + p + ",this,\'" + TP[p][iCol][z].v + "\',\'" + TP[p][iCol][z].b + "\',\'" + TP[p][iCol][z].r + "\','dc" + p + z + "','" + TP[p][iCol][z].ca + "','" + TP[p][iCol][z].cp + "','" + z + "','" + TP[p][iCol][z].t + "');\" style='cursor:pointer;' id='dc" + p + z + "' class='dispo" + addon + "2' onmouseover=func_OnMouseOverTaille2('" + p + "','" + z + "'); onmouseout=func_OnMouseOutTaille2('" + p + "','" + z + "');>" + TP[p][iCol][z].t + "</div><div class='t_sep'>&nbsp;</div>";
                }
		        else 
                {
                    sTaille = sTaille + "<div onclick=\"ns_onclick(this,'','fp.choix-taille','clickout','kiabi');chargerInfos('taille','" + TP[p][iCol][z].t + "');ST(" + p + ",this,\'" + TP[p][iCol][z].v + "\',\'" + TP[p][iCol][z].b + "\',\'" + TP[p][iCol][z].r + "\','dc" + p + z + "','" + TP[p][iCol][z].ca + "','" + TP[p][iCol][z].cp + "','" + z + "','" + TP[p][iCol][z].t + "');\" style='cursor:pointer;' id='dc" + p + z + "' class='dispo" + addon + "' onmouseover=func_OnMouseOverTaille('" + p + "','" + z + "'); onmouseout=func_OnMouseOutTaille('" + p + "','" + z + "');>" + TP[p][iCol][z].t + "</div><div class='t_sep'>&nbsp;</div>";
                }
            //}
	    }
	    if(z == 7)
	    {
	        sTaille = sTaille + '<br><br>';
	    }	

	    if(addon=="select") 
	    {
	        ST(p, 'dc' + p + z, TP[p][iCol][z].v, TP[p][iCol][z].b, TP[p][iCol][z].r, 'dc' + p + z, TP[p][iCol][z].ca, TP[p][iCol][z].cp, z, TP[p][iCol][z].t);
	        chargerInfos('taille', '' + TP[p][iCol][z].t + '');
	        showbouton(p);
	        bTailleSelect = true;
	    }
	    addon="";	
	    }
	if (bUneSeuleTailleDispo) {
	    showbouton(p);
		 }
	
	    if(!bTailleSelect && HaveMultiPrix)
	    {
	        SelectColori(p,TP_LBL_COL[1][iCol]['prxa'],TP_LBL_COL[1][iCol]["prxr"],TP_LBL_COL[1][iCol]["tr"],TP[p][iCol][1].cp,TP_LBL_COL[1][iCol]["nbcpd"]);
	    }
	
	    sTaille = sTaille + "<a href=# onclick=PopupScroll('"+eval('UrlAssistantTaille'+p)+"','assistant',640,655);ns_onclick(this,'','fp.guide-taille','clickout','kiabi');return false;  class=assistanttaille>"+MessageAssistantTaille+"</a>";
        document.getElementById('affichagedestailles'+p).innerHTML = sTaille
		$("#choixtaille").css("color","");	
	    if (eval('document.getElementById("mytaille'+p+'").value=="dc'+p+z+'"')) {
			addon="select";	 // selectionne la taille
			ST(p, 'dc' + p + z, TP[p][iCol][z].v, TP[p][iCol][z].b, TP[p][iCol][z].r, 'dc' + p + z, TP[p][iCol][z].ca, TP[p][iCol][z].cp, z, TP[p][iCol][z].t);
        }// met à jour prix, prix barré et remise	
	else { addon = ""; }

        bTailleSelectProd = true;
	}
	
}


function ATCPM(p,tDivS,iCol,site) { 
pGlobalPM = p;
tDivSGlobalPM = tDivS;
iColGlobalPM = iCol;
siteGlobalPM = site;
if (iCol >= 0) { 			 
	var sTaille = ""; 
	var dcID = "";
	var addon = ""; 
	var z = "";	
	var bTailleSelect = false;
	var nbTailleSansStock = 0;
	var bUneSeuleTailleDsipo = false;
	if (TP[p][iCol].length == 1 && iSilhouetteId == 0) {
	    addon = "select";
	}
	var disponibilite 
	if(site=='FR_FR')
	{disponibilite = "Non disponible";}
	if(site=='ES_ES')
	{disponibilite = "Agotado";}
	if(site=='IT_IT')
	{disponibilite = "Esaurito";}

	document.getElementById('span_enstocklot'+p).style.display = ''	
    //permet de selectionner par défaut la taille des produits n'ayant qu'une seule taille dispo
	for (z = 0; z < TP[p][iCol].length; z++) {
		if (TP[p][iCol][z].q == 1){
			nbTailleSansStock += 1;
		}
	}	
	if (nbTailleSansStock == (TP[p][iCol].length - 1)){
		bUneSeuleTailleDsipo = true;

	}
	
	for (z = 0; z < TP[p][iCol].length; z++) {
	document.getElementById('span_enstocklot'+p).style.display = ''	
        if (TP[p][iCol][z].q == 1) 
        {
            
			sTaille = sTaille + "<div id='dc"+p+z+"' class='pasdispo"+addon+"'><a class=info style='background:none'>" + TP[p][iCol][z].t + "<span class=colori>" + disponibilite + "</span></a></div>";
		    sTaille = sTaille + "<div class='t_sep'>&nbsp;</div>";		
	
		    hidebouton(p);			
		    addon="";	// on vide le addon1 (il n'y a qu'une taille indisponible selectionnée) 	
        } 
        else 
        {	       
			if (TP[p][iCol].length == 1 || bUneSeuleTailleDsipo)
	        {	     
	            addon = "select";
	        }            
			if (TP[p][iCol][z].t.length >= 6) 
			{
				sTaille = sTaille +  "<div onclick=\"ns_onclick(this,'','fp.choix-taille','clickout','kiabi');STPM("+p+",this,\'"+TP[p][iCol][z].v+"\',\'"+TP[p][iCol][z].b+"\',\'"+TP[p][iCol][z].r+"\','dc"+p+z+"','"+TP[p][iCol][z].ca+"','"+TP[p][iCol][z].cp+"','"+z+"','"+TP[p][iCol][z].t+"');\" style='cursor:pointer;' id='dc"+p+z+"' class='dispo"+addon+"2' onmouseover=func_OnMouseOverTaille2('"+p+"','"+z+"'); onmouseout=func_OnMouseOutTaille2('"+p+"','"+z+"');>" +TP[p][iCol][z].t + "</div><div class='t_sep'>&nbsp;</div>" ;
			}
			else 
			{
				sTaille = sTaille +  "<div onclick=\"ns_onclick(this,'','fp.choix-taille','clickout','kiabi');STPM("+p+",this,\'"+TP[p][iCol][z].v+"\',\'"+TP[p][iCol][z].b+"\',\'"+TP[p][iCol][z].r+"\','dc"+p+z+"','"+TP[p][iCol][z].ca+"','"+TP[p][iCol][z].cp+"','"+z+"','"+TP[p][iCol][z].t+"');\" style='cursor:pointer;' id='dc"+p+z+"' class='dispo"+addon+"' onmouseover=func_OnMouseOverTaille('"+p+"','"+z+"'); onmouseout=func_OnMouseOutTaille('"+p+"','"+z+"');>" +TP[p][iCol][z].t + "</div><div class='t_sep'>&nbsp;</div>" ;			
			}            
	    }
	    if(z == 7)
	    {
	        sTaille = sTaille + '<br><br>';
	    }	

	    if(addon=="select") 
	    {
	    	STPM(p,'dc'+p+z,TP[p][iCol][z].v,TP[p][iCol][z].b,TP[p][iCol][z].r,'dc'+p+z,TP[p][iCol][z].ca,TP[p][iCol][z].cp,z,TP[p][iCol][z].t);
	        showbouton(p);
	        bTailleSelect = true;
	    }
		
	    addon="";	
	    } 
	
	    if(!bTailleSelect && HaveMultiPrix)
	    {
	        SelectColori(p,TP_LBL_COL[1][iCol]['prxa'],TP_LBL_COL[1][iCol]["prxr"],TP_LBL_COL[1][iCol]["tr"],TP[p][iCol][1].cp,TP_LBL_COL[1][iCol]["nbcpd"]);
	    }
	
	    sTaille = sTaille + "<a href=# onclick=PopupScroll('"+eval('UrlAssistantTaille'+p)+"','assistant',640,655);ns_onclick(this,'','fp.guide-taille','clickout','kiabi');return false;  class=assistanttaille>"+MessageAssistantTaille+"</a>";
        document.getElementById('affichagedestailles'+p).innerHTML = sTaille
		$("#choixtaille").css("color","");			
	    if (eval('document.getElementById("mytaille'+p+'").value=="dc'+p+z+'"')) {addon="select";	 // selectionne la taille
	    STPM(p,'dc'+p+z,TP[p][iCol][z].v,TP[p][iCol][z].b,TP[p][iCol][z].r,'dc'+p+z,TP[p][iCol][z].ca,TP[p][iCol][z].cp,z,TP[p][iCol][z].t); }// met à jour prix, prix barré et remise	
	else { addon = ""; }

        bTailleSelectProd = true;
	}
}

var sSClass ='dispo' ;	

function SelectColori(p,prix,barre,remise,reference,nbcoupleprixdiff)
{
var tab1 = prix.split("."); //separe le prix en 2 (euros/centimes)
var tab2 = barre.split("."); //separe le prix en 2 (euros/centimes)

 if(document.getElementById('prixeuro'+p))    document.getElementById('prixeuro'+p).innerHTML=tab1[0]; //affiche les euros
 if(document.getElementById('prixcents'+p))   
 {  
    if(tab1[1]) document.getElementById('prixcents'+p).innerHTML=tab1[1]; 
 }
 
 if(document.getElementById('prixbarreeuro'+p) && tab2[0] != 0) 
{ 
document.getElementById('prixbarreeuro'+p).innerHTML=tab2[0]; 
document.getElementById('prixbarreFP'+p).style.display = 'block';
document.getElementById('DivInfoPrix'+p).className = 'prixFPAvecBarre';
}
else
{
if(document.getElementById('prixbarreFP'+p))document.getElementById('prixbarreFP'+p).style.display = 'none';
document.getElementById('DivInfoPrix'+p).className = 'prixFPSansBarre';
}
 if(document.getElementById('prixbarrecents'+p))   
 {
    if(tab2[1]) document.getElementById('prixbarrecents'+p).innerHTML=tab2[1]; //affiche le prix barré centimes
 } 

 if(nbcoupleprixdiff > 1) {
 if(document.getElementById('MsgDepuis'+p)) document.getElementById('MsgDepuis'+p).style.display = 'block';
 }
 else
 {

 if(document.getElementById('MsgDepuis'+p)) document.getElementById('MsgDepuis'+p).style.display = 'none';
 }
 
if(document.getElementById('remise'+p) && remise != 0) 
{
  document.getElementById('remise'+p).innerHTML=remise; 
  document.getElementById('DivPorcentageRemise'+p).style.display = 'block';
}
else
{
  document.getElementById('DivPorcentageRemise'+p).style.display = 'none';
}

if(document.getElementById('Divprixasterisque'+p)) document.getElementById('Divprixasterisque'+p).style.display = 'block';

if(document.getElementById('sticker_remise'))
if(remise != 0)
{
	if (document.getElementById('ImageOnglet_'+reference))
	{
		document.getElementById('ImageOnglet_'+reference).style.display='block';
		if(bSoldes == 'true')SetStickerSolde(reference,remise);
	}
document.getElementById('remise_'+reference).style.display="block";
document.getElementById('sticker_remise').innerHTML="-"+remise+"%"; 
}
else{
	if (document.getElementById('ImageOnglet_'+reference))
	{
		document.getElementById('ImageOnglet_'+reference).style.display='none';
	}
document.getElementById('sticker_remise').innerHTML="";
document.getElementById('remise_'+reference).style.display="none";
}

}

function ST(p,oDivS,prix,barre,remise,numId,CodeVente,Reference,z,taille) { 

    if(document.getElementById('MsgDepuis'+p)) document.getElementById('MsgDepuis'+p).style.display = 'none';

    if(sObjTailleIdPrecedent != '')
	    {
		if (taille.length>=6){
		document.getElementById(sObjTailleIdPrecedent).className = 'dispoOff2';
		}
		else
		{
	        document.getElementById(sObjTailleIdPrecedent).className = 'dispoOff';
	    } 
	}
    sTaillePrecedent = taille;
    document.getElementById('mytaille' + p).value = numId;

    chargerInfos("prix", prix);

	var tab1 = prix.split("."); //separe le prix en 2 (euros/centimes)
	var tab2 = barre.split("."); //separe le prix en 2 (euros/centimes)
    eval("TailleEnCours"+p+" = '"+z+"';")
    if(document.getElementById(numId))document.getElementById(numId).className = 'dispoOn'; 
	 if(document.getElementById('prixeuro'+p))    document.getElementById('prixeuro'+p).innerHTML=tab1[0]; 
	 if(document.getElementById('prixcents'+p))   
	 {  
	    if(tab1[1]) document.getElementById('prixcents'+p).innerHTML=tab1[1]; 
	 }
	 if(document.getElementById('prixbarreeuro'+p) && tab2[0] != 0)  
	 {
		document.getElementById('prixbarreeuro'+p).innerHTML=tab2[0]; 
		if(document.getElementById('prixbarreFP'+p)) document.getElementById('prixbarreFP'+p).style.display = 'block';
		if(document.getElementById('DivInfoPrix'+p)) document.getElementById('DivInfoPrix'+p).className = 'prixFPAvecBarre';
	 }
	 else
	 {
		if(document.getElementById('prixbarreFP'+p)) document.getElementById('prixbarreFP'+p).style.display = 'none';
		if(document.getElementById('DivInfoPrix'+p)) document.getElementById('DivInfoPrix'+p).className = 'prixFPSansBarre';
	 }

	 if(document.getElementById('Divprixasterisque'+p)) document.getElementById('Divprixasterisque'+p).style.display = 'none';
	 
	 if(document.getElementById('prixbarrecents'+p))   
	 {
	    if(tab2[1]) document.getElementById('prixbarrecents'+p).innerHTML=tab2[1]; 
	 } 
	if(document.getElementById('remise'+p) && remise != 0)
	{
		document.getElementById('remise'+p).innerHTML=remise; 
		if(document.getElementById('DivPorcentageRemise'+p)) document.getElementById('DivPorcentageRemise'+p).style.display = 'block';
	}
	else
	{
		if(document.getElementById('DivPorcentageRemise'+p)) document.getElementById('DivPorcentageRemise'+p).style.display = 'none';
	}
	
	if(document.getElementById('sticker_remise'))   
	if(remise != 0)
	{
	if (document.getElementById('ImageOnglet_'+Reference))
	{
		document.getElementById('ImageOnglet_'+Reference).style.display='block';
		if(bSoldes == 'true')SetStickerSolde(Reference,remise);
	}
	if(document.getElementById('remise_'+Reference))
	{
		document.getElementById('remise_'+Reference).style.display="block";
	}
	if(document.getElementById('sticker_remise'))
	{
		document.getElementById('sticker_remise').innerHTML="-"+remise+"%"; 
	}
	}
	else
	{
		if (document.getElementById('ImageOnglet_'+Reference))
	{
		document.getElementById('ImageOnglet_'+Reference).style.display='none';
	}
	if(document.getElementById('sticker_remise'))
	{
		document.getElementById('sticker_remise').innerHTML="";
	}
	if(document.getElementById('remise_'+Reference))
	{
		document.getElementById('remise_'+Reference).style.display="none";
	}
	}
	
	oDiv=document.getElementById('dc'+p+'0');
	for (i=1; oDiv; i++) { //checke tous les id=dc1...	
	if (taille.length>=6){
		if (oDiv.className=='dispo2'){oDiv.className='dispo2';}	//met à jour tous les styles
		if (oDiv.className=='pasdispo2'){oDiv.className='pasdispo2';} //met à jour tous les styles
		if (oDiv.className=='disposelect2'){oDiv.className='dispo2';}//met à jour tous les styles
		if (oDiv.className=='pasdisposelect2'){oDiv.className='pasdispo2';}//met à jour tous les styles
	}
	else
	{
	if (oDiv.className=='dispo'){oDiv.className='dispo';}
	if (oDiv.className=='pasdispo'){oDiv.className='pasdispo';} 
	if (oDiv.className=='disposelect'){oDiv.className='dispo';}
	if (oDiv.className=='pasdisposelect'){oDiv.className='pasdispo';}
	}
		
	oDiv=document.getElementById('dc'+ p + i);/*incrémente la boucle*/}
 
 if (taille.length>=6){
	sSClass='disposelect2'; 
 }
 else
 {
 sSClass='disposelect'; 
 }
 
 oDivS.className=sSClass; 
 TB_Panier[p]['CV'] = CodeVente;
 TB_Panier[p]['REF'] = Reference;
 TB_Panier[p]['IdObjTaille'] = numId;
 TB_Panier[p]['TailleLibelle'] = taille;
 TB_MisdeCode[p] = CodeVente;
 showbouton(p); 
$("#affichagedestailles1").parent().children("div#errTaille").hide();
$("#choixtaille").css("color","");		
 }
 
 
 function STPM(p,oDivS,prix,barre,remise,numId,CodeVente,Reference,z,taille) { 

    if(document.getElementById('MsgDepuis'+p)) document.getElementById('MsgDepuis'+p).style.display = 'none';

    if(sObjTailleIdPrecedent != '') {      
		if (taille.length>=6){
		document.getElementById(sObjTailleIdPrecedent).className = 'dispoOff2';
		}
		else
		{
	        document.getElementById(sObjTailleIdPrecedent).className = 'dispoOff';
	    } 
	}
    sTaillePrecedent = taille;
    document.getElementById('mytaille'+p).value=numId;	
	var tab1 = prix.split("."); //separe le prix en 2 (euros/centimes)
	var tab2 = barre.split("."); //separe le prix en 2 (euros/centimes)
    eval("TailleEnCours"+p+" = '"+z+"';")
    if(document.getElementById(numId))document.getElementById(numId).className = 'dispoOn'; 
	 if(document.getElementById('prixeuro'+p))    document.getElementById('prixeuro'+p).innerHTML=tab1[0]; 
	 if(document.getElementById('prixcents'+p))   
	 {  
	    if(tab1[1]) document.getElementById('prixcents'+p).innerHTML=tab1[1]; 
	 }
	 if(document.getElementById('prixbarreeuro'+p) && tab2[0] != 0)  
	 {
		document.getElementById('prixbarreeuro'+p).innerHTML=tab2[0]; 
		if(document.getElementById('prixbarreFP'+p)) document.getElementById('prixbarreFP'+p).style.display = 'block';
		if(document.getElementById('DivInfoPrix'+p)) document.getElementById('DivInfoPrix'+p).className = 'prixFPAvecBarre';
	 }
	 else
	 {
		if(document.getElementById('prixbarreFP'+p)) document.getElementById('prixbarreFP'+p).style.display = 'none';
		if(document.getElementById('DivInfoPrix'+p)) document.getElementById('DivInfoPrix'+p).className = 'prixFPSansBarre';
	 }

	 if(document.getElementById('Divprixasterisque'+p)) document.getElementById('Divprixasterisque'+p).style.display = 'none';
	 
	 if(document.getElementById('prixbarrecents'+p))   
	 {
	    if(tab2[1]) document.getElementById('prixbarrecents'+p).innerHTML=tab2[1]; 
	 } 
	 if (p == '1')
	 {
		if(document.getElementById('remise'+p) && remise != 0)
		{
			document.getElementById('remise'+p).innerHTML=remise; 
			if(document.getElementById('DivPorcentageRemise'+p)) document.getElementById('DivPorcentageRemise'+p).style.display = 'block';
		}
		else
		{
			if(document.getElementById('DivPorcentageRemise'+p)) document.getElementById('DivPorcentageRemise'+p).style.display = 'none';
		}	
	
		if(document.getElementById('sticker_remise'))   
			if(remise != 0)
			{
				if (document.getElementById('ImageOnglet_'+Reference))
				{
					document.getElementById('ImageOnglet_'+Reference).style.display='block';
					if(bSoldes == 'true')SetStickerSolde(Reference,remise);
				}
				document.getElementById('remise_'+Reference).style.display="block";
				document.getElementById('sticker_remise').innerHTML="-"+remise+"%"; 
			}
			else
			{
				if (document.getElementById('ImageOnglet_'+Reference))
				{
					document.getElementById('ImageOnglet_'+Reference).style.display='none';
				}
				document.getElementById('sticker_remise').innerHTML="";
				document.getElementById('remise_'+Reference).style.display="none";
			}
	}
	
	oDiv=document.getElementById('dc'+p+'0');
	for (i=1; oDiv; i++) { //checke tous les id=dc1...	
	if (taille.length>=6){
		if (oDiv.className=='dispo2'){oDiv.className='dispo2';}	//met à jour tous les styles
		if (oDiv.className=='pasdispo2'){oDiv.className='pasdispo2';} //met à jour tous les styles
		if (oDiv.className=='disposelect2'){oDiv.className='dispo2';}//met à jour tous les styles
		if (oDiv.className=='pasdisposelect2'){oDiv.className='pasdispo2';}//met à jour tous les styles
	}
	else
	{
	if (oDiv.className=='dispo'){oDiv.className='dispo';}
	if (oDiv.className=='pasdispo'){oDiv.className='pasdispo';} 
	if (oDiv.className=='disposelect'){oDiv.className='dispo';}
	if (oDiv.className=='pasdisposelect'){oDiv.className='pasdispo';}
	}
		
	oDiv=document.getElementById('dc'+ p + i);/*incrémente la boucle*/}
 
 if (taille.length>=6){
	sSClass='disposelect2'; 
 }
 else
 {
 sSClass='disposelect'; 
 }
 
 oDivS.className=sSClass; 
 TB_Panier[p]['CV'] = CodeVente;
 TB_Panier[p]['REF'] = Reference;
 TB_Panier[p]['IdObjTaille'] = numId;
 TB_Panier[p]['TailleLibelle'] = taille;
 TB_MisdeCode[p] = CodeVente;
 showbouton(p); 
 $("#affichagedestailles"+p).parent().children("div#errTaille").hide();
 $("#choixtaille_"+p).css("color","");	
 }
 
 
 function showbouton (p){ 
 document.getElementById("oksubmit"+p).style.display="block"; 
 document.getElementById("nosubmit"+p).style.display="none";
 if (document.getElementById("ok2submit"+p)){
	 document.getElementById("ok2submit"+p).style.display="block"; 
	 document.getElementById("no2submit"+p).style.display="none";
 }
 }
 function hidebouton (p){  
 document.getElementById("oksubmit"+p).style.display="none"; 
 document.getElementById("nosubmit"+p).style.display="block";
 if (document.getElementById("ok2submit"+p)){
	 document.getElementById("ok2submit"+p).style.display="none";   
	 document.getElementById("no2submit"+p).style.display="block";
 }
 }
 
 function btClickContinueShopping(p)
 {
     document.getElementById("cachepage").style.display="none";
     document.getElementById("confirm"+p).style.display="none";
 } 
 
 function btClickContinueShoppingRuptureStock(p)
 {
     document.getElementById("cachepage").style.display="none";
     document.getElementById("confirmRuptureStock"+p).style.display="none";
 } 
 
 function btClickContinueShoppingErreur(p)
 {
     document.getElementById("cachepage").style.display="none";
     document.getElementById("confirmErreur"+p).style.display="none";
 } 

function SetStickerSolde(Reference,Remise)
{

var RemiseCalculee
Remise = Math.floor(((Remise))/5.0);
RemiseCalculee = Remise * 5;

if(RemiseCalculee && document.getElementById("ImageOnglet_"+Reference))
document.getElementById("ImageOnglet_"+Reference).src = '/images/020-RAYONS/onglet_Soldes_'+RemiseCalculee + '.gif';
else if (document.getElementById("ImageOnglet_"+Reference))
document.getElementById("ImageOnglet_"+Reference).src = '/images/1ptrans.gif';

}
 
var http_request = false;
var Get_http_response;
var bAjoutPanier = false;
var NumProduitAjout = 0;
var sCodeVente = '';
 function miseaupanier(p,org,adresse) { //affichage layer ajout au panier + articles complémentaires
 {
 	NumProduitAjout = p;
 	sCodeVente = '';
	try
	{   var i = 1 

	    while(TB_Panier[i]['CV'])
	    {
		if(TB_Panier[i]['REF'] != '')
		{
			sSelectReference +=  TB_Panier[i]['REF'] + ','; 
		}
		if(TB_Panier[i]['CV'] != '')
		{
		    sCodeVente = TB_Panier[i]['CV'];
			sSelectCodeVente += TB_Panier[i]['CV'] + ',';  
		}
        TB_Panier[i]['REF'] = 'Vide';
        TB_Panier[i]['CV'] = 'Vide';
	        i++;}
	}catch(e){}

	//ajout pierre 24/11/09
	var cp = 0;
	
	if 	(LireCookie('CompteClient_CompteID'))
	 {cp =LireCookie('CompteClient_CompteID');}
	 
	else
	{cp=0;}

	if (window.location.href.indexOf("#layer") > -1) {
	    org = "suggestion-layer-fp__0__17";
	}
    else if (window.location.href.indexOf("#recherche") > -1) 
    {
        var tabrecherche = window.location.href.split("#recherche&");
        var recherche = "0";
        if (tabrecherche[1] != null)
            recherche = tabrecherche[1];
        org = "moteur-de-recherche__"+ recherche +"__4";
	}
	
	var Quantite = $("#inp_QuantitePanier").attr("value");

	var UrlAjoutPanier =  '/030-COMMANDE/50-10_misepanier_v2.asp?MyAction=AjouterPanier&Reference=' + sSelectReference + '&CV=' + sSelectCodeVente + '&OpeId=' + iOpeId + '&SilhouetteId=' + iSilhouetteId + "&origine="+org + "&compteid=" + cp + "&adresseOrigin=" + encodeURIComponent(adresse) + "&Quantite=" + Quantite

	//var UrlAjoutPanier =  '/030-COMMANDE/50-10_misepanier_v2.asp?MyAction=AjouterPanier&Reference=' + sSelectReference + '&CV=' + sSelectCodeVente + '&OpeId=' + iOpeId + '&SilhouetteId=' + iSilhouetteId + "&origine="+org
	//--------------------------------------------------------/
	
    sSelectReference = '';
    sSelectCodeVente = '';
 
    http_request = false;
    
    if (window.XMLHttpRequest) { // Mozilla, Safari,...
    http_request = new XMLHttpRequest();
    if (http_request.overrideMimeType) {
        http_request.overrideMimeType('text/xml');
    }
    } else if (window.ActiveXObject) { // IE
        try {
           http_request = new ActiveXObject("Msxml2.XMLHTTP");
        } catch (e) {
            try {
            http_request = new ActiveXObject("Microsoft.XMLHTTP");
            } catch (e) {}
        }
    }
    
    if (!http_request) {
        alert("Cannot create an XMLHTTP instance");
       return false;
    }
    http_request.onreadystatechange = alertContents;
    http_request.open('get', UrlAjoutPanier, true);
    http_request.send(null);
    return true;
 }

function alertContents() {
    if (http_request.readyState == 4) {
		
        if (http_request.status == 200) {
             
             var TabReponse = http_request.responseText.split(';');
             var sResult =  TabReponse[0];
             var iNbArticleAjoute = TabReponse[1];
             var iNbArticleAjouteLot = TabReponse[2]; 
             var iOperationCompId = TabReponse[3]; 
             var iPanierId = TabReponse[4]; 
             
             if(iOperationCompId != "0" && iPanierId != "0" && IsNumeric(iOperationCompId) && IsNumeric(iPanierId)) {
				RqtAjaxTestOpeComp('/030-COMMANDE/MoteurOpe/Controller.aspx','Action=TEST_OPE_COMP_FP&OperationId='+iOperationCompId+'&PanierId='+iPanierId+"&TypeLivraison=livraison_kiala_FR",'post');
			 }
             
             
			 if(sResult == '1')
			 {  

			     try {
			         if(window.parent.document.getElementById('BodyBorne'))
			         {
			          window.location = "/030-COMMANDE/10-10_panier.asp";
			          return false;
			         } }
			            catch(e){}
			           
			     
		         document.getElementById("cachepage").style.display="block";
		         if(NombreProduitLotTotal > 0)
		         {
		            if (iNbArticleAjouteLot >= NombreProduitLotTotal)
		            { 
		                document.getElementById("MessageLot"+NumProduitAjout).innerHTML = MessageLot2;
		            }
		            else
		            {
		                document.getElementById("MessageLot"+NumProduitAjout).innerHTML = MessageLot1.replace('{1}',NombreProduitLotTotal-iNbArticleAjouteLot)
		            }
		            document.getElementById("confirm"+NumProduitAjout).style.display="block";
		         }
		         else
		         {
                    document.getElementById("confirm"+NumProduitAjout).style.display="block";				 
                 }
                 EcrireCookie('NombreArticlesPanier',iNbArticleAjoute);
			     maj_Panier();
			     
			    try
	            {   var i = 1 
	                while(TB_Panier[i]['IdObjTaille'])
	                {
	                    if(TB_Panier[i]['IdObjTaille'] != '')
	                    {
						var rtaille=TB_Panier[i]['TailleLibelle'];
						   	if  (rtaille.length >=6)
							{

                            if(document.getElementById(TB_Panier[i]['IdObjTaille'])) 
								document.getElementById(TB_Panier[i]['IdObjTaille']).className = 'dispo';
                            hidebouton(i);
                            TB_Panier[i]['IdObjTaille'] = 'Vide';
							}
							else
							{
								
									if(document.getElementById(TB_Panier[i]['IdObjTaille'])) 
										document.getElementById(TB_Panier[i]['IdObjTaille']).className = 'dispo';
									hidebouton(i);
								TB_Panier[i]['IdObjTaille'] = 'Vide';
							}
							
                        }
	                    i++;}
	            }catch(e){}
			//TMA 2271 Dautricourt Rémi				
			ATC(pGlobal,tDivSGlobal,iColGlobal,siteGlobal);
             }
             else
             {

				document.getElementById("cachepage").style.display="block";
				document.getElementById("confirmRuptureStock"+NumProduitAjout).style.display="block";
             }
        } else {

			document.getElementById("cachepage").style.display="block";
			document.getElementById("confirmErreur"+NumProduitAjout).style.display="block";
        }
    }
}
}


 function miseaupanierPM(p,org, adresse,Qt) { //affichage layer ajout au panier + articles complémentaires
 {
 	NumProduitAjout = p;
 	sCodeVente = '';
	try
	{   
		if(TB_Panier[NumProduitAjout]['REF'] != '')
		{
			sSelectReference +=  TB_Panier[NumProduitAjout]['REF'] + ','; 
		}
		if(TB_Panier[NumProduitAjout]['CV'] != '')
		{
		    sCodeVente = TB_Panier[NumProduitAjout]['CV'];
			sSelectCodeVente += TB_Panier[NumProduitAjout]['CV'] + ',';  
		}
        TB_Panier[NumProduitAjout]['REF'] = 'Vide';
        TB_Panier[NumProduitAjout]['CV'] = 'Vide';	 
	}catch(e){}

	//ajout pierre 24/11/09
	var cp = 0;
	
	if 	(LireCookie('CompteClient_CompteID'))
	 {cp =LireCookie('CompteClient_CompteID');}
	 
	else
	{cp=0;}
	
	var UrlAjoutPanier =  '/030-COMMANDE/50-10_misepanier_v2.asp?MyAction=AjouterPanier&Reference=' + sSelectReference + '&CV=' + sSelectCodeVente + '&OpeId=' + iOpeId + '&SilhouetteId=' + iSilhouetteId + "&origine="+org + "&compteid=" + cp + "&adresseOrigin=" + encodeURIComponent(adresse) + "&Quantite=" + Qt
	
	//var UrlAjoutPanier =  '/030-COMMANDE/50-10_misepanier_v2.asp?MyAction=AjouterPanier&Reference=' + sSelectReference + '&CV=' + sSelectCodeVente + '&OpeId=' + iOpeId + '&SilhouetteId=' + iSilhouetteId + "&origine="+org
	//--------------------------------------------------------/
	
    sSelectReference = '';
    sSelectCodeVente = '';
 
    http_request = false;
    
    if (window.XMLHttpRequest) { // Mozilla, Safari,...
    http_request = new XMLHttpRequest();
    if (http_request.overrideMimeType) {
        http_request.overrideMimeType('text/xml');
    }
    } else if (window.ActiveXObject) { // IE
        try {
           http_request = new ActiveXObject("Msxml2.XMLHTTP");
        } catch (e) {
            try {
            http_request = new ActiveXObject("Microsoft.XMLHTTP");
            } catch (e) {}
        }
    }
    
    if (!http_request) {
        alert("Cannot create an XMLHTTP instance");
       return false;
    }
    http_request.onreadystatechange = alertContents;
    http_request.open('get', UrlAjoutPanier, true);
    http_request.send(null);
    return true;
 }


 
function alertContents() {
    if (http_request.readyState == 4) {
		
        if (http_request.status == 200) {
             
             var TabReponse = http_request.responseText.split(';');
             var sResult =  TabReponse[0];
             var iNbArticleAjoute = TabReponse[1];
             var iNbArticleAjouteLot = TabReponse[2]; 
             var iOperationCompId = TabReponse[3]; 
             var iPanierId = TabReponse[4]; 
             
             if(iOperationCompId != "0" && iPanierId != "0" && IsNumeric(iOperationCompId) && IsNumeric(iPanierId)) {
				RqtAjaxTestOpeComp('/030-COMMANDE/MoteurOpe/Controller.aspx','Action=TEST_OPE_COMP_FP&OperationId='+iOperationCompId+'&PanierId='+iPanierId+"&TypeLivraison=livraison_kiala_FR",'post');
			 }
             
             
			 if(sResult == '1')
			 {  

			     try {
			         if(window.parent.document.getElementById('BodyBorne'))
			         {
			          window.location = "/030-COMMANDE/10-10_panier.asp";
			          return false;
			         } }
			            catch(e){}
			           
			     
		         document.getElementById("cachepage").style.display="block";
		         if(NombreProduitLotTotal > 0)
		         {
		            if (iNbArticleAjouteLot >= NombreProduitLotTotal)
		            { 
		                document.getElementById("MessageLot"+NumProduitAjout).innerHTML = MessageLot2;
		            }
		            else
		            {
		                document.getElementById("MessageLot"+NumProduitAjout).innerHTML = MessageLot1.replace('{1}',NombreProduitLotTotal-iNbArticleAjouteLot)
		            }
		            document.getElementById("confirm"+NumProduitAjout).style.display="block";
		         }
		         else
		         {
                    document.getElementById("confirm"+NumProduitAjout).style.display="block";				 
                 }
                 EcrireCookie('NombreArticlesPanier',iNbArticleAjoute);
			     maj_Panier();
			     
			    try
	            {   var i = 1 
	                while(TB_Panier[i]['IdObjTaille'])
	                {
	                    if(TB_Panier[i]['IdObjTaille'] != '')
	                    {
						var rtaille=TB_Panier[i]['TailleLibelle'];						
						   	if  (rtaille.length >=6)
							{
                            if(document.getElementById(TB_Panier[i]['IdObjTaille'])) document.getElementById(TB_Panier[i]['IdObjTaille']).className = 'dispo2';
                            hidebouton(i);
                            TB_Panier[i]['IdObjTaille'] = 'Vide';
							}
							else
							{
							if(document.getElementById(TB_Panier[i]['IdObjTaille'])) document.getElementById(TB_Panier[i]['IdObjTaille']).className = 'dispo';
							hidebouton(i);
                            TB_Panier[i]['IdObjTaille'] = 'Vide';
							}							
                        }
	                    i++;}
	            }catch(e){}
			ATCPM(pGlobalPM,tDivSGlobalPM,iColGlobalPM,siteGlobalPM);
             }
             else
             {

				document.getElementById("cachepage").style.display="block";
				document.getElementById("confirmRuptureStock"+NumProduitAjout).style.display="block";
             }
        } else {

			document.getElementById("cachepage").style.display="block";
			document.getElementById("confirmErreur"+NumProduitAjout).style.display="block";
        }
    }
}
}

//fonction pour ajouter un nouveau produit parmis les produits mis de côté
function misdecote(p,cptID,divpanier)
{
 	sCodeVente = TB_MisdeCode[p];
	CompteID = cptID;	

	$.ajax({
       type: "GET",
       url: "/030-COMMANDE/60-10_MisDeCote.asp",
	   contentType : "application/x-www-form-urlencoded;ISO-8859-1",
       data: "Action=Ajouter&CodeVente=" + sCodeVente + "&CompteID=" + CompteID,
       success: function(msg){            
			// au cas ou d'autre parametres serais necessaires plus tard
			var TabReponse = msg.split(';'); 
            var sResult =  TabReponse[0];
			
			if (sResult == '1')
			{
				$("#cachepage").show();
				$("#confirm_mdc").show();
				var pos = $(divpanier).position();
				$("#confirm_mdc").css("top",pos.top-($("#confirm_mdc").height()/2)+($(divpanier).height()/2));		
				if ($("#qo_cadre").size()>0)	{
					pos = $("#qo_cadre").position();
					$("#confirm_mdc").css("left",pos.left-($("#qo_cadre").width()/2));						
				}
				var iNombreArticleMDC;
				iNombreArticleMDC = TabReponse[1];				
				EcrireCookieMDC('NombreArticlesMDC', iNombreArticleMDC, CompteID);		
				if (iNombreArticleMDC == 1){
					$("#CompteurMDC").html(iNombreArticleMDC + "&nbsp;" + GetTrad("Article","Header"));
				}else{
					$("#CompteurMDC").html(iNombreArticleMDC + "&nbsp;" + GetTrad("Articles","Header"));
				}				
				$("#CompteurMDC").show();
				$("#TitreHeaderMdc").show();
			}
       },
	   error: function(){
		alert("Une erreur est survenue, veuillez réessayer ultérieurement");		
	   }
     });
}

function misdecoteExpress(p,cptID,divpanier,sCodeVente)
{
 	CompteID = cptID;	

	$.ajax({
       type: "GET",
       url: "/030-COMMANDE/60-10_MisDeCote.asp",
	   contentType : "application/x-www-form-urlencoded;ISO-8859-1",
       data: "Action=Ajouter&CodeVente=" + sCodeVente + "&CompteID=" + CompteID,
       success: function(msg){            
			// au cas ou d'autre parametres serais necessaires plus tard
			var TabReponse = msg.split(';'); 
            var sResult =  TabReponse[0];
			
       },
	   error: function(){
		alert("Une erreur est survenue, veuillez réessayer ultérieurement");		
	   }
     });
}

//fonction qui permet de tester si la fonction mis de côté est verouillée
function misdecote_isLocked(p)
{

	$.ajax({
       type: "GET",
	   async: false,
       url: "/030-COMMANDE/60-10_MisDeCote.asp",
	   contentType : "application/x-www-form-urlencoded;ISO-8859-1",
       data: "Action=isLocked",	   
       success: function(msg){            
			// au cas ou d'autre parametres serais necessaires plus tard
			var TabReponse = msg.split(';'); 
            var sResult =  TabReponse[0];
			
			if (sResult == '1')
			{
				pre_misdecote_lock();
			}
			else
			{
				pre_misdecote_unlock(p);
			}
       },
	   error: function(){
		alert("Une erreur est survenue, veuillez réessayer ultérieurement");		
	   }
     });
}

//fonction pour supprimer un article mis de côté donné
function Supprime_MisdeCote(p, CompteID, CodeVente)
{
	$.ajax({
       type: "GET",
       url: "/030-COMMANDE/60-10_MisDeCote.asp",
	   contentType : "application/x-www-form-urlencoded;ISO-8859-1",
       data: "Action=Supprimer&CodeVente=" + CodeVente + "&CompteID=" + CompteID + "&p=" + p,
       success: function(msg){
			var TabReponse = msg;			
            
			if (TabReponse != 'KO'){			
				$("#MisdeCote").replaceWith(TabReponse);
				var iNombreArticleMDC;
				iNombreArticleMDC = LireCookie('NombreArticlesMDC');				
				if (iNombreArticleMDC == null){
					iNombreArticleMDC = '0';					
				}
				iNombreArticleMDC = parseInt(iNombreArticleMDC) - 1 
				//EcrireCookie('NombreArticlesMDC', iNombreArticleMDC);
				EcrireCookieMDC('NombreArticlesMDC', iNombreArticleMDC, CompteID);
			}
       },
	   error: function(){
		alert("Une erreur est survenue, veuillez réessayer ultérieurement");		
	   }
     });
}

//fonction utilisée pour supprimer tous les articles mis de côté
/*
function SupprimeTout(CompteID)
{
	$.ajax({
       type: "GET",
       url: "/030-COMMANDE/60-10_MisDeCote.asp",
	   contentType : "application/x-www-form-urlencoded;ISO-8859-1",
       data: "Action=SupprimerTout&CompteID=" + CompteID,
       success: function(msg){
			var TabReponse = msg;			
            
			if (TabReponse != 'KO'){			
				$("#MisdeCote").replaceWith(TabReponse);
			}
       },
	   error: function(){
		alert("Une erreur est survenue, veuillez réessayer ultérieurement");		
	   }
     });
}*/

//fonction utilisée lors de la mise au panier de tous les articles mis de côté (on ajoute tous les produits sauf ceux indisponibles)
function SupprimeToutSaufIndispo(CompteID)
{
	$.ajax({
       type: "GET",
       url: "/030-COMMANDE/60-10_MisDeCote.asp",
	   contentType : "application/x-www-form-urlencoded;ISO-8859-1",
       data: "Action=SupprimeToutSaufIndispo&CompteID=" + CompteID,
       success: function(msg){
			var TabReponse = msg;			
            
			if (TabReponse != 'KO'){			
				$("#MisdeCote").replaceWith(TabReponse);
				EcrireCookie('NombreArticlesMDC', '0');				
			}
       },
	   error: function(){
		alert("Une erreur est survenue, veuillez réessayer ultérieurement");		
	   }
     });
}

//fonction vérifiant la disponibilité d'un code vente avant l'ajout au panier depuis les articles mis de côté
function pre_PutToPanier(p, org, codevente, reference, taille, compteID, UrlPrd)
{
	$.ajax({
		type: "GET",
		async: false,
		url: "/030-COMMANDE/60-10_MisDeCote.asp",
		contentType : "application/x-www-form-urlencoded;ISO-8859-1",
		data: "Action=Dispo&CodeVente=" + codevente + "&CompteID=" + compteID,
		success: function(msg){
			var sResult = msg.substring(0,2);
			var TabReponse = msg.substring(2,msg.length);
            
			if (sResult != 'KO'){
				PutToPanier(p, org, codevente, reference, taille, compteID, UrlPrd);
			}else{
				$("#MisdeCote").replaceWith(TabReponse);				
			}
		},
		error: function(){
			alert("Une erreur est survenue, veuillez réessayer ultérieurement");		
		}
	});
}

//fonction d'ajout au panier d'un article mis de côté
function MisdeCoteToPanier(p, org, CodeVente, Reference, taille, CompteID, Url)
{
	var iOpeId = 0;	
	var iSilhouetteId = 0
	
	$.ajax({
       type: "GET",
       url: "/030-COMMANDE/50-10_misepanier_v2.asp",
	   contentType : "application/x-www-form-urlencoded;ISO-8859-1",
       data: "MyAction=AjouterPanier&Reference=" + Reference + "&CV=" + CodeVente + "&OpeId=" + iOpeId + "&SilhouetteId=" + iSilhouetteId + "&origine="+org + "&compteid=" + CompteID + "&adresseOrigin=" + encodeURIComponent(Url),
       success: function(msg){
         var TabReponse = msg.split(';');
             var sResult =  TabReponse[0];
             var iNbArticleAjoute = TabReponse[1];
             var iNbArticleAjouteLot = TabReponse[2]; 
             var iOperationCompId = TabReponse[3]; 
             var iPanierId = TabReponse[4]; 

			 if(iOperationCompId != "0" && iPanierId != "0")RqtAjaxTestOpeComp('/030-COMMANDE/MoteurOpe/Controller.aspx','Action=TEST_OPE_COMP_FP&OperationId='+iOperationCompId+'&PanierId='+iPanierId+"&TypeLivraison=livraison_kiala_FR",'post');
             
             
			 if(sResult == '1')
			 {

                 EcrireCookie('NombreArticlesPanier',iNbArticleAjoute);			     	
				 ActualiserPanier();	
             }
       },
	   error: function(){
		alert("Une erreur est survenue, veuillez réessayer ultérieurement");		
	   }
     });
}

//fonction de mise de côté d'un article du panier
function PanierMisdeCote(CompteID, colori, taille, ProduitID, p, prixRef, PrixActuel)
{
	$.ajax({
       type: "GET",
       url: "/030-COMMANDE/60-10_MisDeCote.asp",
	   contentType : "application/x-www-form-urlencoded;ISO-8859-1",
       data: 'Action=AjouterPanier&CompteID=' + CompteID + '&Colori=' + escape(colori.replace('/','-')) + "&Taille=" + escape(taille.replace('/','-')) + "&ProduitID=" + ProduitID,
       success: function(msg){
			// au cas ou d'autre parametres serais necessaires plus tard
			var TabReponse = msg; 
            
			if (TabReponse != 'KO'){				
				$("#MisdeCote").replaceWith(TabReponse);				
				var iNombreArticleMDC;
				iNombreArticleMDC = LireCookie('NombreArticlesMDC');				
				if (iNombreArticleMDC == null){
					iNombreArticleMDC = '0';					
				}
				//EcrireCookie('NombreArticlesMDC', parseInt(iNombreArticleMDC) + 1);
				EcrireCookieMDC('NombreArticlesMDC', parseInt(iNombreArticleMDC) + 1, CompteID);
			}
			
       },
	   error: function(){
		alert("Une erreur est survenue, veuillez réessayer ultérieurement");		
	   }
     });
}

function EcrireCookieMDC(Cookie, Valeur, CompteID){
	var NbArticles;
	
	if (CompteID > 0 && (document.cookie.indexOf("NombreArticlesMDC=") < 0 || LireCookie("NombreArticlesMDC") < 0)) {
		$.ajax({
		   type: "GET",
		   url: "/030-COMMANDE/60-10_MisDeCote.asp",
		   contentType : "application/x-www-form-urlencoded;ISO-8859-1",
		   data: "Action=Count&CompteID=" + CompteID,
		   success: function(msg){
				// au cas ou d'autre parametres serais necessaires plus tard
				var TabReponse = msg.split(';'); 
				var sResult =  TabReponse[0];
				
				if (sResult == '1')
				{
					EcrireCookie("NombreArticlesMDC", TabReponse[1], date);			
					RefreshCptMDC(TabReponse[1]);
				}

		   },
		   error: function(){
			alert("Une erreur est survenue, veuillez réessayer ultérieurement");		
		   }
		 });							
	}else{
		EcrireCookie('NombreArticlesMDC', Valeur);
	}
}

function RefreshCptMDC(iNombreArticlesMDC){
	if (iNombreArticlesMDC == null || iNombreArticlesMDC == '0'){						
		$("#CompteurMDC").hide();
		$("#TitreHeaderMdc").hide();
	}else{
		if (iNombreArticlesMDC == '1'){
			$("#CompteurMDC").html("1 "+GetTrad("Article","oXMLTradRessource_Header"));
		}else{
			$("#CompteurMDC").html(iNombreArticlesMDC + " " + GetTrad("Articles","oXMLTradRessource_Header"));
		}							
		$("#CompteurMDC").css("color","white");		
		$("#TitreHeaderMdc").show();
		$("#CompteurMDC").show();
	}
}

function RqtAjaxTestOpeComp(sUrl,sParamUrl,sHttpType)
{
    if(sHttpType.toLowerCase() == 'get')
    {
        sUrl += "?" + sParamUrl;
        sParamUrl = null;
    }
    http_request = false;
    
    if (window.XMLHttpRequest) { // Mozilla, Safari,...
    http_request = new XMLHttpRequest();
    if (http_request.overrideMimeType) {
        http_request.overrideMimeType('text/xml');
    }
    } else if (window.ActiveXObject) { // IE
        try {
           http_request = new ActiveXObject("Msxml2.XMLHTTP");
        } catch (e) {
            try {
            http_request = new ActiveXObject("Microsoft.XMLHTTP");
            } catch (e) {}
        }
    }
    
    if (!http_request) {
        alert("Cannot create an XMLHTTP instance");
       return false;
    }
    http_request.onreadystatechange = alertContentsOpeComp;
    http_request.open(sHttpType, sUrl, true);
    http_request.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
    http_request.send(sParamUrl);
    return true;
}

function alertContentsOpeComp()
{
    if (http_request.readyState == 4) {
		//alert(http_request.status);
        if (http_request.status == 200) {
    
           var Xml_http_response = http_request.responseXML;
           if(Xml_http_response.getElementsByTagName("Action")[0].getAttribute("type") == "TestOpeComp")
           {
                if(Xml_http_response.getElementsByTagName("Action")[0].getAttribute("value") != 'true')
                {
                    document.getElementById("modal").innerHTML = document.getElementById("modal").innerHTML.replace("{1}",Xml_http_response.getElementsByTagName("Action")[0].getAttribute("value"));
                    showmodal();
                    //setTimeout('killmodal()',3000);
                }
           }
             
        }
             
    }

}

function whereIs(myNode)
{
 originalNode = myNode;
 x = 0;
 y = 0;
 while (myNode.tagName != 'BODY')
 {
  x += myNode.offsetLeft;
  y += myNode.offsetTop;
  myNode = myNode.offsetParent;
 }
 originalNode.magicPositionX = x;
 originalNode.magicPositionY = y;
}
function getLeft(l)
{
  if (l.offsetParent) return (l.offsetLeft + getLeft(l.offsetParent));
  else return (l.offsetLeft);
}
function getTop(l)
{
  if (l.offsetParent) return (l.offsetTop + getTop(l.offsetParent));
  else return (l.offsetTop);
}

function positionnementConfirm(p)
{
	var posPanierT = document.getElementById("blocpanierlot"+p).offsetTop;
	var posPanierL = document.getElementById("blocpanierlot"+p).offsetLeft;
	document.getElementById("confirm"+p).style.top = posPanierT;
	document.getElementById("confirm"+p).style.left = posPanierL;
	document.getElementById("confirmRuptureStock"+p).style.top = posPanierT;
	document.getElementById("confirmRuptureStock"+p).style.left = posPanierL;
}
var oOldObjImage = false;
function VgComplementaireClick(f_oObjImage,f_sReference,f_iNumeroColoris,f_iNumeroVue,f_iNumProduit,f_sTypeImage)
{
    if(!oOldObjImage)oOldObjImage = document.getElementById("ImgVc_"+eval("ColoriImageEnCours1")+"_1");
    if(oOldObjImage)oOldObjImage.className = 'VG';
    oOldObjImage = f_oObjImage;
    f_oObjImage.className = 'VGon';
    eval("ColoriImageEnCours" + f_iNumProduit + " = '"+f_iNumeroColoris+"';");
    VueEnCours = f_iNumeroVue;
	document.getElementById("imageduproduit_"+f_iNumProduit).style.visibility = "hidden";
	var monImage = new Image;
	   monImage.onload = function()
	{
	   if (f_sTypeImage == "fr")
		{
			document.getElementById("imageduproduit_"+f_iNumProduit).className = "FP_R";
			document.getElementById("imageduproduit_"+f_iNumProduit).style.marginTop = 0; 
			document.getElementById("imageduproduit_"+f_iNumProduit).style.marginBottom = 0; 
		}else{
			if(document.getElementById("imageduproduit_"+f_iNumProduit).className == "FP_R")
				document.getElementById("imageduproduit_"+f_iNumProduit).style.marginTop = 55; 

			document.getElementById("imageduproduit_"+f_iNumProduit).className = "FP";
		}
	   document.getElementById("imageduproduit_"+f_iNumProduit).src = GetUrlImage(f_iNumeroVue,f_iNumeroColoris,f_sTypeImage,f_sReference,"jpg");
	}
	   monImage.src = GetUrlImage(f_iNumeroVue,f_iNumeroColoris,f_sTypeImage,f_sReference,"jpg");
    
	document.getElementById("imageduproduit_"+f_iNumProduit).style.visibility = "visible";
	
    sUrlImgInitZoom = GetUrlImage(f_iNumeroVue,f_iNumeroColoris,f_sTypeImage,f_sReference,"jpg");
    if(TP_LBL_COL[1][f_iNumeroColoris]['lc'] != '')
    {
        document.getElementById("txtCouleur_" + f_iNumProduit).innerHTML = "- " + TP_LBL_COL[1][f_iNumeroColoris]['lc'] + " -";
        chargerInfos("couleur",""+TP_LBL_COL[1][f_iNumeroColoris]['lc']+"");
    }
    else
    {
        document.getElementById("txtCouleur_"+f_iNumProduit).innerHTML = "";
    }
    SetZoomHD(f_iNumProduit,f_iNumeroColoris,f_iNumeroVue,f_sReference);

}

function VgComplementaireClickMultiple(f_oObjImage, f_sReference, f_iNumeroColoris, f_iNumeroVue, f_iNumProduit, f_sTypeImage) {
    if (!oOldObjImage) oOldObjImage = document.getElementById("ImgVc_" + eval("ColoriImageEnCours1") + "_1");
    if (oOldObjImage) oOldObjImage.className = 'VG';
    oOldObjImage = f_oObjImage;
    f_oObjImage.className = 'VGon';
    eval("ColoriImageEnCours" + f_iNumProduit + " = '" + f_iNumeroColoris + "';");
    VueEnCours = f_iNumeroVue;
    document.getElementById("imageduproduit_0").style.visibility = "hidden";
    var monImage = new Image;
    monImage.onload = function () {
        if (f_sTypeImage == "fr") {
            document.getElementById("imageduproduit_0").className = "FPMultiple";
            document.getElementById("imageduproduit_0").style.marginTop = 0;
            document.getElementById("imageduproduit_0").style.marginBottom = 0;
        } else {
            if (document.getElementById("imageduproduit_0").className == "FP_R")
                document.getElementById("imageduproduit_0").style.marginTop = 55;

            document.getElementById("imageduproduit_0").className = "FPMultiple";
        }
        document.getElementById("imageduproduit_0").src = GetUrlImage(f_iNumeroVue, f_iNumeroColoris, f_sTypeImage, f_sReference, "jpg");
    }
    monImage.src = GetUrlImage(f_iNumeroVue, f_iNumeroColoris, f_sTypeImage, f_sReference, "jpg");

    document.getElementById("imageduproduit_0").style.visibility = "visible";

    sUrlImgInitZoom = GetUrlImage(f_iNumeroVue, f_iNumeroColoris, f_sTypeImage, f_sReference, "jpg");
    /*if (TP_LBL_COL[1][f_iNumeroColoris]['lc'] != '') {
        document.getElementById("txtCouleur_" + f_iNumProduit).innerHTML = "- " + TP_LBL_COL[1][f_iNumeroColoris]['lc'] + " -";
    }
    else {
        document.getElementById("txtCouleur_" + f_iNumProduit).innerHTML = "";
    }*/
    SetZoomHDMultiple(f_iNumProduit, f_iNumeroColoris, f_iNumeroVue, f_sReference);

}


function CPC(f_sReference,f_iNumProduit,f_iNumeroColoris,f_sTypeImage,f_iNumVue)
{
var ColoriDemande = f_iNumeroColoris;
var bImgIndispo = false;

if(!TP_IMG[f_iNumProduit][f_iNumeroColoris][f_sTypeImage])
{
    try
    {
        if(TP_IMG[f_iNumProduit]['g'][f_sTypeImage])
        {
            f_iNumeroColoris = 'g';
        }
    }
    catch(e){bImgIndispo = true;}
}

document.getElementById("Img_"+f_iNumProduit+"_"+eval('ColorisEnCours'+f_iNumProduit)).className = "couleurdroite_off";
document.getElementById("Img_"+f_iNumProduit+"_"+ColoriDemande).className = "couleurdroite_on";
eval("ColorisEnCours"+f_iNumProduit+" = '"+ColoriDemande+"';");
eval("ColoriImageEnCours"+f_iNumProduit+" = '"+f_iNumeroColoris+"';");

if(!bImgIndispo)
{
    sUrlImgInitZoom = GetUrlImage(f_iNumVue,f_iNumeroColoris,f_sTypeImage,f_sReference,"jpg");
	if(document.getElementById("imageduproduit_"+f_iNumProduit).className == "FP" || document.getElementById("imageduproduit_"+f_iNumProduit).className == "FP_R"){
	var monImage = new Image;
	document.getElementById("imageduproduit_"+f_iNumProduit).style.visibility = "hidden";
	   monImage.onload = function(){
		if(f_sTypeImage == "fr" )
				{
					document.getElementById("imageduproduit_"+f_iNumProduit).style.marginTop = 0; 
					document.getElementById("imageduproduit_"+f_iNumProduit).style.marginBottom = 0; 
					document.getElementById("imageduproduit_"+f_iNumProduit).src = GetUrlImage(f_iNumVue,f_iNumeroColoris,f_sTypeImage,f_sReference,"jpg");
					document.getElementById("imageduproduit_"+f_iNumProduit).className = "FP_R";
				}else{
					if (document.getElementById("imageduproduit_"+f_iNumProduit).className == "FP_R")
					{
						document.getElementById("imageduproduit_"+f_iNumProduit).style.marginTop = 55; 
						document.getElementById("imageduproduit_"+f_iNumProduit).style.marginBottom = 56; 
					}
					document.getElementById("imageduproduit_"+f_iNumProduit).src = GetUrlImage(f_iNumVue,f_iNumeroColoris,f_sTypeImage,f_sReference,"jpg");
					document.getElementById("imageduproduit_"+f_iNumProduit).className = "FP";
				}
			document.getElementById("imageduproduit_"+f_iNumProduit).style.visibility = "visible";
	   }
monImage.src = GetUrlImage(f_iNumVue, f_iNumeroColoris, f_sTypeImage, f_sReference, "jpg");
chargerInfos('image', ''+monImage.src+'');
		
	}else{
		document.getElementById("imageduproduit_"+f_iNumProduit).src = GetUrlImage(f_iNumVue,f_iNumeroColoris,f_sTypeImage,f_sReference,"jpg");
		document.getElementById("imageduproduit_"+f_iNumProduit).style.display = 'block';
	}
    document.getElementById("divimageindispo_"+f_iNumProduit).style.display = 'none';
    document.getElementById("imageduproduit_"+f_iNumProduit).style.display = 'block';
}
else
{   
		if(f_sTypeImage == "fr" )
				document.getElementById("divimageindispo_"+f_iNumProduit).style.marginTop = 55; 
	    document.getElementById("imageduproduit_"+f_iNumProduit).style.display = 'none';
	    document.getElementById("divimageindispo_"+f_iNumProduit).style.display = 'block';
	    document.getElementById("divimageindispo_"+f_iNumProduit).innerHTML = '<table height="100%" width="100%"><tr valign="middle" align="center"><td>'+sMsgImgColoriIndidpo+' <br/>' + TP_LBL_COL[f_iNumProduit][f_iNumeroColoris]['lc']+'</td></tr></table>';
}

SetZoomHD(f_iNumProduit,f_iNumeroColoris,f_iNumVue,f_sReference);

if(TP_LBL_COL[f_iNumProduit][f_iNumeroColoris]['lc'] != '')
{
   if(document.getElementById("txtCouleur_"+f_iNumProduit))document.getElementById("txtCouleur_"+f_iNumProduit).innerHTML = "- "+TP_LBL_COL[f_iNumProduit][f_iNumeroColoris]['lc']+" -";
   if(document.getElementById("txtCouleurM_"+f_iNumProduit))document.getElementById("txtCouleurM_"+f_iNumProduit).innerHTML = "- "+TP_LBL_COL[f_iNumProduit][f_iNumeroColoris]['lc']+" -";
}
else
{
    if(document.getElementById("txtCouleur_"+f_iNumProduit))document.getElementById("txtCouleur_"+f_iNumProduit).innerHTML = "";
    if(document.getElementById("txtCouleurM_"+f_iNumProduit))document.getElementById("txtCouleurM_"+f_iNumProduit).innerHTML = "";
}

}

function CPCMultiple(f_sReference, f_iNumProduit, f_iNumeroColoris, f_sTypeImage, f_iNumVue) {
    var ColoriDemande = f_iNumeroColoris;
    var bImgIndispo = false;
	try{
		if (!TP_IMG[f_iNumProduit][f_iNumeroColoris][f_sTypeImage]) {
			try {
				if (TP_IMG[f_iNumProduit]['g'][f_sTypeImage]) {
					f_iNumeroColoris = 'g';
				}
			}
			catch (e) { bImgIndispo = true; }
		}
	}
	catch (e1) {}
	if (f_iNumProduit == 0) {f_iNumProduit = f_iNumProduit + 1;}
    document.getElementById("Img_" + f_iNumProduit + "_" + eval('ColorisEnCours' + f_iNumProduit)).className = "couleurdroite_off";    	
	document.getElementById("Img_" + f_iNumProduit + "_" + ColoriDemande ).className = "couleurdroite_on";
    eval("ColorisEnCours" + f_iNumProduit + " = '" + ColoriDemande + "';");
    eval("ColoriImageEnCours" + f_iNumProduit + " = '" + f_iNumeroColoris + "';");

	if (f_iNumProduit == 0)
	{
    if (!bImgIndispo) {
        sUrlImgInitZoom = GetUrlImage(f_iNumVue, f_iNumeroColoris, f_sTypeImage, f_sReference, "jpg");
        if (document.getElementById("imageduproduit_0").className == "FP" || document.getElementById("imageduproduit_0").className == "FP_R") {
            var monImage = new Image;
            document.getElementById("imageduproduit_0").style.visibility = "hidden";
            monImage.onload = function () {
                if (f_sTypeImage == "fr") {
                    document.getElementById("imageduproduit_0").style.marginTop = 0;
                    document.getElementById("imageduproduit_0").style.marginBottom = 0;
                    document.getElementById("imageduproduit_0").src = GetUrlImage(f_iNumVue, f_iNumeroColoris, f_sTypeImage, f_sReference, "jpg");
                    document.getElementById("imageduproduit_0").className = "FP_R";
                } else {
                    if (document.getElementById("imageduproduit_0").className == "FP_R") {
                        document.getElementById("imageduproduit_0").style.marginTop = 55;
                        document.getElementById("imageduproduit_0").style.marginBottom = 56;
                    }
                    document.getElementById("imageduproduit_0").src = GetUrlImage(f_iNumVue, f_iNumeroColoris, f_sTypeImage, f_sReference, "jpg");
                    document.getElementById("imageduproduit_0").className = "FP";
                }
                document.getElementById("imageduproduit_0").style.visibility = "visible";
            }
            monImage.src = GetUrlImage(f_iNumVue, f_iNumeroColoris, f_sTypeImage, f_sReference, "jpg");

        } else {
            document.getElementById("imageduproduit_0").src = GetUrlImage(f_iNumVue, f_iNumeroColoris, f_sTypeImage, f_sReference, "jpg");
            document.getElementById("imageduproduit_0").style.display = 'block';
        }
        document.getElementById("divimageindispo_" + f_iNumProduit).style.display = 'none';
        document.getElementById("imageduproduit_0").style.display = 'block';
    }
    else {
        if (f_sTypeImage == "fr")
            document.getElementById("divimageindispo_" + f_iNumProduit).style.marginTop = 55;
        document.getElementById("imageduproduit_0").style.display = 'none';
        document.getElementById("divimageindispo_" + f_iNumProduit).style.display = 'block';
        document.getElementById("divimageindispo_" + f_iNumProduit).innerHTML = '<table height="100%" width="100%"><tr valign="middle" align="center"><td>' + sMsgImgColoriIndidpo + ' <br/>' + TP_LBL_COL[f_iNumProduit][f_iNumeroColoris]['lc'] + '</td></tr></table>';
    }
		SetZoomHDMultiple(f_iNumProduit, f_iNumeroColoris, f_iNumVue, f_sReference);
	}
	
	try{
    if (TP_LBL_COL[f_iNumProduit][f_iNumeroColoris]['lc'] != '') {
        if (document.getElementById("txtCouleur_" + f_iNumProduit)) document.getElementById("txtCouleur_" + f_iNumProduit).innerHTML = "- " + TP_LBL_COL[f_iNumProduit][f_iNumeroColoris]['lc'] + " -";
        if (document.getElementById("txtCouleurM_" + f_iNumProduit)) document.getElementById("txtCouleurM_" + f_iNumProduit).innerHTML = "- " + TP_LBL_COL[f_iNumProduit][f_iNumeroColoris]['lc'] + " -";
    }
    else {
        if (document.getElementById("txtCouleur_" + f_iNumProduit)) document.getElementById("txtCouleur_" + f_iNumProduit).innerHTML = "";
        if (document.getElementById("txtCouleurM_" + f_iNumProduit)) document.getElementById("txtCouleurM_" + f_iNumProduit).innerHTML = "";
    }
	}
	catch (e2){}
}

function AutresVuesClick(f_oObjImage,f_iNumProduit,f_sReference,f_sTypeImage)
{
    if(!oOldObjImage)oOldObjImage = document.getElementById("ImgVc_"+eval("ColoriImageEnCours1")+"_1");
    var bBouble = true;
    for(var i=0;i < TabListNumeroColoris.length;i++)
    {   
		try
		{
			if(TP_IMG[f_iNumProduit][TabListNumeroColoris[i]][f_sTypeImage])
			{
            var ListVue = TP_IMG[f_iNumProduit][TabListNumeroColoris[i]][f_sTypeImage].split(';');
            
				if(ListVue.length > 1)
				{

                for(var j=0;j<ListVue.length;j++)
					{
					
	                    if(((TabListNumeroColoris[i] != eval('ColoriImageEnCours' + f_iNumProduit) || eval('VueEnCours'+f_iNumProduit) != ListVue[j]) && bBouble) && i != TabListNumeroColoris.length && (j >= eval('IndexEnCours'+f_iNumProduit) || TabListNumeroColoris[i] != eval('ColoriImageEnCours' + f_iNumProduit)))
						{
	                                bBouble = false;
	                                eval("IndexEnCours"+f_iNumProduit+" = "+j+";");
	                                eval("VueEnCours"+f_iNumProduit+" = "+ ListVue[j]+";");
	                                eval("ColoriImageEnCours" + f_iNumProduit + " = '" + TabListNumeroColoris[i]+"';");
	                                if(oOldObjImage)oOldObjImage.className = 'VG';
	                                oOldObjImage = document.getElementById("ImgVc_"+TabListNumeroColoris[i]+"_"+ListVue[j]);
	                                if(document.getElementById("ImgVc_"+TabListNumeroColoris[i]+"_"+ListVue[j]))document.getElementById("ImgVc_"+TabListNumeroColoris[i]+"_"+ListVue[j]).className = 'VGon';
	                                document.getElementById("imageduproduit_"+f_iNumProduit).src = GetUrlImage(eval('VueEnCours'+f_iNumProduit),eval('ColoriImageEnCours' + f_iNumProduit),f_sTypeImage,f_sReference,"jpg");
	                                sUrlImgInitZoom = GetUrlImage(eval('VueEnCours'+f_iNumProduit),eval('ColoriImageEnCours' + f_iNumProduit),f_sTypeImage,f_sReference,"jpg");
	                                SetZoomHD(f_iNumProduit,TabListNumeroColoris[i],ListVue[j],f_sReference);
									
	                                
						}
					}
				}
			}
		}
		catch(e)
		{
		}
    }
    if(bBouble)
    {    
           eval("ColoriImageEnCours" + f_iNumProduit+" = '"+TabListNumeroColoris[0]+"';");
           eval('VueEnCours'+f_iNumProduit+' = 1;');
           eval('IndexEnCours'+f_iNumProduit+' = 0');
           if(oOldObjImage)oOldObjImage.className = 'VG';
           oOldObjImage = document.getElementById("ImgVc_"+TabListNumeroColoris[0]+"_1");
           if(document.getElementById("ImgVc_"+TabListNumeroColoris[0]+"_1"))document.getElementById("ImgVc_"+TabListNumeroColoris[0]+"_1").className = 'VGon';
           document.getElementById("imageduproduit_"+f_iNumProduit).src = GetUrlImage(eval('VueEnCours'+f_iNumProduit),eval('ColoriImageEnCours' + f_iNumProduit),f_sTypeImage,f_sReference,"jpg");
           SetZoomHD(f_iNumProduit,TabListNumeroColoris[0],1,f_sReference);
    }  
}

function SetZoomHD(f_iNumProduit,f_iNumeroColoris,f_iNumeroVue,f_sReference)
{
    if ((TP_IMG[f_iNumProduit][f_iNumeroColoris]['zc'] && f_iNumeroVue > 0) || (TP_IMG[f_iNumProduit][f_iNumeroColoris]['zcm'] && f_iNumeroVue == 0))
    {
	
        document.getElementById("imageduproduit_"+f_iNumProduit).onclick = function() 
        {
            PopEx('imageduproduit_'+f_iNumProduit,'0A','0A',0,null,80,'PopBoxImageLarge');
        }
	    sUrlImgZomHD = GetUrlImage(f_iNumeroVue,f_iNumeroColoris,'zc',f_sReference,"jpg");
	    document.getElementById("imageduproduit_"+f_iNumProduit).pbsrc = sUrlImgZomHD;
	    document.getElementById("imageduproduit_"+f_iNumProduit).setAttribute('pbsrc',sUrlImgZomHD);
	    InitPbSrc();
	    if(document.getElementById("PictoZoom"+f_iNumProduit))document.getElementById("PictoZoom"+f_iNumProduit).style.display = "block";
	    if(document.getElementById("pictozoomM"+f_iNumProduit))document.getElementById("pictozoomM"+f_iNumProduit).style.display = "block";
		document.getElementById("imageduproduit_"+f_iNumProduit).style.cursor = "pointer";
    }
    else
    {
		document.getElementById("imageduproduit_"+f_iNumProduit).style.cursor = "default";
        document.getElementById("imageduproduit_"+f_iNumProduit).onclick = '';
		document.getElementById("imageduproduit_"+f_iNumProduit).setAttribute('onclick','');
        if(document.getElementById("PictoZoom"+f_iNumProduit))document.getElementById("PictoZoom"+f_iNumProduit).style.display = "none";
        if(document.getElementById("pictozoomM"+f_iNumProduit))document.getElementById("pictozoomM"+f_iNumProduit).style.display = "none";
		
    }
}


function SetZoomHDMultiple(f_iNumProduit, f_iNumeroColoris, f_iNumeroVue, f_sReference) {
    try{
    if ((TP_IMG[f_iNumProduit][f_iNumeroColoris]['zc'] && f_iNumeroVue > 0) || (TP_IMG[f_iNumProduit][f_iNumeroColoris]['zcm'] && f_iNumeroVue == 0)) {

        document.getElementById("imageduproduit_0").onclick = function () {
            PopEx('imageduproduit_0', '0A', '0A', 0, null, 80, 'PopBoxImageLarge');
        }
        sUrlImgZomHD = GetUrlImage(f_iNumeroVue, f_iNumeroColoris, 'zc', f_sReference, "jpg");
        document.getElementById("imageduproduit_0").pbsrc = sUrlImgZomHD;
        document.getElementById("imageduproduit_0").setAttribute('pbsrc', sUrlImgZomHD);
        InitPbSrc();
        if (document.getElementById("PictoZoom" + f_iNumProduit)) document.getElementById("PictoZoom" + f_iNumProduit).style.display = "block";
        if (document.getElementById("pictozoomM" + f_iNumProduit)) document.getElementById("pictozoomM" + f_iNumProduit).style.display = "block";
        document.getElementById("imageduproduit_0").style.cursor = "pointer";
    }
    else {
        document.getElementById("imageduproduit_0").style.cursor = "default";
        document.getElementById("imageduproduit_0").onclick = '';
        document.getElementById("imageduproduit_0").setAttribute('onclick', '');
        if (document.getElementById("PictoZoom" + f_iNumProduit)) document.getElementById("PictoZoom" + f_iNumProduit).style.display = "none";
        if (document.getElementById("pictozoomM" + f_iNumProduit)) document.getElementById("pictozoomM" + f_iNumProduit).style.display = "none";

		}
	}
	catch (e) {}
}


var sMatriceUrlImage = '/Shared/Images/Produits_NF_V2/{3}{1}/{5}/{2}/{4}_{2}_{3}{1}.{6}';
function GetUrlImage(f_NumVue,f_NumColoris,f_TypeImage,f_Reference,f_Extension)
{
var sUrlImage = sMatriceUrlImage;

if(f_NumVue == 0 && (f_TypeImage == 'vc' || f_TypeImage=='fc' || f_TypeImage=='zc' || f_TypeImage == 'vr' || f_TypeImage=='fr' || f_TypeImage=='zr' )) 
{
f_NumVue = '';
f_TypeImage = f_TypeImage + 'm';
}

sUrlImage = sUrlImage.replace('{1}',f_NumVue)
sUrlImage = sUrlImage.replace('{1}',f_NumVue)

sUrlImage = sUrlImage.replace('{2}',f_NumColoris)
sUrlImage = sUrlImage.replace('{2}',f_NumColoris)

sUrlImage = sUrlImage.replace('{3}',f_TypeImage)
sUrlImage = sUrlImage.replace('{3}',f_TypeImage)

sUrlImage = sUrlImage.replace('{4}',f_Reference)
sUrlImage = sUrlImage.replace('{5}',f_Reference.substring(0,2))
sUrlImage = sUrlImage.replace('{6}',f_Extension)

return sUrlImage;
}


var sReference = '';
var iNumProduit = 0;
function InitZoom(f_sReference,f_iNumProduit)
{
sReference = f_sReference;
iNumProduit = f_iNumProduit;
}

function func_OnMouseOver(f_iNumProduit,f_iNumeroColoris)
{
    if(f_iNumeroColoris != eval('ColorisEnCours'+f_iNumProduit))
    {
        document.getElementById('Img_'+f_iNumProduit+'_'+f_iNumeroColoris).className = 'couleurdroite_over';
    }
}

function func_OnMouseOut(f_iNumProduit,f_iNumeroColoris)
{
    if(f_iNumeroColoris != eval('ColorisEnCours'+f_iNumProduit))
    {
        document.getElementById('Img_'+f_iNumProduit+'_'+f_iNumeroColoris).className = 'couleurdroite_off';
    }
}


function func_OnMouseOverTaille(f_iNumProduit,f_iNumeroTaille)
{
    if(f_iNumeroTaille != eval('TailleEnCours'+f_iNumProduit))
    {
        document.getElementById('dc'+f_iNumProduit+f_iNumeroTaille).className = 'dispoOver';
    }
}

function func_OnMouseOutTaille(f_iNumProduit,f_iNumeroTaille)
{
    if(f_iNumeroTaille != eval('TailleEnCours'+f_iNumProduit))
    {   
        document.getElementById('dc'+f_iNumProduit+f_iNumeroTaille).className = 'dispoOff';
    }   
}

function func_OnMouseOverTaille2(f_iNumProduit,f_iNumeroTaille)
{
    if(f_iNumeroTaille != eval('TailleEnCours'+f_iNumProduit))
    {
        document.getElementById('dc'+f_iNumProduit+f_iNumeroTaille).className = 'dispoOver2';
    }
}

function func_OnMouseOutTaille2(f_iNumProduit,f_iNumeroTaille)
{
    if(f_iNumeroTaille != eval('TailleEnCours'+f_iNumProduit))
    {   
        document.getElementById('dc'+f_iNumProduit+f_iNumeroTaille).className = 'dispoOff2';
    }   
}



function showmodal()
{
//on rend le bouton close actif
// $(".modal_close").click(killmodal);
//On calcul pour positionner la modal au milieu de la page
var top = $(window).scrollTop()+($(window).height()/2)-(120)-($(".modal").height()/2);
var left = ($(window).width()/2)-($(".modal").width()/2);
//alert ("hauteur"+top);
//alert ("largeur"+left);
//$(".modal").bgiframe();
$(".modal").css({
  top : top+"px",
  left : left+"px"
});

//On cree la black box, on l'insere dans le body, on fade, puis on fade la modale
$('<div class="black_box" style="filter: alpha(opacity=40);"></div>').css({zIndex:1002,width: $(window).width(), height: $(document).height()}).appendTo(document.body).fadeIn("slow",function(){$(".modal").fadeIn("slow");});
//$(".modal, black_box").bgiframe();
}

//Fermeture de la modal
function killmodal()
{
//Fondu de la black box puis de la modal et on detruit la black box
$('.modal').fadeOut("slow",function(){$(".black_box").fadeOut("slow",function(){$('.black_box').remove()})});
}	

function bt_help_on(p){
    document.getElementById('result_aide'+p).style.display="";
}
function bt_help_off(p){
    document.getElementById('result_aide'+p).style.display="none";
}
	


