var Navigateur = navigator.appName;

if(Navigateur == "Microsoft Internet Explorer")
	var ie = true;
else
	var ie = false;



var IE6 = false 

var strChUserAgent = navigator.userAgent; 
var intSplitStart = strChUserAgent.indexOf("(",0); 
var intSplitEnd = strChUserAgent.indexOf(")",0); 
var strChMid = strChUserAgent.substring(intSplitStart, intSplitEnd); 

if(strChMid.indexOf("MSIE 6") != -1) IE6 = true;

function selectDelivery(a, id)
{
	$('#order_fournisseur').value=id;
	
	//on selectionne la plateforme
	if($('span_menu3'))	$('span_menu3').innerHTML=$(a).innerHTML;
	
	//on cache le sous menu
	$('lst_smenu3').style.display='none';
	
	//on met le a en surbrillance
	$$('a[id^=a_deli_]').removeClass('active');
	$(a).addClass('active');
}

function montre_lst(id)
{
	var d = document.getElementById(id);
	for (var i = 1; i<=10; i++) {
	if (document.getElementById('lst_smenu'+i)) {document.getElementById('lst_smenu'+i).style.display='none';}
	}
	if (d) {d.style.display='block';}
} 



function menu(obj, idsub)
{
	
	//SelectFix.repairFloatingElement(document.getElementById('langue_produit_id'));
	if(!$(obj).hasClass('active')) {
		$(obj).addClass('hover').addClass('jshover');
		var posLeft = getLeftImg(obj);
		$(obj).addClass('submenu_hover');
	}
	
		
	
	
	if($(idsub)) {
		$(idsub).addClass('submenu_hoverjs');
		$(idsub).style.position = "absolute";
		$(idsub).style.marginTop = "-1px";
		$(idsub).style.left = posLeft;


		
			
		
	}
	
	
}


function initSlideShow(){
	var showDuration = 3000;
	var container = $('slideshow-container');
	var images = container.getElements('img');
	var currentIndex = 0;
	var interval;
	var toc = [];
	var tocHeight = 0;
	var tocActive = 'toc-active';

	/* new: starts the show */
	var start = function() { interval = show.periodical(showDuration); };
	var stop = function() { $clear(interval); };
	/* worker */
	var show = function(to) {
		images[currentIndex].fade('out');
		toc[currentIndex].removeClass(tocActive);
		images[currentIndex = ($defined(to) ? to : (currentIndex < images.length - 1 ? currentIndex+1 : 0))].fade('in');
		toc[currentIndex].addClass(tocActive);
	};



	/* new: control: table of contents */
	images.each(function(img,i){
			
			var z = i+1;
			
			var csstoc = "toc";
			if(z==4) {
				csstoc = "toc_debug"
			}
			
			toc.push(new Element('a',{
				text: $('txt_'+z).innerHTML,
				href: '#',
				'class': csstoc + (i == 0 ? ' ' + tocActive : ''),
				events: {
					click: function(e) {
						if(e) e.stop();
						stop();
						show(i);
					}
				},
				styles: {
					top: ((tocHeight + 2))
				}
			}).inject(container));
			 if(i > 0) { img.set('opacity',0);  } 
			 
			 tocHeight = tocHeight + 36;
		}	);
		
	/* new: control: start/stop on mouseover/mouseout */
	/*container.addEvents({
		mouseenter: function() { stop(); },
		mouseleave: function() { start(); }
	});
	*/

	/* start once the page is finished loading */
	window.addEvent('load',function(){
		start();
	});
}


function initSlideShow2(){
	var showDuration = 3000;
	var container = $('slideshow-container2');
	var images = container.getElements('img');
	var currentIndex = 0;
	var interval;
	var toc = [];
	var tocHeight = 0;
	var tocActive = 'toc-active';

	/* new: starts the show */
	var start = function() { interval = show.periodical(showDuration); };
	var stop = function() { $clear(interval); };
	/* worker */
	var show = function(to) {
		images[currentIndex].fade('out');
		toc[currentIndex].removeClass(tocActive);
		images[currentIndex = ($defined(to) ? to : (currentIndex < images.length - 1 ? currentIndex+1 : 0))].fade('in');
		toc[currentIndex].addClass(tocActive);
	};



	/* new: control: table of contents */
	images.each(function(img,i){
			
			var z = i+1;
			
			var csstoc = "toc";
			if(z==4) {
				csstoc = "toc_debug"
			}
			
			toc.push(new Element('a',{
				text: $('txt_'+z).innerHTML,
				href: '#',
				'class': csstoc + (i == 0 ? ' ' + tocActive : ''),
				events: {
					click: function(e) {
						if(e) e.stop();
						stop();
						show(i);
					}
				},
				styles: {
					top: ((tocHeight + 2))
				}
			}).inject(container));
			 if(i > 0) { img.set('opacity',0);  } 
			 
			 tocHeight = tocHeight + 36;
		}	);
		
	/* new: control: start/stop on mouseover/mouseout */
	/*container.addEvents({
		mouseenter: function() { stop(); },
		mouseleave: function() { start(); }
	});
	*/

	/* start once the page is finished loading */
	window.addEvent('load',function(){
		start();
	});
}

var Hactu = 0;
var maxH = 0;
var saveH = 0;
function effetderoule(idsub) {
		if(maxH==0) {
			$(idsub).style.display = "block";
			maxH = $(idsub).offsetHeight;
		}
		
		if(saveH==0) {
			saveH = Hactu;
		}		
		
		$(idsub).style.overflow = "hidden";
		if(Hactu <= maxH) {
			Hactu+=5;
			$(idsub).style.height=Hactu+"px";
			setTimeout(function(){effetderoule(idsub)}, 10);	
		}else{
			Hactu = 0;
			maxH = 0;	
		}

}

var Hactu2 = 0;
var maxH2 = 0;
var saveH2 = 0;
function effetenroule(idsub) {
	

		if(maxH2==0) {
			Hactu2 = $(idsub).offsetHeight;
		}
		
		if(saveH2==0) {
			saveH2 = Hactu2;
		}
		
	
		
		
		$(idsub).style.overflow = "hidden";
		
		if(maxH2 < Hactu2) {
			Hactu2-=5;
			$(idsub).style.height=Hactu2+"px";
			setTimeout(function(){effetenroule(idsub)}, 10);	
		}else{
				Hactu2 = 0;
				maxH2 = 0;
				$(idsub).style.display = "none";
				$(idsub).style.height = saveH2+"px";
				saveH2 = 0;
			}
	
}


//hidemenu('menu', 'sub_{$c.categorie_id}');inactive('colortest_{$c.categorie_id}');    -    menu($('supermenu_{$c.categorie_id}'), 'sub_{$c.categorie_id}');active('colortest_{$c.categorie_id}');
function active(obj)
{
		$(obj).style.color = "#DE2887";
}

function inactive(obj)
{
		$(obj).style.color = "#592F46";
}

