var Navigateur = navigator.appName;

if(Navigateur == "Microsoft Internet Explorer")
	var ie = true;
else
	var ie = false;


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;
	}	
}


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 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: '#ffffff',
	   width: '100%',
	   opacity: '0.5',
	   height: getScrollHeight(),
	   position: 'absolute',
	   overflow: 'hidden',
	   top: '0px',
	   zIndex: '1500',
	   visibility: 'hidden'
	});

	if(!dataDiv){
		dataDiv = document.createElement('div');
		dataDiv.style.position = 'absolute';
		document.body.appendChild(dataDiv);
	}

	$(dataDiv).setStyles({
	   background: '#fff url(/charte/images/bg_popup_panier.gif) no-repeat top left',
	   width: '398px',
	   height: '398px',
	   position: 'absolute',
	   border: '1px solid #7f7f7f',
	   top: '50%',
	   left: '50%',	   
	   marginLeft: '-199px',	   
	   marginTop: (getScrollTop()-199) + 'px',	   	   	   
	   zIndex: '1600',
	   visibility: 'hidden'
	});

	new Ajax(
		'/js/ajax/panier-change.php',
		{
			method: 'get',
			update: dataDiv,
			data:$(idForm).toQueryString(),
			onSuccess: function(req) {

					$$(fondDiv).setStyles({visibility: 'visible' });
					$$('select').setStyles({visibility: 'hidden' });
					$$(dataDiv).setStyles({visibility: 'visible' });
	
					new Ajax(
						'/js/ajax/updatePanier.php',
						{
							update: $('inc_panier')
						}
					).request();
			},
			evalScripts: true
		}
	).request();
}


// Ajout au panier
function addNewsletter(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: '1500',
	   visibility: 'hidden'
	});

	if(!dataDiv){
		dataDiv = document.createElement('div');
		dataDiv.style.position = 'absolute';
		document.body.appendChild(dataDiv);
	}
	
	dataDiv.innerHTML = '';

	$(dataDiv).setStyles({
	   background: '#fff url(/charte/images/bg_popup_panier.gif) no-repeat top left',
	   width: '398px',
	   height: '398px',
	   position: 'absolute',
	   border: '1px solid #7f7f7f',
	   top: '50%',
	   left: '50%',	   
	   marginLeft: '-199px',	   
	   marginTop: (getScrollTop()-199) + 'px',	   	   	   
	   zIndex: '1600',
	   visibility: 'hidden'
	});
	
	new Ajax(
		'/js/ajax/newsletter.php',
		{
			method: 'get',
			update: dataDiv,
			data:$(idForm).toQueryString(),
			onSuccess: function(req) {
				$$(fondDiv).setStyles({visibility: 'visible' });
				$$('select').setStyles({visibility: 'hidden' });
				$$(dataDiv).setStyles({visibility: 'visible' });
				$(idForm).newsletter_email.value='';				
			},
			evalScripts: true
		}
	).request();
}

function removeDivPanier()
{
	if(fondDiv){
		$(fondDiv).remove();
		fondDiv = false;
	}	
	if(dataDiv){
		$(dataDiv).remove();
		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;
	conteneur = 'conteneur_lst_img'+idProd;
	
	vartop=getTop(imglist)-getTop(conteneur);
	varleft=getLeftImg(imglist)-getLeftImg(conteneur);
		
	$(div).style.top=-45 + 'px';
	$(div).style.left=-20 + 'px';
	$(div).style.zIndex=99999;
	$(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';
	}*/
	
	if(id){
		var d = document.getElementById(id);
			
		for (var i = 1; i<=20; i++) {
			if(document.getElementById('smenu_cat'+i)) document.getElementById('smenu_cat'+i).style.display='none';
			if(document.getElementById('smenu_gam'+i)) document.getElementById('smenu_gam'+i).style.display='none';
		}
			
		if (d && id) {d.style.display='block';}	
	}else{

		for (var i = 1; i<=20; i++) {
			if(document.getElementById('smenu_cat'+i)) document.getElementById('smenu_cat'+i).style.display='none';
			if(document.getElementById('smenu_gam'+i)) document.getElementById('smenu_gam'+i).style.display='none';
		}
	}
}

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 check_add_panier_ajax() {
	
	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.5',
	   overflow: 'hidden',
	   top: '0px',
	   left: '0px',
	   zIndex: '1500',
	   visibility: 'hidden'
	});

	if(!dataDiv){
		dataDiv = document.createElement('div');
		dataDiv.style.position = 'absolute';
		document.body.appendChild(dataDiv);
	}

	$(dataDiv).setStyles({
	   backgroundColor: '#000000',
	   width: '300px',
	   height: '300px',
	   position: 'absolute',
	   border: '1px solid #000',
	   top: '50%',
	   left: '50%',	   
	   marginLeft: '-150px',	   
	   marginTop: (getScrollTop()-150) + 'px',	   	   	   
	   zIndex: '1600',
	   visibility: 'hidden'
	});	

	new Ajax(
		'/js/ajax/panier-save.php',
		{
			update: dataDiv,
			onSuccess: function(req) {

					$$(fondDiv).setStyles({visibility: 'visible' });
					$$('select').setStyles({visibility: 'hidden' });
					$$(dataDiv).setStyles({visibility: 'visible' });
	
			},
			evalScripts: true
		}
	).request();	
}

