 function chargeListArticle(channelId, ssChannelId,autre,dispAllProd,nbDisplay) 
 { 
 	if (document.getElementById("MEATopAffSlot"))
				document.getElementById("MEATopAffSlot").style.display = "none";
				
				
	var xhr_listArticle = null; 
	if (autre=="promos" || autre =="news")
		var params = "univers="+autre+"&nbDisplay="+nbDisplay;
		else
			var params = "channelId="+channelId+"&ssChannelId="+ssChannelId+"&tous="+autre;
	
	if(dispAllProd!=null && dispAllProd!=""){
		params+="&dispAllProd="+dispAllProd;
	}
	try{
		if(window.XMLHttpRequest) 
			xhr_listArticle = new XMLHttpRequest(); 
		else 
			if(window.ActiveXObject) 
				try {
						xhr_listArticle = new ActiveXObject("Msxml2.XMLHTTP");
						} catch (e) {
							xhr_listArticle = new ActiveXObject("Microsoft.XMLHTTP");
						}
			else { 
				window.location.replace("/magasin/rayon.jsp?"+params);
				return; 
			} 
	} catch (e) {
		window.location.replace("/magasin/rayon.jsp?"+params);
		return;
	}
	if(xhr_listArticle == null){
		window.location.replace("/magasin/rayon.jsp?"+params);
		return;
	}
	
	document.getElementById('primaryDisplay').innerHTML = "<center><div id='image'><br/><br/><br/><br/><img src='/img/"+$('#Locale').val()+"/inscription/loading.gif' width='410' height='40'><br/><br/><br/></div></center>"; 
 
	var method = "GET"; 
	
	var filename = "/magasin/chargementListArticles.jsp?"+params;
	xhr_listArticle.open(method, filename, true); 
	
	xhr_listArticle.onreadystatechange = function() 
	{ 
		if(xhr_listArticle.readyState == 4 && xhr_listArticle.status == 200) { 
			var tmp = xhr_listArticle.responseText;
			document.getElementById('primaryDisplay').innerHTML = tmp;
			
			//var ie = $.browser.msie; 
			var isIE6 = /MSIE 6/i.test(navigator.userAgent);
			if(isIE6){
				$("#sort").selectbox({debug: false});
			}
		}
		
	};	
	javascript:self.scrollTo(0,0);
	xhr_listArticle.send(null); 
	/*if (autre!="promos" || autre!="news")
		driveMenu.setInitRub(""+channelId+ssChannelId);*/
 } 
 
  function chargeListArticleSort(channelId, ssChannelId,sort,order,pageNum,autre,nbDisplay,filtre_rayons) 
 { 
 if(sort == "libelleWeb"){
 	sort = "libelle_web";
 }

	var xhr_listArticle = null; 
	try {
		if(window.XMLHttpRequest) 
			xhr_listArticle = new XMLHttpRequest(); 
		else 
			if(window.ActiveXObject) 
				try {
						xhr_listArticle = new ActiveXObject("Msxml2.XMLHTTP");
						} catch (e) {
							xhr_listArticle = new ActiveXObject("Microsoft.XMLHTTP");
						}
			else { 
				window.location.replace("/magasin/rayon.jsp?sort="+sort+"&order="+order+"&pageNum="+pageNum+"&channelId="+channelId+"&ssChannelId="+ssChannelId);
				return; 
			}
	} catch(e){
		window.location.replace("/magasin/rayon.jsp?sort="+sort+"&order="+order+"&pageNum="+pageNum+"&channelId="+channelId+"&ssChannelId="+ssChannelId);
		return; 
	}
		
	if(xhr_listArticle==null){
		window.location.replace("/magasin/rayon.jsp?sort="+sort+"&order="+order+"&pageNum="+pageNum+"&channelId="+channelId+"&ssChannelId="+ssChannelId);
		return; 
	}
		
	document.getElementById('primaryDisplay').innerHTML = "<center><div id='image'><br/><br/><br/><br/><img src='/img/"+$('#Locale').val()+"/inscription/loading.gif' width='410' height='40'><br/><br/><br/></div></center>"; 
 
	var method = "GET"; 
	if (autre=="promos" || autre=="news")
		var filename = "/magasin/chargementListArticles.jsp?sort="+sort+"&order="+order+"&pageNum="+pageNum+"&univers="+autre+"&nbDisplay="+nbDisplay+"&filtre="+filtre_rayons; 
		else
			var filename = "/magasin/chargementListArticles.jsp?sort="+sort+"&order="+order+"&pageNum="+pageNum+"&channelId="+channelId+"&ssChannelId="+ssChannelId+"&tous="+autre; 
	
	xhr_listArticle.open(method, filename, true); 
	
	xhr_listArticle.onreadystatechange = function() 
	{ 
		if(xhr_listArticle.readyState == 4 && xhr_listArticle.status == 200) { 
			var tmp = xhr_listArticle.responseText;
			document.getElementById('primaryDisplay').innerHTML = tmp; 
			//var ie = $.browser.msie; 
			var isIE6 = /MSIE 6/i.test(navigator.userAgent);
			if(isIE6){
				$("#sort").selectbox({debug: true});
			}
		}
	};
	xhr_listArticle.send(null); 
	/*if (autre!="promos" && autre!="news")
		driveMenu.setInitRub(""+channelId+ssChannelId);*/
	
 } 
 
 
 function chargeFicheProduit(productId,params) 
 { 
	var url = "/magasin/rayon.jsp?"+params;
 
	var xhr_ficheProduit = null; 
	try{
		if(window.XMLHttpRequest) { 
			xhr_ficheProduit = new XMLHttpRequest(); 
		} else { 
			if(window.ActiveXObject)
			{ 
				try {
					xhr_ficheProduit = new ActiveXObject("Msxml2.XMLHTTP");
				} catch (e) {
					xhr_ficheProduit = new ActiveXObject("Microsoft.XMLHTTP");
				}
			} else { 
				window.location.replace(url);
				return; 
			}
		}
	} catch (e){
		window.location.replace(url);
		return; 
	}
	if(xhr_ficheProduit==null){
		window.location.replace(url);
		return; 
	}
	try{
		document.getElementById('popupContentData').innerHTML = "<center><div id='image'><br/><br/><br/><br/><img src='/img/"+$('#Locale').val()+"/inscription/loading.gif' width='410' height='40'><br/><br/><br/></div></center>"; 
		showPopupContent();
	} catch(err){
		alert(err);
		window.location.replace(url);
	}
	var method = "GET"; 
	var filename = "/magasin/ficheProduitAjax.jsp?"+params; 

	xhr_ficheProduit.open(method, filename, true); 
	
	xhr_ficheProduit.onreadystatechange = function() 
	{ 
		if(xhr_ficheProduit.readyState == 4 && xhr_ficheProduit.status == 200) { 
			var tmp = xhr_ficheProduit.responseText;
			document.getElementById('popupContentData').innerHTML = tmp; 
		}
	};
	xhr_ficheProduit.send(null); 
 }