function hidemenu(item, idsub)
{
	
	$$('#'+item+' li.jshover').removeClass('hover').removeClass('jshover');
	$$('#'+item+' li.submenu_hover').removeClass('submenu_hover');
	if($(idsub)) $(idsub).removeClass('submenu_hoverjs');
}


function popup_link(link) {
	var popup;
	popup = window.open(link,'popupgo','width=996,height=760,toolbar=0,location=0,directories=0,menuBar=0,scrollbars=0,resizable=0');
	popup.document.close();	
	
}

function popupimage(chemin)
{	
	var html;
	html = '<HTML>\n'
	+ '<HEAD>\n'
	+ '<TITLE>D&eacute;tail de la photo</TITLE>\n'
	+ '<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">\n'
	+ '<link rel="stylesheet" href="/charte/style.css" type="text/css">\n'
	+ '</HEAD>\n'
	+ '<BODY onLoad="window.focus();window.resizeTo(document.imageTest.width+35,document.imageTest.height+90);" bgcolor="#FFFFFF" leftmargin="10" topmargin="10" marginwidth="10" marginheight="10">\n'
	+ '<table width="100%" height="100%" border="0" cellspacing="0" cellpadding="0">\n'
	+ '<tr><td align="center" valign="middle">'
	+ '<img src="'+chemin+'" border="0" name="imageTest"></td></tr>\n'
	+ '</table>\n'
	+ '</BODY>\n'
	+ '</HTML>'
	
	var popup;
	popup = window.open('','popupgo','left=200,top=100,width=10,height=10,toolbar=0,location=0,directories=0,menuBar=0,scrollbars=0,resizable=0');
	popup.document.write(html);
	popup.document.close();
}


function SecureConfirm(obj)
{
	if(confirm('Voulez-vous supprimer votre adresse du carnet ?')) {
		return true;
	}else{
		return false;
	}
}

var fondDiv = false;
var dataDiv = false;
// Ajout au panier
function addPanier(idForm)
{
	if(!fondDiv){
		fondDiv = document.createElement('div');
		fondDiv.style.position = 'absolute';
		document.body.appendChild(fondDiv);
	}
	fondDiv.innerHTML = '';

	$(fondDiv).setStyles({
	   backgroundColor: '#000000',
	   width: '100%',
	   height: getScrollHeight(),
	   position: 'absolute',
	   opacity: '0.5',
	   overflow: 'hidden',
	   top: '0px',
	   zIndex: '9999',
	   visibility: 'hidden'
	});

	if(!dataDiv){
		dataDiv = document.createElement('div');
		dataDiv.style.position = 'absolute';
		document.body.appendChild(dataDiv);
	}

	$(dataDiv).setStyles({
	   background: '#FFFFFF',
	   width: '478px',
	   height: '525px',
	   position: 'absolute',
	   border: '1px solid #7f7f7f',
	   top: '30%',
	   left: '50%',	   
	   marginLeft: '-239px',	   
	   marginTop: (getScrollTop()-129) + 'px',	   	   	   
	   zIndex: '9999',
	   visibility: 'hidden'
	});


	new Request({
		url : '/js/ajax/panier-change.php',
		method: 'post',
		data:$(idForm).toQueryString(),
		onSuccess: function(req) {
					$(dataDiv).set('html',req);

					$$(fondDiv).setStyles({visibility: 'visible' });
					$$('select').setStyles({visibility: 'hidden' });
					$$(dataDiv).setStyles({visibility: 'visible' });
					
					new Request({
						url : '/js/ajax/updatePanier.php',
						onSuccess: function(req2) {
							$('header_panier').set('html',req2);
							//trackevt('ajout_panier',$('produit_id').value);
						}
		
					}).send();					
					
					
		},
		evalScripts: true
		
	}).send();
}

function addNewsletter(idForm)
{
			
	if(!fondDiv){
		fondDiv = document.createElement('div');
		fondDiv.style.position = 'absolute';
		document.body.appendChild(fondDiv);
	}
	fondDiv.innerHTML = '';
	//alert(getHeight());

	$(fondDiv).setStyles({
	   backgroundColor: '#000000',
	   width: '100%',
	   height: getScrollHeight(),
	   position: 'absolute',
	   opacity: '0.8',
	   overflow: 'hidden',
	   top: '0px',
	   zIndex: '1500',
	   visibility: 'hidden'
	});

	fondDiv.onclick = function () { removeDivPanier(); }
	
	if(!dataDiv){
		dataDiv = document.createElement('div');
		dataDiv.style.position = 'absolute';
		document.body.appendChild(dataDiv);
	}
	
	$(dataDiv).setStyles({
	   background: '#FFFFFF url(/styles/images/popup/bgProduit2.png) no-repeat top left',
	   width: '450px',
	   height: '349px',
	   position: 'absolute',
	   border: '1px solid #9F9F9F',
	   top: '50%',
	   left: '50%',	   
	   marginLeft: '-225px',	   
	   marginTop: (getScrollTop()-177) + 'px',
	   zIndex: '1600',
	   visibility: 'hidden',
	   paddingLeft: '3px',
	   paddingTop: '3px',
	   paddingRight: '3px',
	   paddingBottom: '3px'
	});



	new Request({
		url : '/js/ajax/addNewsletter.php',
		
		data:$(idForm).toQueryString(),
		onSuccess: function(req) {
					$(dataDiv).set('html',req);
					$$(fondDiv).setStyles({visibility: 'visible' });
					$$('select').setStyles({visibility: 'hidden' });
					$$(dataDiv).setStyles({visibility: 'visible' });
		},
		evalScripts: true
		
	}).send();

}

function removeDivPanier()
{
	if(fondDiv){
		$(fondDiv).dispose();
		fondDiv = false;
	}	
	if(dataDiv){
		$(dataDiv).dispose();
		dataDiv = false;
	}
	$$('select').setStyles({visibility: 'visible' });		
}

function getTop(deKoi)
{
	var obj = deKoi;
	var curleft = 0;

	if (obj.offsetParent)
	{
		while (obj.offsetParent)
		{
			curleft += obj.offsetTop;
			obj = obj.offsetParent;
		}
	}
	else
	{
		if (obj.y)
			curleft += obj.y;
	}

	return (curleft);
}

function getLeftImg(deKoi)
{
	var obj = deKoi;
	var curleft = 0;

	if (obj.offsetParent)
	{
		while (obj.offsetParent)
		{
			curleft += obj.offsetLeft;
			obj = obj.offsetParent;
		}
	}
	else
	{
		if (obj.x)
			curleft += obj.x;
	}

	return (curleft);
}

function showPreviewBig_home(idProd,imglist)
{

	div = 'prod'+idProd;
	
	vartop=getTop(imglist)-getTop($('contenu'));
	varleft=getLeftImg(imglist)-getLeftImg($('header_gauche'));
	
	
	
	$(div).style.top=vartop-135+105 + 'px';
	$(div).style.left=varleft-135+110 + 'px';

	$(div).style.display='block';	
}