function check_add_panier_ajax2(id) {
	check_add_panier(id);
}


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');
}


// Ajout WishList
function addWishlist(produit_id, client_id) {
	new Ajax(
		'/js/ajax/addwishlist.php',
		{
			method: 'post',
			data:"produit_id="+produit_id+"&client_id="+client_id,
			onSuccess: function(req) {
				alert(req);	
			},
			evalScripts: true
		}
	).request();
}



function updateInfoStock(id) {
	
	
	new Ajax(
		'/js/ajax/updateInfoStock.php',
		{
			method: 'post',
			data:"produit_attribut_id="+id,
			onSuccess: function(req) {
					$('maj_stock_attr').innerHTML = req;
			},
			evalScripts: true
		}
	).request();		
}


function showMenuW(id, obj)
{
	//console.log('on = ' + id);
	var height_fx = new Fx.Style('submenuw_' + id,'height')

	
	var Pos = $(obj).getPosition();
	var nb = $('sub_' + id).getChildren().length
	
	$('submenuw_' + id).style.display = 'block';	
	
	$('submenuw_' + id).style.left = Pos.x - 2 + 'px';
	//console.log('left'+ $(id).style.left)

	height_fx.stop();
	height_fx.start(nb*31);	
}

function hideMenuW(id, obj)
{
	//console.log('off = ' + id);
	
	var height_fx = new Fx.Style('submenuw_' + id,'height')	
	$('submenuw_' + id).style.display = 'none';	
	height_fx.stop();
	height_fx.start('0');	
}

function init_menu(selected_section){
	
	var main_menu_items = $$('.sousmenu');
	//console.log(main_menu_items.length);
	
	main_menu_items.each(function(item){
			
			//console.log(item.id);		
			data = item.id.split('_');	
			//console.log('categorie_id = ' + data[1]);		

			if($('sub_' + data[1]))
			{
				submenu = $('sub_' + data[1]);
				
				var height_fx = new Fx.Style($('sub_' + data[1]),'height')
				
				var nb = $('sub_' + data[1]).getChildren().length
				
				//var Pos = $('supermenu_' + data[1]).getPosition();
				//$('submenuw_' + data[1]).style.left = Pos.x - 2 + 'px';
				
				//console.log('nb = ' + nb);		

			

				//--deb
				item.addEvent('mouseenter',function(e){
					//$$('input').setStyles({visibility: 'hidden' });
					item.addClass('active');


					e = new Event(e)
					
					// calculate the submenu new item
					height_fx.stop()
					height_fx.start(nb*29)
					//console.log('sdsd'+submenu.id);
					submenu.getChildren().each(function(submenu_item){
						//console.log('pwet');
						submenu_item.addEvent('mouseover',function(e){
							// change color
							//submenu_item.addClass('active');
							// end of submenu_item.addEvent('mouseover')
						})
						submenu_item.addEvent('mouseout',function(e){
							// change color
							//submenu_item.removeClass('active');
							// end of submenu_item.addEvent('mouseout')
						})
					})

					e.stop()
					// end of item.addEvent('mouseenter')
				})
				//--deb

				
				//--deb
				item.addEvent('mouseleave',function(e){
					item.removeClass('active');

					
					e = new Event(e)
					height_fx.stop()
					height_fx.start(0)
					// change color
					e.stop()

					//$$('input').setStyles({visibility: 'visible' });
					
					// end of item.addEvent('mouseleave')
				})
				//--deb


			} //ifsubmenu


			
		


	// end of each
	})
	
// end of function
}





