/******************************/
/***	public methods		***/
/******************************/
var tab_mag = null;
var displayBtn = null;
var tab_visibilite = null;
var tab_dispo = null;
var notDispoStr = 'expedition_comparateur_maga.gif';
var epuiseStr= 'expedition_comparateur_epuise.gif';
var lQryStr = null;
var pathImg ='/wcsstore/Darty/fr_FR/pix/';
var ongletAcc = false;
var pageUnivers = null;

function getPictoModeLivraison(codeUnivers, isDispo, isDeliverable, isForwardable, isExclusifInternet) {
	var picto = '';
	if (isDispo==0 || isDispo==-1) {
		if (!isExclusifInternet) {
			picto = 'fiche/non_dispo.gif';
		}
	} else if (isDeliverable) {
		picto = codeUnivers + '/camion.gif';	
	} else if (isForwardable) {
		picto = codeUnivers + '/carton.gif';		
	}
	if (picto != '') {
		picto = pathImg + 'ficheproduit/' + picto;		
	}
	return (picto!='' ? '<img src="' + picto + '" />' : '');
}

function getLibelleDispo(product_number, isExclusifInternet)  {	
	var isDispo = (tab_dispo[product_number][0]==1);
	var txtDispo = tab_dispo[product_number][1];
	var isStock = (txtDispo.indexOf('24h')>0);
	var libelle = '&nbsp;';
	if (!isDispo) {
		if (isExclusifInternet) {
			libelle = '<p class="indisponibilite"><b>Epuis&eacute;</b></p>';
		} else {
			libelle = '<p class="indisponibilite">Mod&egrave;le indisponible en ligne</p>';
		}
	} else if (isStock) {
		libelle = '<p class="disponibilite">En stock</p>';
	}
	return libelle;
}

function getHTMLDispo(product_number, catentryId, isExclusifInternet)  { 
	var isDispo = (tab_dispo[product_number][0]==1);
	var gifDispo = tab_dispo[product_number][1];
	var isStock = (gifDispo.indexOf('24h') != -1);
	var libelle = '&nbsp;';
	if (!isDispo) {
		if (!isExclusifInternet) {
			libelle = 'Expos&eacute; dans certains magasins <br>' + getVoirLesquels('Voir lesquels', catentryId, '', '');		
		}
	} else {
		libelle = gifDispoToHTML(gifDispo, catentryId);
	}
	return libelle;
}


function gifDispoToHTML(gif, catentryId) {
	var html = '';
	var tabGif = new Array('_24h', '_5j', '_10j', '_15j', '_2s', '_3s');
	var tabLib = new Array('sous 24 heures', 'sous 5 jours', 'sous 10 jours', 'sous 15 jours', 'sous 15 jours', 'sous 3 semaines');
	var tabPageExp = new Array('expedie_24h.htm', 'expedie_5j.htm', 'expedie_10j.htm', 'expedie_15j.htm', 'expedie_15j.htm', 'expedie_15j.htm');	
	var isLivrable = (gif.indexOf('livre') != -1);
	var isStock = (gif.indexOf('24h')!= -1 );	
	var myindex = null;
	for (var i=0; i<tabGif.length; i++) {
		if (gif.indexOf(tabGif[i])>0) {
			myindex = i;
			break;
		}
	}
	if (myindex != null  && myindex >=0 ) {
	
		if (isLivrable) {
			html = '';
			if (isStock) {
				 html += getQuandPuisJeEtreLivre('Livraison gratuite', catentryId, 'livraison');
			} else {
				html += getQuandPuisJeEtreLivre('Livr&eacute; ' + tabLib[myindex], catentryId, 'livraison');
			}
			html += '<br><span class="sml1red">(m&ecirc;me le dimanche)</span><br>' + getQuandPuisJeEtreLivre('Voir les dates de livraison', catentryId);
		} else {
			//var _url = "/wcsstore/Darty/fr_FR/html/content/popupExp/" + tabPageExp[myindex];
			//var _link = '<a href="javascript:void(0)" onClick="javascript:PopUp(\'' + _url + '\',\'poplivraison\',\'scrollbars=yes,width=540,height=500\')"';			
			//html = _link + ' class="livraison">Exp&eacute;di&eacute; ' + tabLib[myindex] + '</a><br>' + _link + '>Livr&eacute; par colissimo</a><br><span class="sml1">(d&eacute;lai moyen 48h)</span>';
			html = getPopupExpedition('Exp&eacute;di&eacute; ' + tabLib[myindex], 'livraison') + '<br>' +
				   getPopupExpedition('Livr&eacute; par colissimo', 'none') + 
				   '<br><span class="sml1">(d&eacute;lai moyen 48h)</span>';
		}		
	}
	return html;
}