function showPreviewBig(idProd,imglist)
{

	div = 'prod'+idProd;
	
	vartop=getTop(imglist)-getTop($('conteneur_global'));
	varleft=getLeftImg(imglist);
	/*
	if(IE6) {
		$(div).style.top=vartop-135+85 + 'px';
		$(div).style.left=varleft-60 + 'px';
	}else if(ie){
		$(div).style.top=vartop-135+85 + 'px';
		$(div).style.left=varleft+267 + 'px';		
	}else{
		$(div).style.top=vartop-135+85 + 'px';
		$(div).style.left=varleft+285 + 'px';
	}
*/
	//alert(getLeftImg(imglist) + "  -  " + getLeftImg($('header_gauche')) );
	$(div).style.top= -50 + 'px';
	$(div).style.left=-50 + 'px';
	
	$(div).style.display='block';	
}



function cachePrevisu(idProd)
{
	div = 'prod' + idProd;
	$(div).style.display='none';	
}

function affichePromocode() {
	var div = document.getElementById('promocode');
	
	if(div.style.display=='block') {
		div.style.display='none'
	}else{
		div.style.display='block'
	}
}
function afficheCheque() {
	var div = document.getElementById('bonachatcadeau');
	
	if(div.style.display=='block') {
		div.style.display='none'
	}else{
		div.style.display='block'
	}
}
if(!edz_zooms) var edz_zooms = false;

function show_ss_menu(id) {
	if(edz_zooms)
	{
		if(edz_zooms._zoomCur) edz_zooms._zoomCur._divLoupe.style.display='none';
	}
	
	var d = document.getElementById(id);
		for (var i = 1; i<=17; i++) {
			if(document.getElementById('smenu'+i)) document.getElementById('smenu'+i).style.display='none';
		}
		
		if (d && id) {d.style.display='block';}
		
}

var Interval;
//window.onload = wl;
var iScroll=0;
function defileBas(param_scroll) {
	if(param_scroll==1)	iScroll=param_scroll;
	if(iScroll)
	{
		$('listeMarque').scrollTop+=1;
		setTimeout(defileBas, 10);
	}
}

function defileHaut(param_scroll) {
	if(param_scroll==1)	iScroll=param_scroll;
	if(iScroll)
	{
		$('listeMarque').scrollTop-=1;
		setTimeout(defileHaut, 10);
	}	
}
function defileBas2(param_scroll) {
	if(param_scroll==1)	iScroll=param_scroll;
	if(iScroll)
	{
		$('listeCouleur').scrollTop+=1;
		setTimeout(defileBas2, 10);
	}
}

function defileHaut2(param_scroll) {
	if(param_scroll==1)	iScroll=param_scroll;
	if(iScroll)
	{
		$('listeCouleur').scrollTop-=1;
		setTimeout(defileHaut2, 10);
	}	
}

function defileBas3(param_scroll) {
	if(param_scroll==1)	iScroll=param_scroll;
	if(iScroll)
	{
		$('listeChou').scrollTop+=1;
		setTimeout(defileBas3, 10);
	}
}

function defileHaut3(param_scroll) {
	if(param_scroll==1)	iScroll=param_scroll;
	if(iScroll)
	{
		$('listeChou').scrollTop-=1;
		setTimeout(defileHaut3, 10);
	}	
}

function defilePause() {
	iScroll=0;
}

function expand(obj, div, fleche, color) {

	if($(div).style.display == "block") {
		$(div).style.display = "none";
		if(obj != "") {
			$(obj).style.background = "#f7f1e1 url('/styles/images/sep_gauche.png') repeat-x bottom left";
			$(obj).style.color = "#000000";
			$(obj).style.borderBottom = "#ffffff 3px solid";
			$(obj).className = "critere_recherche";
		}

		if(fleche!="") $(fleche).src = '/styles/images/header/flecheblanc.png';
		if(color!="") $(color).style.color = '#FFFFFF';
	}
	else{
		$(div).style.display = "block";
		if(obj != "") {
			$(obj).style.background = "#000000 url('/styles/images/header/bg_recherche.png') repeat-x";
			$(obj).style.color = "#FFFFFF";
			$(obj).style.borderBottom = "none";
			$(obj).className = "crlnk";
		}
		if(fleche!="") $(fleche).src = '/styles/images/flecherose.png';
		if(color!="") $(color).style.color = '#E42F8B';
	}
}

function expandall() {
	
	if($('menu_type').style.display == "block") {
		$('menu_type').style.display = "none";
		$('menu_type_titre').style.background = "#f7f4e2";
		$('menu_type_titre').style.color = "#000000";
		$('menu_type_titre').style.borderBottom = "#ffffff 3px solid";
		$('menu_type_titre').className = "critere_recherche";
	}
	
	
	if($('menu_marque').style.display == "block") {
		$('menu_marque').style.display = "none";
		$('menu_marque_titre').style.background = "#f7f1e1 url('/styles/images/sep_gauche.png') repeat-x bottom left";
		$('menu_marque_titre').style.color = "#000000";
		$('menu_marque_titre').style.borderBottom = "#ffffff 3px solid";
		$('menu_marque_titre').className = "critere_recherche";
	}	

	if($('menu_couleursmat').style.display == "block") {
		$('menu_couleursmat').style.display = "none";
		$('menu_couleursmat_titre').style.background = "#f7f1e1 url('/styles/images/sep_gauche.png') repeat-x bottom left";
		$('menu_couleursmat_titre').style.color = "#000000";
		$('menu_couleursmat_titre').style.borderBottom = "#ffffff 3px solid";
		$('menu_couleursmat_titre').className = "critere_recherche";
	}		

	if($('menu_style').style.display == "block") {
		$('menu_style').style.display = "none";
		$('menu_style_titre').style.background = "#f7f1e1 url('/styles/images/sep_gauche.png') repeat-x bottom left";
		$('menu_style_titre').style.color = "#000000";
		$('menu_style_titre').style.borderBottom = "#ffffff 3px solid";
		$('menu_style_titre').className = "critere_recherche";
	}		

	if($('menu_budget').style.display == "block") {
		$('menu_budget').style.display = "none";
		$('menu_budget_titre').style.background = "#f7f1e1 url('/styles/images/sep_gauche.png') repeat-x bottom left";
		$('menu_budget_titre').style.color = "#000000";
		$('menu_budget_titre').style.borderBottom = "#ffffff 3px solid";
		$('menu_budget_titre').className = "critere_recherche";
	}	
	
}

function expandclose(obj, div) {
	$(div).style.display = "none";
	if(obj != "") {
		$(obj).style.background = "#f7f1e1 url('/styles/images/sep_gauche.png') repeat-x bottom left";
		$(obj).style.color = "#000000";
		$(obj).className = "critere_recherche";
		$(obj).style.borderBottom = "#ffffff 3px solid";
	}
}