function addTemoignage(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.5',
	   overflow: 'hidden',
	   top: '0px',
	   left: '0px',
	   zIndex: '1500',
	   visibility: 'hidden'
	});

	if(!dataDiv){
		dataDiv = document.createElement('div');
		dataDiv.style.position = 'absolute';
		document.body.appendChild(dataDiv);
	}

	$(dataDiv).setStyles({
	   backgroundColor: '#000000',
	   width: '395px',
	   height: '330px',
	   position: 'absolute',
	   border: '1px solid #000',
	   top: '50%',
	   left: '50%',	   
	   marginLeft: '-150px',	   
	   marginTop: (getScrollTop()-150) + 'px',	   	   	   
	   zIndex: '1600',
	   visibility: 'hidden'
	});

	new Ajax(
		'/js/ajax/addTemoignage.php',
		{
			update: dataDiv,
			data:$(idForm).toQueryString(),
			onSuccess: function(req) {

					$$(fondDiv).setStyles({visibility: 'visible' });
					$$('select').setStyles({visibility: 'hidden' });
					$$(dataDiv).setStyles({visibility: 'visible' });
	
			},
			evalScripts: true
		}
	).request();	
}

function ShowDesc(nom)
{
	$('produit_desc').innerHTML=nom;
}


function loadNewImage(produit_image_loupe, produit_image_zoom, produit_image_detail, produit_image_mini, produit_image_nom) {
	new Ajax(
		'/js/ajax/photoprod.php',
		{
			method: 'post',
			data:"produit_image_loupe="+produit_image_loupe+"&produit_image_zoom="+produit_image_zoom+"&produit_image_detail="+produit_image_detail+"&produit_image_mini="+produit_image_mini+"&produit_image_nom="+produit_image_nom,			
			update: $('conteneur_photoprod'),
			onSuccess: function(req) {
				edz_smallLoaded(document.getElementById('photoprod'));
				edz_bigLoaded(document.getElementById('photobig'));
			}
		}
	).request();	
}


// 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 setProduitAttribut(produit_option_valeur_id, produit_option_valeur_id_bis, produit_id) {

	new Ajax(
		'/js/ajax/setProduitAttribut.php',
		{
			data:"produit_option_valeur_id="+produit_option_valeur_id+"&produit_option_valeur_id_bis="+produit_option_valeur_id_bis+"&produit_id="+produit_id,
			onSuccess: function(req) {
				$('produit_attribut_id').value = req;
				
				// On met à jours les infos produit / attribut / prix / stock :-) ... Si pas de probleme sur produit attribut
				// Trop simple avec ce systeme !				
				if(req > 0){
					updateInfosProduit($('produit_id').value,req,$('produit_get_video').value);
				}
			},
			evalScripts: true
		}
	).request();	


	//alert(produit_attribut_id + " " + produit_attribut_id_bis);
}

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 chargeCouleur(produit_id, produit_option_valeur_id) {
	new Ajax(
		'/js/ajax/chargeCouleur.php',
		{
			update: $('selectcolor'),
			data:"produit_id="+produit_id+"&produit_option_valeur_id="+produit_option_valeur_id,
			onSuccess: function(req) {
				//if($('produit_option_valeur_id_bis')) $('produit_option_valeur_id_bis').options[0].selected= true;
				setProduitAttribut($('produit_option_valeur_id').value, $('produit_option_valeur_id_bis').value, $('produit_id').value);
			},
			evalScripts: true
		}
	).request();	
}


function updateInfosProduit(produit_id, produit_attribut_id, produit_get_video) {
	new Ajax(
		'/js/ajax/updateInfosProduit.php',
		{
			update: $('info_bloc_prix'),
			data:"&produit_id="+produit_id+"&produit_attribut_id="+produit_attribut_id+"&produit_get_video="+produit_get_video,
			onSuccess: function(req) {

			},
			evalScripts: true
		}
	).request();	
	
}

function select_region(region, selectid) {
	new Ajax(
		'/js/ajax/selectRegion.php',
		{
			update: $(selectid),
			data:"region_id="+region,
			onSuccess: function(req) {
			},
			evalScripts: true
		}
	).request();	
}