function changerClasse(niveau1, niveau2, niveau3, classe){

	//alert('changerClasse');
	//alert("changerClasse de : "+niveau1);
	//alert("changerClasse de : "+niveau2);
	//alert("changerClasse de : "+niveau3);

	if(niveau1!= null && niveau1!= ''){
		$("#niveau1").attr("className", "classe");
	}

	if(niveau2!= null && niveau2!= ''){
		$("#niveau2").attr("className", "classe");
	}

	if(niveau3!= null && niveau3!= ''){
		$("#niveau3").attr("className", "classe");
	}

}


function retablirPrecedent(niveau1, niveau2, niveau3){

	//alert('retablirPrecedent');

	if(niveau1!= null && niveau1!= ''){
		//alert("retablirPrecedent niveau1 de : "+niveau1);
		window.document.getElementById(niveau1).className='';
		//$("#niveau1").attr("className", "");
	}

	if(niveau2!= null && niveau2!= ''){
		//alert("retablirPrecedent niveau2 de : "+niveau2);
		window.document.getElementById(niveau2).className='';
		//$("#niveau2").attr("className", "");
	}

	if(niveau3!= null && niveau3!= ''){
		//alert("retablirPrecedent niveau3 de : "+niveau3);
		window.document.getElementById(niveau3).className='';
		//$("#niveau3").attr("className", "");
	}

}


function sauvegarderCourant(niveau1, niveau2, niveau3){

	//alert('sauvegarderCourant');

	if(niveau1!= null && niveau1!= ''){
		$("#choixNiv1").val(niveau1);
	}else{
		$("#choixNiv1").val('');
	}

	if(niveau2!= null && niveau2!= ''){
		$("#choixNiv2").val(niveau2);
	}else{
		$("#choixNiv2").val('');
	}


	if(niveau3!= null && niveau3!= ''){
		$("#choixNiv3").val(niveau3);
	}else{
		$("#choixNiv3").val('');
	}
	
}

function chargeResultatRecherche(textSearch, search, drivEx, filtre_rayons, action, num_page, nbDocumentsPerPage){
	document.getElementById('primaryDisplay').innerHTML = "<center><div id='image'><br/><br/><br/><br/><img src='/img/"+$('#Locale').val()+"/inscription/loading.gif' width='410' height='40'><br/><br/><br/></div></center>"; 
	
	var urlRecherche = './components/resultatRecherche.jsp?search='+search;
	
	if(textSearch != ''){
		urlRecherche = urlRecherche + '&textSearch=' + textSearch;
	}
	
	if(action != ''){
		urlRecherche = urlRecherche + '&action=' + action;
	}
	
	if(filtre_rayons != ''){
		urlRecherche = urlRecherche + '&filtre_rayons=' + filtre_rayons;
	}
	
	if(nbDocumentsPerPage != ''){
		urlRecherche = urlRecherche + '&nbDocumentsPerPage=' + nbDocumentsPerPage;
	}

	if(drivEx != ''){
		urlRecherche = urlRecherche + '&drivEx=' + drivEx;
	}
	
	if(num_page != ''){
		urlRecherche = urlRecherche + '&pageNum=' + num_page;
	}
	
	var method = "GET"; 
	var xhr_listArticle = null; 
	try {
		if(window.XMLHttpRequest) 
			xhr_listArticle = new XMLHttpRequest(); 
		else 
			if(window.ActiveXObject) 
				try {
						xhr_listArticle = new ActiveXObject("Msxml2.XMLHTTP");
						} catch (e) {
							xhr_listArticle = new ActiveXObject("Microsoft.XMLHTTP");
						}
			else {
				return; 
			}
	} catch(e){
		return; 
	}
	
	
	// Encodage du caractere % dans le texte recherche
	var urlRechercheEncode = urlRecherche.replace("%","%25");
	
	xhr_listArticle.open(method, urlRechercheEncode, true);

	
	xhr_listArticle.onreadystatechange = function() 
	{ 
		if(xhr_listArticle.readyState == 4 && xhr_listArticle.status == 200) { 
			var tmp = xhr_listArticle.responseText;
			$("#primaryDisplay").html(tmp);
		}
	};
	
	xhr_listArticle.send(null); 
}