function inactive_color(obj,fleche) {
	$(obj).style.color = '#ffffff';
	$(fleche).src = '/styles/images/header/flecheblanc.png';
}

function hideSelectPay(inputValue) {
	document.getElementById('blocMX').style.display='none';
	document.getElementById('blocCH').style.display='none';
	if(inputValue=='MX')
		document.getElementById('blocMX').style.display='inline';
	if(inputValue=='CH')
		document.getElementById('blocCH').style.display='inline';
}

function montre(id) {
var d = document.getElementById(id);
	for (var i = 1; i<=10; i++) {
		if (document.getElementById('smenu'+i)) {document.getElementById('smenu'+i).style.display='none';}
	}
if (d) {d.style.display='block';}
}


function sendAmis(id,type) {
	window.open('/wish_amis.php', 'conseils', 'width=450,height=320,resizable=no,scrollbars=no,toolbar=0,directories=0,status=0,menubar=0');
}

function check_add_panier(toto)
{

	nVarNom = toto;	

	if(nVarNom != null) //check_add_panier('toto')

	{

		if(!nVarNom)

			check_add_panier('toto');

		else

		{

			document.forms['savepanier'].elements['panier_nom'].value = nVarNom;	

			document.forms['savepanier'].submit();	

		}
	}
}





function LoadZoomList(img, desc, img_gauche, img_droite, dispo) {
	
	
	$('img_list_big').src = img;
	$('produit_desc').innerHTML = desc;
	$('produit_isdispo').style.display='block';
	$('produit_isdispo').innerHTML = dispo;

	
	if(img_gauche == "") {
		if( $('etiquette_gauche')) { $('etiquette_gauche').style.display = "none"; }
		if( $('detiquette_gauche')) { $('detiquette_gauche').style.display = "none"; }
	}else{
		//alert(img_gauche);
		$('detiquette_gauche').style.display = "block";
		$('etiquette_gauche').style.display = "block";
		$('etiquette_gauche').src = img_gauche;
	}

	if(img_droite  == "") {
		if( $('etiquette_droite') ) { $('etiquette_droite').style.display = "none"; }
		if( $('detiquette_droite') ) { $('detiquette_droite').style.display = "none"; }
	}else{
		$('detiquette_droite').style.display = "block";
		$('etiquette_droite').style.display = "block";
		$('etiquette_droite').src = img_droite;
	}
	
	//alert(img_gauche + " " + img_droite);
}

function showPreviewBigDef (img, desc) {
	
	$('img_list_big').src = img;
	$('produit_isdispo').style.display='none';
	$('produit_desc').innerHTML = desc;	
	
	$('etiquette_droite').style.display = "none";
	$('etiquette_gauche').style.display = "none";
	$('detiquette_droite').style.display = "none";
	$('detiquette_gauche').style.display = "none";	
	
}


function changefleche(id) {
	
	
}


function openFournisseur(id) {
	$(id).style.display="block";
}
function closeFournisseur(id) {
	$(id).style.display="none";
}


function sendAmisProduit(id) {
	window.open('/produit_amis.php?produit_id='+id, 'Produit', 'width=500,height=500,resizable=no,scrollbars=no,toolbar=0,directories=0,status=0,menubar=0');
}


function updateInfoStock(id) {
	

	new Request({
		url : '/js/ajax/updateInfoStock.php',
		method: 'post',
		data:"produit_attribut_id="+id,
		onSuccess: function(req) {
			$('maj_stock_attr').innerHTML = req;
		},
		evalScripts: true
		
	}).send();
	
	
}




function init_menu(selected_section){
	
	var main_menu_items = $$('.sousmenu');
	//console.log(main_menu_items.length);
	
	main_menu_items.each(function(item){
			

			data = item.id.split('_');	


			if($('sub_' + data[1]))
			{
				submenu = $('sub_' + data[1]);
				
			
				var height_fx = new Fx.Tween($('sub_' + data[1]));			
				var nb = $('sub_' + data[1]).getChildren().length;
				
				
				
				//--deb
				item.addEvent('mouseenter',function(e){
					
					item.addClass('active');
					
					e = new Event(e);
					if(ie)
						var ratio = 30;
					else
						var	ratio = 28;
					
					var delta = (nb*ratio);
							
					height_fx.start('height',0,delta);
					submenu.getChildren().each(function(submenu_item){
						submenu_item.addEvent('mouseover',function(e){
							$$('select').setStyles({visibility: 'hidden' });
						});
						submenu_item.addEvent('mouseout',function(e){
							$$('select').setStyles({visibility: 'visible' });
						});
					});
					e.stop();
					$$('select').setStyles({visibility: 'hidden' });
					// end of item.addEvent('mouseenter')
				});
				//--deb
				
				
				//--deb
				item.addEvent('mouseleave',function(e){
					
					item.removeClass('active');

					e = new Event(e);
					
					height_fx.set('height',0);
					height_fx.cancel();
					e.stop();
					$$('select').setStyles({visibility: 'visible' });
				});
				
				//--deb
				
			} //ifsubmenu
	// end of each
	
	});
	
// end of function
}


function ShowDesc(nom)
{
	$('produit_desc').innerHTML=nom;
}




// onclick="document.getElementById('zoomsrc2').src='{$img.produit_image}';document.getElementById('photobig').src='{$img.produit_image}';document.getElementById('photoprod').src='{$img.produit_image_detail}';document.getElementById('photoprod').title='{$img.produit_image_nom}'"

function selectCouleur(obj,load)
{
	//alert(obj.options[obj.selectedIndex].value);
	if(obj.options[obj.selectedIndex].value != '-1')
	{
		$('select_taille').disabled = false;
		$('select_taille').removeClass('disable');

		compat = obj.options[obj.selectedIndex].className;
		arrCompat = compat.split(' ');
		
		arrArt2 = $$('#select_taille option.tocheck').setStyle('display', 'none');
		arrArt = $$('#select_taille .'+obj.options[obj.selectedIndex].value).setStyle('display', 'block');
		console.log(arrArt2.length);
		finalz = 0;
		for(z=0; z < arrArt2.length; z++)
		{
			if(arrArt2[z].style.display == 'block')
			{
				finalz = z;
				console.log(finalz);
				
				break;
			}
		}
		$('select_taille').selectedIndex = finalz;
		/*
		document.forms['produit'].produit_option_valeur_id.value = obj.options[obj.selectedIndex].value;
		document.forms['produit'].produit_option_valeur_id_bis.value="";
		*/
		
		//if(load=="undefined") updateTarif();
		
	}
	else
	{
		$('select_taille').disabled = true;
		$('select_taille').selectedIndex = 0;
		//document.forms['produit'].produit_option_valeur_id_bis.value="";
		//stepOne = false;
	}

	//if(load=="undefined") $('select_matiere').selectedIndex = 0;
	
	updateInfoStock($('select_taille').value)
	
}


