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;

var IE7 = 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 7") != -1) IE7 = true;

jQuery(document).ready(function(){	
	jQuery("#slider-head").easySlider({
		auto: true,
		continuous: true,
		vertical:true,
		prevText: '',
		nextText: ''
	});
});

function writemacos() {
  if (navigator.appVersion.indexOf("Win") != -1) {
  }else{
    document.write("<link rel='stylesheet' href='/styles/content-mac.css' type='text/css'>");
  }
}

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: '#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: '#FFFFFF',
	   width: '398px',
	   height: '239px',
	   position: 'absolute',
	   border: '1px solid #7f7f7f',
	   top: '50%',
	   left: '50%',	   
	   marginLeft: '-149px',	   
	   marginTop: (getScrollTop()-119) + 'px',	   	   	   
	   zIndex: '1600',
	   visibility: 'hidden'
	});
	  
	new Ajax(
		'/js/ajax/panier-change.php',
		{
			method: 'post',
			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: $('header_panier')
						}
					).request();
			},
			evalScripts: true
		}
	).request();
}

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',
	   width: '398px',
	   height: '239px',
	   position: 'absolute',
	   border: '1px solid #9F9F9F',
	   top: '50%',
	   left: '50%',	   
	   marginLeft: '-149px',	   
	   marginTop: (getScrollTop()-119) + 'px',
	   zIndex: '1600',
	   visibility: 'hidden',
	   paddingLeft: '3px',
	   paddingTop: '3px',
	   paddingRight: '3px',
	   paddingBottom: '3px'
	});

	new Ajax(
		'/js/ajax/addNewsletter.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 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;
	
	vartop=getTop(imglist)-getTop($('pre_centre'));
	varleft=getLeftImg(imglist)-getLeftImg($('pre_centre'));
	
	if(IE6) {
		$(div).style.top=vartop-135+95 + 'px';
		$(div).style.left=varleft-78 + 'px';
	}else if(IE7){
		$(div).style.top=vartop-135+87 + 'px';
		$(div).style.left=varleft-78 + 'px';				
	}else if(ie){
		$(div).style.top=vartop-135+93 + 'px';
		$(div).style.left=varleft-55 + 'px';		
	}else{
		$(div).style.top=vartop-40 + 'px';
		$(div).style.left=varleft-55 + '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 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-1;
				

				//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*27)+14)
					
					//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) {

	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,
			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);
			},
			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);
			},
			evalScripts: true
		}
	).request();	
}


function updateInfosProduit(produit_id, produit_attribut_id) {
	
	new Ajax(
		'/js/ajax/updateInfosProduit.php',
		{
			update: $('info_bloc_prix'),
			data:"&produit_id="+produit_id+"&produit_attribut_id="+produit_attribut_id,
			onSuccess: function(req) {

			},
			evalScripts: true
		}
	).request();	
	
}


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: '1500',
	   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: '626px',
	   height: '705px',
	   position: 'absolute',
	   border: '1px solid #9F9F9F',
	   top: '50%',
	   left: '50%',	   
	   marginLeft: '-313px',	   
	   marginTop: (getScrollTop()-352) + 'px',
	   zIndex: '1600',
	   visibility: 'hidden',
	   paddingLeft: '3px',
	   paddingTop: '3px',
	   paddingRight: '3px',
	   paddingBottom: '3px'
	});

	new Ajax(
		'/js/ajax/pop_zoom.php',
		{
			update: dataDiv,
			data:"produit_id=" + produit_id + "&produit_image_id=" + produit_image_id,
			onSuccess: function(req) {

					$$(fondDiv).setStyles({visibility: 'visible' });
					$$('select').setStyles({visibility: 'hidden' });
					$$(dataDiv).setStyles({visibility: 'visible' });

			},
			evalScripts: true
		}
	).request();
}

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 Ajax(
			'/js/ajax/calcul_prix_maj.php',
			{
				
				data:"produit_id="+produit_id+"&produit_attribut_id="+produit_attribut_id,
				onSuccess: function(req) {
					
					//	var total = parseFloat(prix) +  ( parseFloat(req) * parseInt($('qtetxt').value) );
					$('produit_prix').innerHTML = parseFloat(req).toFixed(2)+' &euro;';
					
				},
				evalScripts: true
			}
		).request();	
	

		new Ajax(
			'/js/ajax/calcul_prix_maj_barre.php',
			{
				
				data:"produit_id="+produit_id+"&produit_attribut_id="+produit_attribut_id,
				onSuccess: function(req) {
					
				//	var total = parseFloat(prix) +  ( parseFloat(req) * parseInt($('qtetxt').value) );
					if($('choix_px_sspromo')) $('choix_px_sspromo').innerHTML = parseFloat(req).toFixed(2)+' &euro;';
					
				},
				evalScripts: true
			}
		).request();			
		
		
		new Ajax(
			'/js/ajax/calcul_stock.php',
			{
				update: $('produit_stock'),
				data:"produit_id="+produit_id+"&produit_attribut_id="+id,
				onSuccess: function(req) {
					

				},
				evalScripts: true
			}
		).request();			
		

		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 = "#DCB13E";
		$('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 = "none";
		});

				

		$('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 Ajax(
		'/js/ajax/popupProduit.php',
		{
			update: dataDiv,
			data:"produit_id=" + produit_id + "&type_id=" + type_id,
			onSuccess: function(req) {

					$$(fondDiv).setStyles({visibility: 'visible' });
					$$('select').setStyles({visibility: 'hidden' });
					$$(dataDiv).setStyles({visibility: 'visible' });

			},
			evalScripts: true
		}
	).request();
}