function select_pays(pays_id, selectid) {
	if(pays_id==73){
		$(selectid).setStyle('display', 'block');
	}else{
		$(selectid).setStyle('display', 'none');
		$(selectid).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 addTri(val){
	$('order').value=val;
	$('filtrer').submit();	
}

function deposerAnnonce(action){

	var fx = new Fx.Styles('conteneur_depose_annonce', {duration:400, wait:false});
	
	var content1 = $('deposer_annonce');
	var c1Height = content1.getSize().scrollSize.y;
	c1Height += 100;

	if(action=='display'){
		fx.start({
				'height' : c1Height
		});		
	}else{
		fx.start({
				'height' : 0
		});
	
		//on vide tous les champs du formulaire
		 $$("#deposer input[class=input_texte]").each(function(inp){
        inp.value='';
    }); 
    
    $$("#deposer textarea").each(function(inp){
        inp.value='';
    }); 
    
    $$("#deposer select").each(function(inp){
        inp.selectedIndex=0;
    }); 
    
    //on remet tous les departements
    new Ajax(
		'/js/ajax/selectRegion.php',
		{
			update: $('depose_departement_id'),
			data:"region_id=",
			onSuccess: function(req) {
			},
			evalScripts: true
		}
	).request();	
	}
}

function sendAnnonce(idForm){
	new Ajax(
		'/js/ajax/validAnnonce.php',
		{
			update: $('conteneur_depose_annonce'),
			method: 'post',
			data:$(idForm).toQueryString(),
			onSuccess: function(req) {	
			},
			evalScripts: true
		}
	).request();
}

function modifAnnonce(idForm){
	new Ajax(
		'/js/ajax/validAnnonce.php',
		{
			update: $('deposer_annonce'),
			method: 'post',
			data:$(idForm).toQueryString(),
			onSuccess: function(req) {	
			},
			evalScripts: true
		}
	).request();
}

function deposerAvis(action){
	var fx = new Fx.Styles('conteneur_depose_avis', {duration:400, wait:false});

	var content1 = $('deposer_avis');
	var c1Height = content1.getSize().scrollSize.y;
	c1Height += 30;
	
	if(action=='display'){
		fx.start({
			'height' : c1Height
		});
	}else{
		fx.start({
			'height' : 0
		});
		
		//on vide tous les champs du formulaire
		 $$("#deposer_av input[class=input_texte]").each(function(inp){
        inp.value='';
    }); 
    
    $$("#deposer_av textarea").each(function(inp){
        inp.value='';
    }); 
    
    $$("#deposer_av select").each(function(inp){
        inp.selectedIndex=0;
    }); 
    
	}
}

function lireAvis(action){
	var fx = new Fx.Styles('conteneur_lire_avis', {duration:400, wait:false});
	
	var content1 = $('lire_avis');
	var c1Height = content1.getSize().scrollSize.y;
	c1Height += 30;


	if(action=='display'){
		fx.start({
				'height' : c1Height
		});		
	}else{
		fx.start({
				'height' : 0
		});
	}
}


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 sendAvis(idForm){
	new Ajax(
		'/js/ajax/validAvis.php',
		{
			update: $('conteneur_depose_avis'),
			method: 'post',
			data:$(idForm).toQueryString(),
			onSuccess: function(req) {	
			},
			evalScripts: true
		}
	).request();
}

function ouvreVideo(video)
{
	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: '1500',
	   visibility: 'hidden'
	});

	if(!dataDiv){
		dataDiv = document.createElement('div');
		dataDiv.style.position = 'absolute';
		document.body.appendChild(dataDiv);
	}

	$(dataDiv).setStyles({
	   background: '#fff url(/charte/images/bg_popup_panier.gif) no-repeat top left',
	   width: '398px',
	   height: '398px',
	   position: 'absolute',
	   border: '1px solid #7f7f7f',
	   top: '50%',
	   left: '50%',	   
	   marginLeft: '-199px',	   
	   marginTop: (getScrollTop()-199) + 'px',	   	   	   
	   zIndex: '1600',
	   visibility: 'hidden'
	});

	new Ajax(
		'/js/ajax/ouvre_video.php',
		{
			method: 'post',
			update: dataDiv,
			data:"video="+video,
			onSuccess: function(req) {

					$$(fondDiv).setStyles({visibility: 'visible' });
					$$('select').setStyles({visibility: 'hidden' });
					$$(dataDiv).setStyles({visibility: 'visible' });
			},
			evalScripts: true
		}
	).request();
}


function displayPanier(){
	var fx = new Fx.Styles('conteneur_panier', {duration:400, wait:false});
	
	var content1 = $('display_panier');
	var c1Height = content1.getSize().scrollSize.y;
	c1Height += 90;
	
	if($('conteneur_panier').getStyle('height').toInt()==0){
		fx.start({
				'height' : c1Height
		});		
	}else{
		fx.start({
				'height' : 0
		});
	}
}

function displayRefCmd(){
	var fx = new Fx.Styles('conteneur_ref_cmd', {duration:400, wait:false});
	
	var content1 = $('display_form_cmd_ref');
	var c1Height = content1.getSize().scrollSize.y;
	c1Height += 20;
	
	if($('conteneur_ref_cmd').getStyle('height').toInt()==0){
		fx.start({
				'height' : c1Height
		});		
	}else{
		fx.start({
				'height' : 0
		});
	}
}