function showMenu(id, etat) {
	if(etat==1) {
		if($('lstmenu_'+id)) {
			var posY = $("btn_menu_"+id).offsetTop;
			var posX = $("btn_menu_"+id).offsetLeft;		
			posY = posY+50;
			
			
			
			$('lstmenu_'+id).style.top=posY+"px";
			$('lstmenu_'+id).style.left=posX+"px";
			$('lstmenu_'+id).style.display="block";
			
		}
	}else{
		if($("lstmenu_"+id)) $('lstmenu_'+id).style.display="none";
	}
}

function debugOnglet(id, etat) {
	if(etat==2) {
		
		if($("btn_menu_"+id)) {
			 $("btn_menu_"+id).style.fontWeight="normal";	
		}
		
		if($("lstmenu_"+id)) $('lstmenu_'+id).style.display="none";
	}else{
		
		if($("btn_menu_"+id)) {
			 $("btn_menu_"+id).style.fontWeight="bold";	
		}		
		if($("lstmenu_"+id)) $('lstmenu_'+id).style.display="block";
	}	
}

function displayMenu(id, etat) {

	if(etat==1) {
		if($('smenu_'+id)) {
			var posY = $("limenu_"+id).offsetTop;
			var posX = $("limenu_"+id).offsetLeft;		
			$('smenu_'+id).style.display="block";
		}
	}else{
		if($("smenu_"+id)) $('smenu_'+id).style.display="none";
	}

	
}

function changeOnglet(id,etat,first) {
	
	if(etat==2) {
		if($("cat_a_"+id)) $("cat_a_"+id).style.color="#CE8F40";
		if($("lstmenu_"+id)) $('lstmenu_'+id).style.display="none";
	}else{
		if($("cat_a_"+id)) $("cat_a_"+id).style.color="#CE8F40";
		if($("lstmenu_"+id)) $('lstmenu_'+id).style.display="block";
	}
	
}

function initListe() {
	if($('produit_option_valeur_id')) $('produit_option_valeur_id').options[0].selected = true;
	if($('produit_option_valeur_id_bis')) $('produit_option_valeur_id_bis').options[0].selected= true;
	
	chargeCouleur($('produit_id').value, $('produit_option_valeur_id').value);
	setProduitAttribut($('produit_option_valeur_id').value, $('produit_option_valeur_id_bis').value);	
}



function popupimage(chemin)
{	
	var html;
	html = '<HTML>\n'
	+ '<HEAD>\n'
	+ '<TITLE>D&eacute;tail de la photo</TITLE>\n'
	+ '<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">\n'
	+ '<link rel="stylesheet" href="/charte/style.css" type="text/css">\n'
	+ '</HEAD>\n'
	+ '<BODY onLoad="window.focus();window.resizeTo(document.imageTest.width+35,document.imageTest.height+90);" bgcolor="#FFFFFF" leftmargin="10" topmargin="10" marginwidth="10" marginheight="10">\n'
	+ '<table width="100%" height="100%" border="0" cellspacing="0" cellpadding="0">\n'
	+ '<tr><td align="center" valign="middle">'
	+ '<img src="'+chemin+'" border="0" name="imageTest"></td></tr>\n'
	+ '</table>\n'
	+ '</BODY>\n'
	+ '</HTML>'
	
	var popup;
	popup = window.open('','popupgo','left=200,top=100,width=10,height=10,toolbar=0,location=0,directories=0,menuBar=0,scrollbars=0,resizable=0');
	popup.document.write(html);
	popup.document.close();
}

function pop_zoom(produit_id, produit_image_id)
{
	if(!fondDiv){
		fondDiv = document.createElement('div');
		fondDiv.style.position = 'absolute';
		document.body.appendChild(fondDiv);
	}
	fondDiv.innerHTML = '';
	//alert(getHeight());

	$(fondDiv).setStyles({
	   backgroundColor: '#000000',
	   width: '100%',
	   height: getScrollHeight(),
	   position: 'absolute',
	   opacity: '0.8',
	   overflow: 'hidden',
	   top: '0px',
	   zIndex: '9999',
	   visibility: 'hidden'
	});

	fondDiv.onclick = function () { removeDivPanier(); }
	
	if(!dataDiv){
		dataDiv = document.createElement('div');
		dataDiv.style.position = 'absolute';
		document.body.appendChild(dataDiv);
	}
	
	$(dataDiv).setStyles({
	   backgroundColor: 'transparent',
	   width: '456px',
	   height: '530px',
	   position: 'absolute',
	   border: '1px solid #9F9F9F',
	   top: '50%',
	   left: '50%',	   
	   marginLeft: '-228px',	   
	   marginTop: (getScrollTop()-265) + 'px',
	   zIndex: '10000',
	   visibility: 'hidden',
	   paddingLeft: '3px',
	   paddingTop: '3px',
	   paddingRight: '3px',
	   paddingBottom: '3px'
	});

	new Request({
		url : '/js/ajax/pop_zoom.php',
		
		data:"produit_id=" + produit_id + "&produit_image_id=" + produit_image_id,
		onSuccess: function(req) {
					$(dataDiv).set('html',req);

					$$(fondDiv).setStyles({visibility: 'visible' });
					$$('select').setStyles({visibility: 'hidden' });
					$$(dataDiv).setStyles({visibility: 'visible' });
		},
		evalScripts: true
		
	}).send();
}

function imageZoom(image_id, nbImages) {
	for (var i = 1; i<=nbImages; i++) {
		if(i != image_id) {
			document.getElementById('miniature'+i).style.border='#8F8F8F 1px solid';
		}
	}
	document.getElementById('miniature'+image_id).style.border='#4E4B47 4px solid';
}


function qtechangeprod(chaine) {
	if(chaine=="moins") {
		if($('qtetxt').value>1) {
			$('qtetxt').value=parseInt($('qtetxt').value)-1;
		}
	}
	if(chaine=="plus") {
		$('qtetxt').value=parseInt($('qtetxt').value)+1;
	}	
	
	
}


function maj_qte(idForm)
{
	

	
	
}