function checkamis(on) {
	new Ajax(
		'/js/ajax/popupProduit.php',
		{
			method:'post',
			update: dataDiv,
			data:$('formamis').toQueryString(),
			onSuccess: function(req) {
				update:$('arrDebug')
			},
			evalScripts: true
		}
	).request();		
	
	
	
	

}

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;
	}
}


function deposerAvis(action){
	var fx = new Fx.Styles('deposer_avis', {duration:400, wait:false});

	if(action=='display'){
		fx.start({
				'margin-top' : 20
		});
	}else{
		fx.start({
				'margin-top' : -500
		});
		
		//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++){
		if($('img_note_'+i)) $('img_note_'+i).addClass('active');
	}
	if($('notation_defaut')) $('notation_defaut').setStyle('display', 'none');
	if($('notation_nom')) $('notation_nom').setStyle('display', 'block');
	if($('notation_nom')) $('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 openEmballageProduit(idForm, obj) {
	if(obj.checked==true) {
		
		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 () { 
			if($('emballage')) $('emballage').checked=false;
			if($('emballage_cadeau')) $('emballage_cadeau').value = '';
			if($('emballage_cadeau_message')) document.getElementById('emballage_cadeau_message').value = '';
			removeDivPanier(); 
		}
		
		if(!dataDiv){
			dataDiv = document.createElement('div');
			dataDiv.style.position = 'absolute';
			document.body.appendChild(dataDiv);
		}
		
		$(dataDiv).setStyles({
		   background: '#FFFFFF',
		   width: '399px',
		   height: '405px',
		   position: 'absolute',
		   border: '1px solid #9F9F9F',
		   top: '50%',
		   left: '50%',	   
		   marginLeft: '-199px',	   
		   marginTop: (getScrollTop()-202) + 'px',
		   zIndex: '1600',
		   visibility: 'hidden',
		   paddingLeft: '3px',
		   paddingTop: '3px',
		   paddingRight: '3px',
		   paddingBottom: '3px'
		});
	
		new Ajax(
			'/js/ajax/addEmballage.php',
			{
				update: dataDiv,
				data:$(idForm).toQueryString(),
				onSuccess: function(req) {
	
						$$(fondDiv).setStyles({visibility: 'visible' });
						$$('select').setStyles({visibility: 'hidden' });
						$$(dataDiv).setStyles({visibility: 'visible' });
				},
				evalScripts: true
			}
		).request();		
		
	}else{
			if($('emballage')) $('emballage').checked=false;
			if($('emballage_cadeau')) $('emballage_cadeau').value = '';
			if($('emballage_cadeau_message')) document.getElementById('emballage_cadeau_message').value = '';		
	}
}




function traitementCadeauPanier(produit_id, produit_attribut_id, pos,obj) {
	if(obj.checked==true) {
		
		$('panier_desc_message2'+pos).style.display = 'block';
		
		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 () { 

			 
		}
		
		if(!dataDiv){
			dataDiv = document.createElement('div');
			dataDiv.style.position = 'absolute';
			document.body.appendChild(dataDiv);
		}
		
		$(dataDiv).setStyles({
		   background: '#FFFFFF',
		   width: '399px',
		   height: '405px',
		   position: 'absolute',
		   border: '1px solid #9F9F9F',
		   top: '50%',
		   left: '50%',	   
		   marginLeft: '-199px',	   
		   marginTop: (getScrollTop()-202) + 'px',
		   zIndex: '1600',
		   visibility: 'hidden',
		   paddingLeft: '3px',
		   paddingTop: '3px',
		   paddingRight: '3px',
		   paddingBottom: '3px'
		});
	
		new Ajax(
			'/js/ajax/addEmballagePanier.php',
			{
				update: dataDiv,
				data:"produit_id="+produit_id+"&produit_attribut_id="+produit_attribut_id+"&position="+pos,
				onSuccess: function(req) {
	
						$$(fondDiv).setStyles({visibility: 'visible' });
						$$('select').setStyles({visibility: 'hidden' });
						$$(dataDiv).setStyles({visibility: 'visible' });
				},
				evalScripts: true
			}
		).request();		
		
	}else{
		
		new Ajax(
			'/js/ajax/addEmballagePanier.php',
			{
				update: dataDiv,
				data:"produit_id="+produit_id+"&produit_attribut_id="+produit_attribut_id+"&position="+pos+"&del=1",
				onSuccess: function(req) {

				},
				evalScripts: true
			}
		).request();			
		
		if($('produit_emballe_cadeau'+pos)) $('produit_emballe_cadeau'+pos).checked=false;
		if($('panier_desc_message2'+pos)) $('panier_desc_message2'+pos).style.display = 'none';
	}	
}

function addEmballage(produit_id, produit_attribut_id, position, message) {
		new Ajax(
			'/js/ajax/addEmballagePanier.php',
			{
				update: dataDiv,
				data:"produit_id="+produit_id+"&produit_attribut_id="+produit_attribut_id+"&position="+position+"&message="+message+"&add=1",
				onSuccess: function(req) {
	
				},
				evalScripts: true
			}
		).request();					
}

//ouvre popup-div : agrandissement image galerie
function popupGalerie(chemin)
{
	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.6',
	   overflow: 'hidden',
	   top: '0px',
	   zIndex: '1500',
	   visibility: 'visible',
	   cursor: 'pointer'
	});

	if(!dataDiv){
		dataDiv = document.createElement('div');
		dataDiv.style.position = 'absolute';
		document.body.appendChild(dataDiv);

	}
	fondDiv.onclick = function () { removeDivPanier(); }
	$(dataDiv).setStyles({
		 color: '#ffffff',
		 textAlign: 'right',
	   backgroundColor: '#ffffff',
	   position: 'absolute',
//	   border: '0px solid #fff',
	   top: '50%',
	   left: '50%', 
	   marginLeft: '-400px',	   
	   marginTop: (getScrollTop()-300) + 'px',	   	   	   
	   zIndex: '1600',
	   visibility: 'visible'
	});
	
	$(dataDiv).innerHTML = '<a style="color:#DCB13E;font-size:12px;padding:5px;font-weight:bold;" onclick="javascript:fondDiv.style.display=\'none\'; dataDiv.style.display=\'none\'; fondDiv=0; dataDiv=0; return false;" href="#">Fermer</a>';
	$(dataDiv).innerHTML += "<br /><img style='border:2px #fff solid;' id='img' width='800' src='"+chemin+"' alt='"+chemin+"'/>";
}