function getImageDispo(img, codeUnivers) {
	if (codeUnivers || (codeUnivers == 0)){
		return '<img src=' + pathImg + codeUnivers + '/' + img + '>';
	} else {		
		return '<img src=' + pathImg + '/' + img + '>';
	}	
}

function getVoirLesquels(libelleOuImage, catentryId, sClass, strWrap) {
	if(sClass && sClass != '') 
		sClass = ' class="'+sClass+'" ';
	else 
		sClass='';
		
	var doWrap = true;
	if (strWrap == '') {
		doWrap = false;
	}	
	if (doWrap) {
		strWrap = ' style="white-space: nowrap;"';
	}	
	var ret = '<a href="javascript:void(0)" onClick="javascript:PopUp(\'' + getExpoUrl() + '&catentryId='+catentryId+'#\',\'popnear\',\'scrollbars=yes,width=560,height=550\')"' + strWrap + ' ' + sClass + '>' + libelleOuImage + '</a>';
	return ret;
}

function getQuandPuisJeEtreLivre(libelleOuImage, catentryId, sClass) {
	// getUnivers() est definie dans header.jsp
	var univers = getUnivers();
	var _url = curHttpServletURI2+"DartyLivraisonView?u=" + univers + "&storeId=10001";
	var onClickStr = 'xt_med("C","Fiche produit","lien_quand_puis_je_etre_livre","N")';
	return '<a href="javascript:void(0)" onClick="javascript:PopUp(\'' + _url + '&catentryId='+catentryId+'\',\'poplivraison\',\'scrollbars=yes,width=400,height=530\');xt_med(\'C\',\'Fiche produit\',\'lien_quand_puis_je_etre_livre\',\'N\')"' +  (sClass==null ? "" : " class=" + sClass) + '>' + libelleOuImage + '</a>';
}

function getPopupExpedition(libelleOuImage, sclass) {	
	if (!sclass) sclass = 'LinkMedium';
	var _page = "";	
	if (libelleOuImage.toLowerCase().indexOf('exp') !=-1 || libelleOuImage.indexOf('Livr&eacute; par colissimo') != -1) {
		_page = "expedie_24h.htm";
	}
	var _url = "/wcsstore/Darty/fr_FR/html/content/popupExp/" + _page;
	if (_page != "")
		return '<a href="javascript:void(0)" onClick="javascript:PopUp(\'' + _url + '\',\'poplivraison\',\'scrollbars=yes,width=555,height=410\')"' + (sclass!='none' ? ' class="' + sclass + '"' : '') + ' >' + libelleOuImage + '</a>';		
	else 
		return libelleOuImage;
}