function updateprixproduit(produit_attribut_id, id) {
		
		var produit_id = $('produit_id').value;
	
	
		new Request({
			url : '/js/ajax/calcul_prix_maj.php',
			data:"produit_id="+produit_id+"&produit_attribut_id="+produit_attribut_id,
			onSuccess: function(req) {
				$('produit_prix').innerHTML = parseFloat(req).toFixed(2)+' &euro;';					
			},
			evalScripts: true
			
		}).send();	
	
	
		new Request({
			url : '/js/ajax/calcul_prix_maj_barre.php',
			data:"produit_id="+produit_id+"&produit_attribut_id="+produit_attribut_id,
			onSuccess: function(req) {
				if($('choix_px_sspromo')) $('choix_px_sspromo').innerHTML = parseFloat(req).toFixed(2)+' &euro;';
			},
			evalScripts: true
			
		}).send();	


		new Request({
			url : '/js/ajax/calcul_stock.php',
			data:"produit_id="+produit_id+"&produit_attribut_id="+id,
			onSuccess: function(req) {
				$('produit_stock').set('html',req);
			},
			evalScripts: true
			
		}).send();	


		

		submenu = $('lst_attributs');
		
		submenu.getChildren().each(function(submenu_item){
			//console.log('pwet');
			submenu_item.style.background = "#ffffff";
			submenu_item.style.color = "#616161";
		});

				

		$('produit_attribut_id').value=id;
		$('produit_attribut_'+id).style.background = "#a1a1a1";
		$('produit_attribut_'+id).style.color = "#ffffff";
		
}

function updateoptvaleur(id) {
		
		var produit_id = $('produit_id').value;

		submenu = $('lst_opt');
		
		submenu.getChildren().each(function(submenu_item){
			//console.log('pwet');
			submenu_item.style.border = "1px solid #C1C1C1";
		});

				

		$('opt_valeur_id').value=id;
		$('opt_valeur_id_'+id).style.border = "#ff0000 1px solid";
		
}


function openPopupProduit(produit_id, type_id)
{
	// Type 1 = envoyez amis.
	// Type 2 = faites vous offrir
	
	if(!fondDiv){
		fondDiv = document.createElement('div');
		fondDiv.style.position = 'absolute';
		document.body.appendChild(fondDiv);
	}
	fondDiv.innerHTML = '';
	//alert(getHeight());

	$(fondDiv).setStyles({
	   backgroundColor: '#000000',
	   width: '100%',
	   height: getScrollHeight(),
	   position: 'absolute',
	   opacity: '0.8',
	   overflow: 'hidden',
	   top: '0px',
	   zIndex: '1500',
	   visibility: 'hidden'
	});

	fondDiv.onclick = function () { removeDivPanier(); }
	
	if(!dataDiv){
		dataDiv = document.createElement('div');
		dataDiv.style.position = 'absolute';
		document.body.appendChild(dataDiv);
	}
	
	$(dataDiv).setStyles({
	   background: '#FFFFFF url(/styles/images/popup/bgProduit.png) no-repeat top left',
	   width: '450px',
	   height: '524px',
	   position: 'absolute',
	   border: '1px solid #9F9F9F',
	   top: '50%',
	   left: '50%',	   
	   marginLeft: '-225px',	   
	   marginTop: (getScrollTop()-262) + 'px',
	   zIndex: '1600',
	   visibility: 'hidden',
	   paddingLeft: '3px',
	   paddingTop: '3px',
	   paddingRight: '3px',
	   paddingBottom: '3px'
	});


		new Request({
			url : '/js/ajax/popupProduit.php',
			data:"produit_id=" + produit_id + "&type_id=" + type_id,
			onSuccess: function(req) {
				$(dataDiv).set('html',req);
				$$(fondDiv).setStyles({visibility: 'visible' });
				$$('select').setStyles({visibility: 'hidden' });
				$$(dataDiv).setStyles({visibility: 'visible' });				
			},
			evalScripts: true
			
		}).send();	

}

function checkamis(on) {
	
	
		new Request({
			url : '/js/ajax/popupProduit.php',
			method:'post',
			data:$('formamis').toQueryString(),
			onSuccess: function(req) {
				$(dataDiv).set('html',req);				
			},
			evalScripts: true
			
		}).send();		
		
}

function loadAdresse(obj) {
	
	if(obj.checked==true) {
		$('civ_id2').value=$('civ_id').value;
		$('adresse_societe2').value=$('adresse_societe').value;
		$('client_nom2').value=$('client_nom').value;
		$('client_prenom2').value=$('client_prenom').value;
		$('adresse_societe2').value=$('adresse_societe').value;
		$('adresse_rue21').value=$('adresse_rue').value;
		$('adresse_rue22').value=$('adresse_rue2').value;
		$('adresse_cp2').value=$('adresse_cp').value;
		$('adresse_ville2').value=$('adresse_ville').value;
		$('pays_id2').value=$('pays_id').value;
		$('bloc_fact_hide').style.display = "none";
	}else{
		$('bloc_fact_hide').style.display = "block";
	}
}


function displayAvis(){
	$$("#img_note li").each(function(element){	  
		element.addEvents({
			'mouseenter': function(){
				var chaine=element.id;
				var pos=chaine.length-1;
				var num=chaine.substr(pos,1);
				for(i=1;i<=num;i++){
					$('img_note_'+i).addClass('active');
				}
				$('notation_defaut').setStyle('display', 'none');
				$('notation_nom').setStyle('display', 'block');
				$('notation_nom').innerHTML=$('txt_note_'+num).value;
			},
			'click': function(){
				for(i=1;i<=5;i++){
					$('img_note_'+i).removeClass('active_click');
				}
				
				var chaine=element.id;
				var pos=chaine.length-1;
				var num=chaine.substr(pos,1);
				for(i=1;i<=num;i++){
					$('img_note_'+i).addClass('active_click');
				}
				$('notation_id').value=num;
				$('notation_nom_nom').value=$('notation_nom').innerHTML;
			},
			'mouseleave': function(){
				for(i=1;i<=5;i++){
					$('img_note_'+i).removeClass('active');
				}
				if($('notation_id').value==0){
					$('notation_nom').setStyle('display', 'none');
					$('notation_defaut').setStyle('display', 'block');
				}else{
					$('notation_nom').innerHTML=$('notation_nom_nom').value;
				}
			}
		});
	}); 
}

function initAvis(id){
	for(i=1;i<=id;i++){
		$('img_note_'+i).addClass('active');
	}
	$('notation_defaut').setStyle('display', 'none');
	$('notation_nom').setStyle('display', 'block');
	$('notation_nom').innerHTML=$('txt_note_'+id).value;
}


function openPaletteColor() {
	
	$('rcouleur_id').value="";
	
	if($('openpalette').style.display=="block") {
		$('openpalette').style.display="none";
		$('rcouleur_id').value="";
		$('lblcolor').innerHTML="PAR COULEUR";
		$('altcolor').innerHTML = "";
		document.forms['recherche_form'].submit();
	}else{
		$('openpalette').style.display="block";
		$('lblcolor').innerHTML="SANS COULEUR";
	}
	
}



function charge_couleur_recherche(couleur_id) {
	
	var c_id = couleur_id.replace("mcouleur_id_", ""); 
	
	$('rcouleur_id').value=c_id;
	$('openpalette').style.display="none";
	$('lblcolor').innerHTML="PAR COULEUR";
	
	document.forms['recherche_form'].submit();
	
}

function charge_couleur_intitule(alt) {
	$('altcolor').innerHTML = alt;
}