function loadSlideShow(){
    if(jQuery("#slideshow_pub").attr('id')){
        jQuery("#slideshow_pub").showcase({
            animation: {
                type: "fade",
                stopOnHover: true,
                speed: 600
            },
            navigator:{
                position: "bottom-right",
                css: {
                    /*padding:"0px 5px 15px 0px",*/
                    "z-index": 1100
                },
                showNumber: true,
                item: {
                    css: {
                        height:"24px",
                        "line-height":"24px",
                        width:"26px",
                        color: "#FFFFFF",
                        "font-weight":"bold",
                        "font-size":"16px",
                        backgroundColor: "transparent",
                        border: "none",
                        background:"url(/styles/images/index/btn-slide-off.png) no-repeat",
                        margin: "0px 10px 0px 0px",
                        "text-align": "center",
                        "vertical-align": "middle"
                    },
                    cssHover: {
                        color: "#FFFFFF",
                        backgroundColor: "transparent",
                        background:"url(/styles/images/index/btn-slide-on.png) no-repeat",
                        border: "none"
                    },
                    cssSelected: {
                        color: "#FFFFFF",
                        backgroundColor: "transparent",
                        background:"url(/styles/images/index/btn-slide-on.png) no-repeat",
                        border: "none"
                    }
                }
            },
            titleBar: {
                enabled: false
            }
        });
    }
}

function lancer_recherche(){
	if(jQuery("#motclef").attr('value').length <= 3){
		//alert("Votre recherche doit comporter au moins 4 lettres.");
		
	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: '398px',
	   height: '239px',
	   position: 'absolute',
	   border: '1px solid #9F9F9F',
	   top: '50%',
	   left: '50%',	   
	   marginLeft: '-149px',	   
	   marginTop: (getScrollTop()-119) + 'px',
	   zIndex: '1600',
	   visibility: 'hidden',
	   paddingLeft: '3px',
	   paddingTop: '3px',
	   paddingRight: '3px',
	   paddingBottom: '3px'
	});
		
	new Ajax(
		'/js/ajax/showerreur.php',
		{
			update: dataDiv,
			onSuccess: function(req) {

					$$(fondDiv).setStyles({visibility: 'visible' });
					$$('select').setStyles({visibility: 'hidden' });
					$$(dataDiv).setStyles({visibility: 'visible' });
			},
			evalScripts: true
		}
	).request();
		
		return false;
	} else {
		document.recherche_formulaire.submit();
		return true;
	}
}