function getExpoUrl() {
	//var expoUrl = "/webapp/wcs/stores/servlet/DartyPreferedStoresController?storeId=10001&URL=DartyPreferedStoresPopupView&ACTION=6&icp=1&PRODUCTFILTER=true"
	var expoUrl = "/webapp/wcs/stores/servlet/DartyPreferedStoresPopupView?storeId=10001";		
	var lQryStr = getLocationQueryString();
	expoUrl = expoUrl + "&" + lQryStr;
	lQryStr = lQryStr.replace(/#/, '')
	return expoUrl;
}

function getLinkImageDispo(libelleOuImage, catentryId) {
	var _url = libelleOuImage;
	
	if (libelleOuImage.indexOf('mag') != -1) {
		_url = getVoirLesquels(libelleOuImage, catentryId);
	} else if (libelleOuImage.indexOf('exp') != -1) {
		_url= getPopupExpedition(libelleOuImage);
	} else if (libelleOuImage.indexOf('dispo') != -1) {
		_url = getQuandPuisJeEtreLivre(libelleOuImage, catentryId);
	}
	else {
		_url = libelleOuImage;
	}
	return _url;
}

function getLinkImageDispo2(libelleOuImage, catentryId) {
	var _url = libelleOuImage;
	
	if (libelleOuImage.indexOf('mag') != -1) {
		_url = getVoirLesquels(libelleOuImage, catentryId);
	} else if (libelleOuImage.indexOf('exp') != -1) {
		_url= getPopupExpedition(libelleOuImage);
	} else if (libelleOuImage.indexOf('dispo') != -1) {
		_url = getQuandPuisJeEtreLivre(libelleOuImage, catentryId);
	} else if (libelleOuImage.indexOf('livre') != -1) {
		_url = getQuandPuisJeEtreLivre(libelleOuImage, catentryId);
	}
	else {
		_url = libelleOuImage;
	}
	return _url;
}
function getCompareStyle(product_number, onlineOnly, addLink, catentryId, isPriceApprox, isExclusifInternet, codeUnivers, dayOneAvailibility, sClass) { //comparateur Magasins
	ongletAcc = false;
	returnString = "";
	if (catentryId.indexOf('A')!=-1){
		catentryId = catentryId.replace(/A/, '')		
		ongletAcc = true;
		pageUnivers = codeUnivers;
	}
	if (tab_dispo != null) {
		//returnString	= <font class="TextSmall">';
		if(tab_dispo[product_number][0] != -1) {
			if(tab_dispo[product_number][0] == 0) {
				if (isExclusifInternet) {
					returnString += getImageDispo(epuiseStr, codeUnivers);				
				} else {
					returnString += getVoirLesquels(getImageDispo(notDispoStr, codeUnivers), catentryId);
					returnString += getVoirLesquels("Voir Lesquels", catentryId, sClass) ;
				}
			} else {
				if (dayOneAvailibility && dayOneAvailibility !='null') {
					returnString += tab_dispo[product_number][1];
				} else {
					returnString += getLinkImageDispo(getImageDispoOnline(tab_dispo[product_number],addLink, 'linksmall', onlineOnly, isPriceApprox, codeUnivers), catentryId);				
				}			
				//if(isExclusifInternet) {
				//	if(sClass) sClass = ' class="'+sClass+'" ';
				//	else sClass="";				
				//	returnString += '<a href="javascript:void(0);" style="white-space: nowrap;" ' + sClass + '>Exclusivit&eacute; Internet</a>';
				//}						
			}

		} else {
			if(!isExclusifInternet) {
	//			returnString	+= getExpoCodePrest(product_number, 'linksmall', catentryId, false);
				returnString += getVoirLesquels(getImageDispo(notDispoStr, codeUnivers), catentryId);
				returnString += getVoirLesquels("Voir Lesquels", catentryId) ;
		}
		}
		//returnString	+= '</font>';
	}
	return returnString;
}

function getCompareStyle2(product_number, onlineOnly, addLink, catentryId, isPriceApprox, isExclusifInternet, codeUnivers, dayOneAvailibility, sClass) { //comparateur Magasins
	returnString = "";
	if (tab_dispo != null) {
		if(tab_dispo[product_number][0] != -1) {
			if(tab_dispo[product_number][0] == 0) {
				if (isExclusifInternet) {
					returnString += getImageDispo(epuiseStr, codeUnivers);				
				} else {
					returnString += getVoirLesquels(getImageDispo(notDispoStr, codeUnivers), catentryId);
				}
			} else {
				if (dayOneAvailibility && dayOneAvailibility !='null') {
					returnString += tab_dispo[product_number][1];
			} else {
					returnString += getLinkImageDispo2(getImageDispoOnline(tab_dispo[product_number],addLink, 'linksmall', onlineOnly, isPriceApprox, codeUnivers), catentryId);				
				}			
			}

		} else {
			if(!isExclusifInternet) {
				returnString += getVoirLesquels(getImageDispo(notDispoStr, codeUnivers), catentryId);
		}
		}
	}	
	return returnString;
}

function getCompareStyleNotDispo(product_number, onlineOnly, addLink, catentryId) { //comparateur Magasins
	returnString = "";
	if (tab_dispo!=null){
		//returnString	= '<font class="TextSmall">';
		returnString	+= notDispoStr;
		returnString	+= '<br><br>';
		returnString	+= getExpo(product_number, 'linksmall', catentryId, false);
		//returnString	+= '</font>';
	}
	return returnString;
}

function getAccessoryStyle_part1(product_number, catentryId) { //accessoire Magasins
	//returnString	= '<font class="TextSmall">';
	returnString	= getExpo(product_number, 'linksmall', catentryId, true);
	//returnString	+= '</font>';
	
	return returnString;
}

function getAccessoryStyle_part1_CodePrest(product_number, catentryId) { //accessoire Magasins
	returnString	= ''; //<font class="TextSmall">';
	returnString	+= getExpoCodePrest(product_number, 'linksmall', catentryId, true);
	//returnString	+= '</font>';
	
	return returnString;
}

function getAccessoryStyle_part2(product_number, onlineOnly, addLink) { //accessoire dispo
	returnString = "";
	if (tab_dispo!=null){
		//returnString	= '<font class="TextSmall">';
		if(tab_dispo[product_number][0] == 0) returnString	+= notDispoStr;
		else returnString	+= getDispoOnline(tab_dispo[product_number],addLink, 'linksmall',onlineOnly);
		//returnString	+= '</font>';
	}
	return returnString;
}

function getCompareStyle_part1(product_number, catentryId) { //adv comparateur
	returnString	= ''; //<font class="TextSmall">';
	returnString	+= getExpo(product_number, 'linksmall', catentryId, false);
	//returnString	+= '</font>';
	
	return returnString;
}

// DC affichage de l'image au lieu du lien
function getCompareStyle_part1_CodePrest(product_number, catentryId,codeUnivers) { //adv comparateur
	returnString	= '' ; //<font class="TextSmall">';
	//returnString	+= getExpoCodePrest(product_number, 'linksmall', catentryId, false);
	//returnString	+= '</font>';
	returnString	+= getExpoCodePrestImage(product_number, 'linksmall', catentryId, false,codeUnivers);
	return returnString;
}

function getCompareStyle_part2(codeUnivers,product_number, isPriceApprox) { //adv dispo
	returnString = "";
	if (tab_dispo!=null){
		//returnString	= '<font class="TextSmall">';
		if(tab_dispo[product_number][0] == 0) {
			returnString += getImageDispo(notDispoStr,codeUnivers);
			returnString += '<br>' + getVoirLesquels();
		}	
		else returnString	+= getImageDispoOnline(tab_dispo[product_number],0, '','', isPriceApprox,codeUnivers);
		//returnString	+= '</font>';
	}
	return returnString;
}

function getCompareStyle_part2NotDispo(product_number) { //adv dispo
	returnString = "";
	if (tab_dispo!=null){
		returnString	= '<font class="TextSmall">';
		returnString	+= notDispoStr;
		returnString	+= '</font>';
	}
	return returnString;
}

function getLivrableStyle_top_part1(product_number, catentryId) { //Fiche Produit Magasin
	returnString	= '<font class="TableItem">';
	returnString	+= getExpo(product_number, 'LinkBigStrong', catentryId, false);
	returnString	+= '</font>';
	
	return returnString;
}

// TYU : Cas code prestation
// DC : affichage de l'image
function getLivrableStyle_top_part1_CodePrest(product_number, catentryId ,codeUnivers) { //Fiche Produit Magasin
	returnString	= '';//'<font class="TableItem">';
	//returnString	+= getExpoCodePrest(product_number, 'LinkBigStrong', catentryId, false);
	//returnString	+= '</font>';
	returnString	+= getExpoCodePrestImage(product_number, 'LinkBigStrong', catentryId, false,codeUnivers);
	return returnString;
}

function getLivrableStyle_top_part2(product_number) { //Fiche produit dispo
	returnString = "";
	if (tab_dispo!=null){
		returnString	= '<font class="Textbig">';
		if(tab_dispo[product_number][0] == 0) returnString	+= notDispoStr;
		else returnString	+= getDispoOnline(tab_dispo[product_number],0, '','');
		returnString	+= '</font>';
	}	
	return returnString;
}

function getLivrableStyle_bottom_part1(product_number, catentryId) { //cross-selling magasins
	returnString	= '<font class="TextSmall">';
	returnString	+= getExpo(product_number, 'linksmall', catentryId, false);
	returnString	+= '</font>';
	return returnString;
}

function getLivrableStyle_bottom_part2(product_number, codeUnivers, dayOneAvailibility, isExclusifInternet) { //cross seling dispo
	var returnString = "";
	/*if (tab_dispo!=null){
		returnString	= '<font class="TextSmall">';
		if(tab_dispo[product_number][0] == 0) returnString	+= notDispoStr;
		else returnString	+= getDispoOnline(tab_dispo[product_number],0, '','');
		returnString	+= '</font>';
	}*/
	if (tab_dispo!=null){
		if ((tab_dispo[product_number][0] == 0) && isExclusifInternet) {
			 returnString += getImageDispo(epuiseStr, codeUnivers);			
		 } else {
			if (dayOneAvailibility && dayOneAvailibility != 'null') {
				returnString += "<font color='#FFFFFF'>";
				returnString += tab_dispo[product_number][1];
				returnString += "</font>";
			} else {
				returnString += getImageDispoOnline(tab_dispo[product_number],0, '', '', '', codeUnivers);
			}
		}
	}
	return returnString;
	
}


/******************************/
/***	Privates methods	***/
/******************************/
function getImage(etatDispo) {
	var imgString = "";
	
	if (etatDispo) {
		imgString = '<img src="'+langPath+'images/oui.gif" width="14" height="14">';
	} else {
		imgString = '<img src="'+langPath+'images/non.gif" width="14" height="14">';
	}
	
	return imgString;
}

function getDispoOnline(tabProductDispo, addLink, linkStyle, onlineOnly, isPriceApprox) {
	var dispoString = "";
	
	if (isPriceApprox == true){		
		if (tabProductDispo[0]) {		
			if (addLink) {
				dispoString = '<a href="javascript:void(0)" class="' + linkStyle + '" onClick="javascript:PopUp(\'DartyProductOnLineView?storeId=10001&priceApprox=1&onLineOnly='+onlineOnly+'\',\'popdispo\',\'width=320,height=280\',\'\',\'width=320,height=280\')">Disponible au <br><span style="font-size:11px; font-weight:bold;"><b>0825 350 340</b></span> (0,15 eur/min) :</a><br>';
			} else {
				dispoString = 'Disponible au <br><span style="font-size:11px; font-weight:bold;"><b>0825 350 340</b></span> (0,15 eur/min) :<br>';
			}
			
			dispoString += getImage(tabProductDispo[0]);		
			dispoString += tabProductDispo[1];
		}else{
			dispoString = notDispoStr;
		}
	} else {
		/*if (addLink) {
			dispoString = '<a href="javascript:void(0)" class="' + linkStyle + '" onClick="MM_openBrWindow(\'DartyProductOnLineView?storeId=10001&onLineOnly='+onlineOnly+'\',\'popdispo\',\'width=320,height=280\',\'\',\'width=320,height=280\')">Disponible en ligne :</a><br>';
		} else {
			dispoString = 'Disponible en ligne :<br>';
		}*/
		
		//dispoString += getImage(tabProductDispo[0]);
		dispoString += tabProductDispo[1];
	}
	
	return dispoString;
}

function getImageDispoOnline(tabProductDispo, addLink, linkStyle, onlineOnly, isPriceApprox, codeUnivers) {
	var dispoString = "";
	
	if (isPriceApprox == true){		
		if (tabProductDispo[0]) {		
				
			dispoString += getImageDispo(tabProductDispo[1], codeUnivers);
		}else{
			dispoString = getImageDispo(notDispoStr, codeUnivers)+ getVoirLesquels();
		}
	} else {
		/*if (addLink) {
			dispoString = '<a href="javascript:void(0)" class="' + linkStyle + '" onClick="MM_openBrWindow(\'DartyProductOnLineView?storeId=10001&onLineOnly='+onlineOnly+'\',\'popdispo\',\'width=320,height=280\',\'\',\'width=320,height=280\')">Disponible en ligne :</a><br>';
		} else {
			dispoString = 'Disponible en ligne :<br>';
		}*/
		
		//dispoString += getImage(tabProductDispo[0]);
		dispoString += getImageDispo(tabProductDispo[1], codeUnivers);
	}
	
	return dispoString;
}

// TYU : Cas code prestation
function getExpoCodePrest(product_number, linkStyle, catentryId, isAccessoire) {
	var dispoExpo = "";
	var isInAStore = false;
	var br = "<br>";;
	
	if (tab_mag == null || tab_mag.length == 0) {
		dispoExpo = '<a href="javascript:void(0)" class="' + linkStyle + '" onClick="javascript:PopUp(\'' + getExpoUrl() + '\',\'popservices\',\'scrollbars=yes,width=520,height=500\');">En vente uniquement'+ br +'en magasin</a>';
	} else {
		dispoExpo = '<a href="javascript:void(0)" onClick="javascript:PopUp(\'' + getExpoUrl() + '\',\'popservices\',\'scrollbars=yes,width=520,height=500\')" class="' + linkStyle + '">En vente uniquement'+ br+ 'en magasin :</a><br>';
		
		// Parcours des disponibilit?s de chaque magasin 
		for (i=0; i<tab_mag.length; i++) {
			if (tab_visibilite[i][product_number]) {
				isInAStore = true;
				dispoExpo += getImage(true);
				dispoExpo += tab_mag[i];
			} else {
				dispoExpo += getImage(false);
				dispoExpo += tab_mag[i];
			}
			
			dispoExpo += '<br>';
		}
		
		if (!isInAStore) {
			// le produit n'est pas visible dans aucun des magasins
			//	- A proximit?
			//		on affiche l'icone "orange" et le message "A proximit? ?"
			// dispoExpo += '<img src="'+langPath+'images/magaZin_final.gif" width="12" height="12">';
			dispoExpo += '<a href="javascript:void(0)" class="' + linkStyle + '" onClick="javascript:PopUp(\'DartyNearestShopVisibility?icp=1&storeId=10001&catentryId='+catentryId+'\',\'popnear\',\'scrollbars=yes,width=400,height=300\')">A proximit&eacute; ?</a>';
			dispoExpo += '<br>';
		}
	}
	
	return dispoExpo;
}

function getExpoCodePrestImage(product_number, linkStyle, catentryId, isAccessoire,codeUnivers) {
	var dispoExpo = "";
	var isInAStore = false;
	var br = "<br>";
	
	if (tab_dispo!=null){
		
		if(tab_dispo[product_number][0] != 1) {
		
			dispoExpo	+="<table border='0' cellpadding='0' cellspacing='0'>";
            dispoExpo	+="<tr> ";
            dispoExpo	+='<td><img src="'+ pathImg + codeUnivers +'/c_reference1.gif" height="8" width="9"/></td>';
            dispoExpo	+='<td class="col-recommande5_'+codeUnivers+'"><darty:htmlImg src="pix/spacer.gif" height="1" width="1"/></td>';
            dispoExpo	+='<td class="col-recommande5_'+codeUnivers+'" align="right"><img src="'+ pathImg + codeUnivers + '/c_plus_produit2.gif" height="7" width="7"/></td>';
            dispoExpo	+="</tr>";
            
            dispoExpo	+="<tr> ";  
            dispoExpo	+="<td class='col-recommande5_"+codeUnivers+"'>&nbsp;</td>";
            dispoExpo	+="<td class='col-recommande5_"+codeUnivers+"'>";
            dispoExpo	+='<a href="javascript:void(0)"  onClick="javascript:PopUp(\'' +  getExpoUrl() + '\',\'popservices\',\'width=535,height=700,scrollbars=yes\')" class="' + linkStyle + '">';
            dispoExpo	+="<img src='"+ pathImg + codeUnivers + "/voir_modele.gif' alt='Voir ce mod&egrave;le dans le magasin le plus proche' border='0' height='31' width='224'/></a></td>";
            dispoExpo	+="<td class='col-recommande5_"+codeUnivers+"'>&nbsp;</td>";
            dispoExpo	+="</tr>";
            
            dispoExpo	+="<tr> ";
            dispoExpo	+="<td><img src='"+ pathImg + codeUnivers + "/c_reference4.gif' height='8' width='9'/></td>";
            dispoExpo	+='<td class="col-recommande5_'+codeUnivers+'"><darty:htmlImg src="pix/spacer.gif" height="1" width="1"/></td>';
            dispoExpo	+="<td class='col-recommande5_"+codeUnivers+"' valign='bottom'><img src='"+ pathImg + codeUnivers +"/c_plus_produit3.gif' height='7' width='7'/></td>";
            dispoExpo	+="</tr>";
          	dispoExpo	+="</table>";
					
		} else {
			
			dispoExpo	+= '<a href="javascript:void(0)"  onClick="javascript:PopUp(\'' + getExpoUrl() + '\',\'popservices\',\'width=535,height=700,scrollbars=yes\')" class="' + linkStyle + '">';
			dispoExpo	+= '<img src="'+ pathImg + codeUnivers + '/' +'/disponibilite.gif" width="195" height="30" border="0" alt="Voir ce mod&egrave;le dans le magasin le plus proche" /></a>';

		}
		
	}
	
	/*if (tab_mag == null || tab_mag.length == 0) {
		dispoExpo = '<a href="javascript:void(0)" class="' + linkStyle + '" onClick="javascript:PopUp(\'' + expoUrl + '\',\'popservices\',\'scrollbars=yes,width=520,height=500\');">En vente uniquement'+ br +'en magasin</a>';
	} else {
		dispoExpo = '<a href="javascript:void(0)" onClick="javascript:PopUp(\'' + expoUrl + '\',\'popservices\',\'scrollbars=yes,width=520,height=500\')" class="' + linkStyle + '">En vente uniquement'+ br+ 'en magasin :</a><br>';
		
		// Parcours des disponibilit?s de chaque magasin 
		for (i=0; i<tab_mag.length; i++) {
			if (tab_visibilite[i][product_number]) {
				isInAStore = true;
				dispoExpo += getImage(true);
				dispoExpo += tab_mag[i];
			} else {
				dispoExpo += getImage(false);
				dispoExpo += tab_mag[i];
			}
			
			dispoExpo += '<br>';
		}
		
		if (!isInAStore) {
			// le produit n'est pas visible dans aucun des magasins
			//	- A proximit?
			//		on affiche l'icone "orange" et le message "A proximit? ?"
			// dispoExpo += '<img src="'+langPath+'images/magaZin_final.gif" width="12" height="12">';
			dispoExpo += '<a href="javascript:void(0)" class="' + linkStyle + '" onClick="MM_openBrWindow(\'DartyNearestShopVisibility?icp=1&storeId=10001&catentryId='+catentryId+'\',\'popnear\',\'scrollbars=yes,width=400,height=300\')">A proximit&eacute; ?</a>';
			dispoExpo += '<br>';
		}
	}*/
	
	
	return dispoExpo;
}

function getExpo(product_number, linkStyle, catentryId, isAccessoire) {
	var dispoExpo = "";
	var isInAStore = false;
	var br = "";
	
	if (isAccessoire) {
		br='<br>';
	}
	
	if (tab_mag == null || tab_mag.length == 0) {
		dispoExpo = '<a href="javascript:void(0)" class="' + linkStyle + '" onClick="javascript:PopUp(\'' + getExpoUrl + '\',\'popservices\',\'scrollbars=yes,width=520,height=500\');">Expos&eacute; en'+ br +' magasin ?</a>';
	} else {
		//	- Expos? en magasin
		//		on affiche le message "Expos? en magasin :"
		//		on affiche la liste des magasins de la fa?on suivante 
		//			-> icone "rouge" puis le nom du magasin si le produit n'est pas visible dans le magasin 
		//			-> icone "verte" puis le nom du magasin si le produit est visible dans le magasin
		dispoExpo = '<a href="javascript:void(0)" onClick="javascript:PopUp(\'' + getExpoUrl() + '\',\'popservices\',\'scrollbars=yes,width=520,height=500\')" class="' + linkStyle + '">Expos&eacute; en'+ br+ ' magasin :</a><br>';
		
		// Parcours des disponibilit?s de chaque magasin 
		for (i=0; i<tab_mag.length; i++) {
			if (tab_visibilite[i][product_number]) {
				isInAStore = true;
				dispoExpo += getImage(true);
				dispoExpo += tab_mag[i];
			} else {
				dispoExpo += getImage(false);
				dispoExpo += tab_mag[i];
			}
			
			dispoExpo += '<br>';
		}
		
		if (!isInAStore) {
			// le produit n'est pas visible dans aucun des magasins
			//	- A proximit?
			//		on affiche l'icone "orange" et le message "A proximit? ?"
			// dispoExpo += '<img src="'+langPath+'images/magaZin_final.gif" width="12" height="12">';
			dispoExpo += '<a href="javascript:void(0)" class="' + linkStyle + '" onClick="MM_openBrWindow(\'DartyNearestShopVisibility?storeId=10001&catentryId='+catentryId+'\',\'popnear\',\'scrollbars=yes,width=400,height=300\')">A proximit&eacute; ?</a>';
			dispoExpo += '<br>';
		}
	}
	
	return dispoExpo;
}

function getLocationQueryString() {
	if(lQryStr != null && ongletAcc == false) {
		return lQryStr;
	}
	// First, we load the URL into a variable
	var url = window.location.href;

	// Next, split the url by the ?
	var qparts = url.split("?");

	// Check that there is a querystring, return "" if not
	if (qparts.length == 0) {
		lQryStr = "";
	} else {		
		if (ongletAcc == true){	
			// Case of product in accessory tab of the catentry page
			lQryStr ="u="+pageUnivers;
		}else{
			// Then find the querystring, everything after the ?
			lQryStr = qparts[1];
		 }	
	}
	
	return lQryStr;
}