function showPaiementDesc(idForm)
{
	if(!fondDiv){
		fondDiv = document.createElement('div');
		fondDiv.style.position = 'absolute';
		document.body.appendChild(fondDiv);
	}
	fondDiv.innerHTML = '';
	//alert(getHeight());

	$(fondDiv).setStyles({
	   backgroundColor: '#000000',
	   width: '100%',
	   height: getScrollHeight(),
	   position: 'absolute',
	   opacity: '0.8',
	   overflow: 'hidden',
	   top: '0px',
	   zIndex: '1500',
	   visibility: 'hidden'
	});
	
	fondDiv.onclick = function () { removeDivPanier(); }
	
	if(!dataDiv){
		dataDiv = document.createElement('div');
		dataDiv.style.position = 'absolute';
		document.body.appendChild(dataDiv);
	}
	
	$(dataDiv).setStyles({
	   background: '#FFFFFF url(/styles/images/popup/bgProduit.png) no-repeat top left',
	   width: '424px',
	   height: '336px',
	   position: 'absolute',
	   border: '1px solid #9F9F9F',
	   top: '50%',
	   left: '50%',	   
	   marginLeft: '-225px',	   
	   marginTop: (getScrollTop()-336) + 'px',
	   zIndex: '1600',
	   visibility: 'visible',
	   paddingLeft: '15px',
	   paddingTop: '190px',
	   paddingRight: '15px',
	   paddingBottom: '3px'
	});
	
		dataDiv2 = document.createElement('div');
		dataDiv2.style.position = 'absolute';
		dataDiv.appendChild(dataDiv2);
	
	$(dataDiv2).setStyles({
	   position: 'absolute',
	   visibility: 'visible',
	   top: '185px',
	   left: '10px',
	   width: '435px',
	   height: '300px',
	   overflow: 'auto'
	});
	
		imgDiv = document.createElement('div');
		imgDiv.style.position = 'absolute';
		dataDiv.appendChild(imgDiv);

	$(imgDiv).setStyles({
		 background: '#FFFFFF url(/styles/images/popup/btn_fermer.png) no-repeat top left',
	   position: 'absolute',
	   visibility: 'visible',
	   bottom: '0px',
	   left: '150px',
	   width: '163px',
	   height: '37px',
	   cursor: 'pointer'
	});
	
	imgDiv.onclick = function () { removeDivPanier(); }

	var texte = $(idForm).innerHTML;
	$(dataDiv2).set('html',texte);
	$(fondDiv).setStyles({visibility: 'visible' });
}

function survolCouleur(myDiv,myId){
	Obj = document.getElementById(myDiv);
	if(Obj){
		var gauche = Obj.offsetLeft-10;
		var haut = Obj.offsetTop-10;

		if(!dataDiv){
			dataDiv = document.createElement('div');
			dataDiv.style.position = 'absolute';
			document.body.appendChild(dataDiv);
		}
		
		$(dataDiv).setStyles({
		   width: '30px',
		   height: '30px',
		   position: 'absolute',
		   border: '1px solid #CCC',
		   top: haut,
		   left: gauche,
		   zIndex: '1600',
		   visibility: 'visible',
		   cursor: 'pointer'
		});

		
		if(Obj.style.border == '1px solid rgb(255, 0, 0)'){
			$(dataDiv).setStyles({border: '1px solid red'});
		}
		
		var mySource = "<img src='"+Obj.src+"' alt='' style='width:30px;height:30px;' title='"+Obj.title+"'/>";
		$(dataDiv).set('html',mySource);
		
		dataDiv.onmouseout = function () { 
			if(dataDiv){
				$(dataDiv).dispose();
				dataDiv = false;
			}			
		}
		
		dataDiv.onclick = function(){
			updateoptvaleur(myId);
			$(dataDiv).setStyles({
			   border: '1px solid red'
			});
		}
	
	}
}


function openVideo(video_url) {
	/*$("body").popup({
  	popup:{
  		
      removeOnClick:{
          0:'#popup_retour',
          1:'#popup_valider',
          3:'#croix_blanche_popup'
      }, 		
  		
    	css:{
        'background':'#ffffff',
        'border':'#000 1px solid',    		
        'width':'750px',
        'height':'480px'
      }
    },
    ajax:'/js/ajax/openVideo.php',
    data:"video_url="+video_url
  });			*/
  
  
  if(!fondDiv){
		fondDiv = document.createElement('div');
		fondDiv.style.position = 'absolute';
		document.body.appendChild(fondDiv);
	}
	fondDiv.innerHTML = '';
	//alert(getHeight());

	$(fondDiv).setStyles({
	   backgroundColor: '#000000',
	   width: '100%',
	   height: getScrollHeight(),
	   position: 'absolute',
	   opacity: '0.8',
	   overflow: 'hidden',
	   top: '0px',
	   zIndex: '1500',
	   visibility: 'hidden'
	});

	fondDiv.onclick = function () { removeDivPanier(); }
	
	if(!dataDiv){
		dataDiv = document.createElement('div');
		dataDiv.style.position = 'absolute';
		document.body.appendChild(dataDiv);
	}
	
	$(dataDiv).setStyles({
	   background: '#ffffff',
	   width: '480px',
	   height: '330px',
	   position: 'absolute',
	   border: '1px solid #9F9F9F',
	   top: '50%',
	   left: '50%',	   
	   marginLeft: '-225px',	   
	   marginTop: (getScrollTop()-262) + 'px',
	   zIndex: '1600',
	   visibility: 'hidden',
	   paddingLeft: '3px',
	   paddingTop: '3px',
	   paddingRight: '3px',
	   paddingBottom: '3px'
	});


		new Request({
			url : '/js/ajax/openVideo.php',
			data:"video_url=" + video_url,
			onSuccess: function(req) {
				$(dataDiv).set('html',req);
				$$(fondDiv).setStyles({visibility: 'visible' });
				$$('select').setStyles({visibility: 'hidden' });
				$$(dataDiv).setStyles({visibility: 'visible' });
				
				flowplayer("player", "/media/flowplayer-3.1.5.swf", {
				    clip: {
					
				        url: video_url,
				        autoPlay: true,
				        autoBuffering: true,
				        scaling:'fit'
				    }
				});
								
			},
			evalScripts: true
			
		}).send();	
}


function trackevt(category, action) {
  try {
    var pageTracker=_gat._getTracker("UA-499425-1");
    pageTracker._trackEvent(category, action);
  }catch(err){}
}


/* NEW MENU */
function initMenu(){

    jQuery("#menu a.lien_menu_principal").each(function(i){

        jQuery(this).mouseenter(function(event){
            jQuery("#sous-" + jQuery(this).attr("id")).css('visibility', 'visible');
        });

        jQuery(this).mouseleave(function(event){
            jQuery("#sous-" + jQuery(this).attr("id")).css('visibility', 'hidden');
            jQuery(".sous-" + jQuery(this).attr("id")).css('visibility', 'hidden');
        });
    });

    jQuery(".sous-categorie").each(function(i){
        jQuery(this).mouseenter(function(event){
            jQuery("#" + jQuery(this).attr("id").substr(5)).addClass('onrollover');
            jQuery(this).css('visibility', 'visible');
        });

        jQuery(this).mouseleave(function(event){
            jQuery(this).removeClass('hover');
            jQuery("#" + jQuery(this).attr("id").substr(5)).removeClass('onrollover');
            jQuery(this).css('visibility', 'hidden');
        });
    });
}
/*-- NEW MENU */


function inscr_on(elts,etat) {
  
	if(etat == 1) {
		jQuery('#'+elts).addClass('inscr_on');
	}else if(etat == 2) {
    
		jQuery('#'+elts).removeClass('inscr_on');

		var elts_form = elts.split('form_');
		jQuery.ajax({
			type: "POST",
		  url: '/js/ajax/form_inscrcompte.php',
		  data:jQuery('#register').serialize()+'&data='+elts_form[1],
		  success: function(req) {
		  	if(req == "false" || req == "false_len" || req == "false_parrain" || req == "false_confirm" || req == "false_email") {
          
		  		jQuery('#'+elts).addClass('error_inscr_form');

          if(!document.getElementById('err'+elts_form[1]) && req == "false") {
            jQuery('#'+elts).append('<label id="err'+elts_form[1]+'" for="'+elts_form[1]+'" generated="true" class="error">Information obligatoire</label>');
          }

          jQuery('#'+elts+' label').each(function(i){
            if(jQuery(this).hasClass("valid")) {
              jQuery(this).css("display","none");
            }
          });
          if(elts_form[1] == "client_password") {
            jQuery("#min_carac").css("display","none");
          }
				}
				else {

          jQuery('#'+elts+' label').each(function(i){
            if(jQuery(this).hasClass("valid")) {
              jQuery(this).css("display","inline");
            }
          });

					jQuery('#err'+elts_form[1]).remove();
					jQuery('#'+elts).removeClass('error_inscr_form');
          if(elts_form[1] == "client_password") {
            jQuery("#min_carac").css("display","none");
          }
				}
		  }
		});		
		
/*
		jQuery("label[class^=error valid]").each(function(i){
			jQuery(this).parent().each(function(i){
				jQuery(this).parent().removeClass('error_inscr_form');
			});
		});
*/
	}
	else {
		jQuery('#'+elts).removeClass('inscr_on');

    jQuery('#'+elts+' label').each(function(i){
      if(jQuery(this).hasClass("valid")) {
        jQuery(this).css("display","inline");
      }
    });

		jQuery("label[class^=error valid]").each(function(i){
			jQuery(this).parent().each(function(i){
				jQuery(this).parent().removeClass('error_inscr_form');
			});
		});
		
	}
}



// PENDING : a normaliser
function rolloverPanier(){

    jQuery("#header_bloc_panier").mouseenter(function(event){
        //if(jQuery("#nb-prod-panier").text() > 0){
            jQuery("#header_bloc_panier").css('cursor', 'pointer');
            var pos = jQuery("#header_bloc_panier").position();

            jQuery.ajax({
                type: "POST",
                url: '/js/ajax/show_panier.php',
                success: function(html){
                	
                		data = html.split('|___|');
                		if(data[1]) {
                			// création de la div
	                    if (!jQuery("#rollover_panier").attr('id')) {
	                        jQuery("<div></div>").hide().attr("id", "rollover_panier").css({
	                            'left': (pos.left-93)+'px',
	                            'position': 'absolute',
	                            'top': (pos.top+77)+'px',
	                            'width': '250px',
	                            'z-index': '9998'
	                        }).html(data[0]).appendTo("#header_bandeau").show();
	                    }else{
	                        jQuery("#rollover_panier").html(data[0]);
	                    }
                			
                		}
                		else {
	                    // création de la div
	                    if (!jQuery("#rollover_panier").attr('id')) {
	                        jQuery("<div></div>").hide().attr("id", "rollover_panier").css({
	                            'left': (pos.left-93)+'px',
	                            'position': 'absolute',
	                            'top': (pos.top+77)+'px',
	                            'z-index': '9998'
	                        }).html(html).appendTo("#header_bandeau").show();
	                    }else{
	                        jQuery("#rollover_panier").html(html);
	                    }
                  	}
                    
                    jQuery("#rollover_panier").mouseenter(function(event){
                        jQuery("#rollover_panier").css('display','block');
                        jQuery("#header_bloc_panier").addClass('active');
                    });
                    jQuery("#rollover_panier").mouseleave(function(event){
                        jQuery("#rollover_panier").css('display','none');
                        jQuery("#header_bloc_panier").removeClass('active');
                    });
                    jQuery("#header_bloc_panier").mouseleave(function(event){
                        jQuery("#rollover_panier").css('display','none');
                    });


                }
            });
            jQuery("#rollover_panier").show();
            jQuery("#header_bloc_panier").addClass('active');
        //}
    });
    
    jQuery("#header_bloc_panier").mouseleave(function(event){
        jQuery("#rollover_panier").css('display','none');
        jQuery("#header_bloc_panier").removeClass('active');
        
    });
}


function rollover_account() {
	jQuery("#header_bloc_mon_compte").each(function(i){
    jQuery(this).mouseenter(function(event){
    	jQuery('#rollover_mon_compte').css('display','block');
        jQuery("#header_bloc_mon_compte").addClass('active');
    });
    jQuery(this).mouseleave(function(event){
    	jQuery('#rollover_mon_compte').css('display','none');
        jQuery("#header_bloc_mon_compte").removeClass('active');
    });  	
  });  
	
}

function updatePointRelais (addr1, addr2, cp, ville){
    jQuery('#mondial_relay_addr1').attr('value', addr1);
    jQuery('#mondial_relay_addr2').attr('value', addr2);
    jQuery('#mondial_relay_cp').attr('value', cp);
    jQuery('#mondial_relay_ville').attr('value', ville);
    jQuery('#addr_nomodifiable').html(addr1+'<br/>'+addr2+'<br/>'+cp+'&nbsp;'+ville);
}

function loadPointMondialRelay(){
    var cp = jQuery('#cp_mondial_relay').attr('value');
    var pays = jQuery('#pays_mondial_relay').attr('value');
	
    var html = '<div class="wrap-mr"><h3>Lieu de livraison</h3><div id="loader-mr" class="wrap-loader"><img src="/styles/images/ajax-loader.gif"></div></div>';
    jQuery('#col_lieu').html(html);
    jQuery('#col_lieu').css('display', 'block');
    jQuery.ajax({
        type: "POST",
        url: '/js/ajax/loadPointMondialRelay.php',
        data: "code_postal=" + cp+"&pays="+pays,
        success: function(msg){
            jQuery('#col_lieu').html(msg);
            jQuery('#col_lieu').css('display', 'block');
        }
    });
}
