var Navigateur = navigator.appName;

if(Navigateur == "Microsoft Internet Explorer")
	var ie = true;
else
	var ie = false;
	

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 popupcalc(montant){
		var win2 = window.open("http://www.receiveandpay.com/wallet/customer/calculette.php?MerchantID=10105&Amount="+montant ,'popup','height=503,width=600,status=yes,scrollbars=yes,menubar=no,resizable=yes');
}

function bg_color(color){
	if(color){
		color = jQuery.trim(color);
		//document.getElementById('body2').style.backgroundColor = '#c0c0c0';
		document.getElementById('body2').style.backgroundColor = '#'+color+'';
	}
}
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 = '';
	//alert(getHeight());

	$(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({
	   width: '521px',
	   height: '356px',
	   position: 'absolute',
	   top: '50%',
	   left: '50%',	   
	   marginLeft: '-300px',	   
	   marginTop: (getScrollTop()-200) + 'px',
	   zIndex: '1600'
	});

	new Ajax(
		'/js/ajax/panier-change.php',
		{
			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',
						{
							onSuccess: function(req) {
								document.getElementById('nbprodpanier').innerHTML = '('+req+')';
							}
						}
					).request();
			},
			evalScripts: true
		}
	).request();
}

// Ajout au panier
function addNewsletter(idForm) {
	
	new Ajax(
		'/js/ajax/newsletter.php',
		{
			method: 'post',
			data:$(idForm).toQueryString(),
			onSuccess: function(req) {
				$(idForm).newsletter_email.value='';
				if(req!="nomail") alert(req);
				
			},
			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($('conteneur_global'));
	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)-getLeftImg($('header_gauche'));
		
	$(div).style.top=vartop-135+85 + 'px';
	$(div).style.left=varleft-135+85 + '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 defilePause() {
	iScroll=0;
}


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 checkQuestion() {
	if(document.ami.ok.value==1)
		document.ami.submit();
	else
		alert("Merci de remplir vos coordonnees");
}

function checkField(field)
	{
		if(field.value.length>0)
		{
			field.className="ok";
			document.ami.ok.value=1;
		}
		else
		{
			field.className="ko";
			document.ami.ok.value=0;
		}
		//alert(field.value);
	}

function removeDivPanier()
{
	if(fondDiv){
		$(fondDiv).remove();
		fondDiv = false;
	}	
	if(dataDiv){
		$(dataDiv).remove();
		dataDiv = false;
	}
	$$('select').setStyles({visibility: 'visible' });		
}

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.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({
	   backgroundColor: '#000000',
	   width: '300px',
	   height: '220px',
	   position: 'absolute',
	   border: '1px solid #755647',
	   top: '50%',
	   left: '50%',	   
	   marginLeft: '-150px',	   
	   marginTop: (getScrollTop()-110) + 'px',	   	   	   
	   zIndex: '1600',
	   visibility: 'hidden'
	});

	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' });
					
					/*
					new Ajax(
						'/js/ajax/updatePanier.php',
						{
							update: $('footer_panier')
						}
					).request();
					*/
			},
			evalScripts: true
		}
	).request();
}

function addPopup()
{
	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',
	   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: '220px',
	   position: 'absolute',
	   border: '1px solid #000',
	   top: '50%',
	   left: '50%',	   
	   marginLeft: '-150px',	   
	   marginTop: (getScrollTop()-110) + 'px',	   	   	   
	   zIndex: '1600',
	   visibility: 'hidden'
	});

	new Ajax(
		'/js/ajax/addPopup.php',
		{
			update: dataDiv,
			onSuccess: function(req) {

					$$(fondDiv).setStyles({visibility: 'visible' });
					$$('select').setStyles({visibility: 'hidden' });
					$$(dataDiv).setStyles({visibility: 'visible' });
			},
			evalScripts: true
		}
	).request();
}


function descTechnique(id_prod)
{
	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',
	   zIndex: '1500',
	   visibility: 'hidden'
	});

	if(!dataDiv){
		dataDiv = document.createElement('div');
		dataDiv.style.position = 'absolute';
		document.body.appendChild(dataDiv);
	}
	
	fondDiv.onclick = function () { removeDivPanier(); }

	$(dataDiv).setStyles({
	   backgroundColor: '#ffffff',
	   width: '600px',
	   height: '440px',
	   position: 'absolute',
	   border: '1px solid #000',
	   top: '50%',
	   left: '50%',	   
	   marginLeft: '-300px',	   
	   marginTop: (getScrollTop()-220) + 'px',	   	   	   
	   zIndex: '1600',
	   visibility: 'hidden'
	});

	new Ajax(
		'/js/ajax/descTechnique.php',
		{
			update: dataDiv,
			data:'produit_id='+id_prod,
			onSuccess: function(req) {

					$$(fondDiv).setStyles({visibility: 'visible' });
					$$('select').setStyles({visibility: 'hidden' });
					$$(dataDiv).setStyles({visibility: 'visible' });
			},
			evalScripts: true
		}
	).request();
}


function BillingIdem()
{
	$('civilite_id2').value=$('civilite_id').value;
	$('client_prenom1').value=$('client_prenom').value;
	$('client_nom1').value=$('client_nom').value;
	$('adresse_societe1').value=$('adresse_societe').value;
	$('adresse_rue1').value=$('adresse_rue').value;
	$('adresse_rue21').value=$('adresse_rue2').value;
	$('adresse_cp1').value=$('adresse_cp').value;
	$('adresse_ville1').value=$('adresse_ville').value;
	$('pays_id1').value=$('pays_id').value;
	$('client_telephone1').value=$('client_telephone').value;
	
}

function showMenu(id,color)
{
	var d = document.getElementById('smenu'+id);
	for (var i = 1; i<=10; i++) {
		if (document.getElementById('smenu'+i)) {
			document.getElementById('smenu'+i).style.display='none';
			document.getElementById('menuprincipale'+i).style.background='none';
		}
	}
	if (d) {
		d.style.display='block';
		d.style.border='7px solid #'+color;
		document.getElementById('menuprincipale'+id).style.background='#'+color;
		document.getElementById('sousmenuother'+id).style.background='#'+color;
		nb = 2;
		while(document.getElementById('sousmenuparent'+id+nb)){
			document.getElementById('sousmenuparent'+id+nb).style.color='#'+color;
			nb++;
		}
		if(document.getElementById('sousmenuother'+id).style.height<document.getElementById('smenu'+id).offsetHeight){
			document.getElementById('sousmenuother'+id).style.height=document.getElementById('smenu'+id).offsetHeight+'px';
		}
	}
} 

function colorMenu(id,color){

	if(id && color && document.getElementById('menuprincipale'+id)){
		document.getElementById('menuprincipale'+id).style.background='#'+color;
	}
}

function showHeaderCompte()
{
	document.getElementById('content_headercompte').style.display="block";
	document.getElementById('headercompte').style.background="url('/styles/images/header/btn/rollover_compte2011.png') no-repeat top center";
	document.getElementById('headercompte').style.marginTop="0px";
} 

function removeHeaderCompte()
{
	document.getElementById('content_headercompte').style.display="none";
	document.getElementById('headercompte').style.background="url('/styles/images/header/btn/compte2011.png') no-repeat center center";
} 


function showHeaderPanier()
{
	if(document.getElementById('contente_headerpanier').style.display!="block") {
		new Ajax(
			'/js/ajax/showPanier.php',
			{
				onSuccess: function(req) {
					document.getElementById('contente_headerpanier').innerHTML = req;
				}
			}
		).request();
	}
	
	if(document.getElementById('nbprodpanier').innerHTML != '') {
		document.getElementById('contente_headerpanier').style.display="block";
		
		document.getElementById('headerpanier').style.background="url('/styles/images/header/btn/rollover_panier2011.png') no-repeat top center";
	}
} 

function removeHeaderPanier()
{
	document.getElementById('contente_headerpanier').style.display="none";
	document.getElementById('headerpanier').style.background="url('/styles/images/header/btn/panier2011.png') no-repeat center center";
} 

function cacheselect()
{
	var Navigateur = navigator.appName;
	var b_version = navigator.appVersion;

	if(Navigateur == "Microsoft Internet Explorer" && b_version.substring(22,25)<7) {
		$$('select').setStyles({visibility: 'hidden' });
	}
}

function affselect()
{
	var Navigateur = navigator.appName;
	if(Navigateur == "Microsoft Internet Explorer")  {
		$$('select').setStyles({visibility: 'visible' });
	}
}

function initPopUp()
{
	$(fondDiv).onclick = function() {removeDivPanier();};
	$(fondDiv).style.cursor = 'pointer';
}

function popup(href, id, w, h, r, s) {
	if(!fondDiv){
			fondDiv = document.createElement('div');
			fondDiv.style.position = 'absolute';
			initPopUp();
	
			document.body.appendChild(fondDiv);
		}
		fondDiv.innerHTML = '';
		//alert(getHeight());
	
		$(fondDiv).setStyles({
		   backgroundColor: '#000000',
		   width: '100%',
		   height: getScrollHeight(),
		   position: 'absolute',
		   opacity: '0.75',
		   overflow: 'hidden',
		   top: '0px',
		   zIndex: '1500',
		   visibility: 'hidden'
		});
	
		if(!dataDiv){
			dataDiv = document.createElement('div');
			dataDiv.style.position = 'absolute';
			document.body.appendChild(dataDiv);
		}
	
		$(dataDiv).setStyles({
		   /*backgroundColor: '#FFF',*/
		   width: '740px',
		   height: '585px',
		   background:'#fff',
		   border:'1px solid #CCC',
		   position: 'absolute',
		   top: '10%',
		   left: '50%',	   
		   marginLeft: '-370px',		   	   
		   zIndex: '1600',
		   visibility: 'hidden'
		});

		new Ajax(
			'/image.php',
			{
				update: dataDiv,
				data:'url='+href+'&produit_id='+r,
				
				onSuccess: function(req) {
	
						$$(fondDiv).setStyles({visibility: 'visible' });
						$$('select').setStyles({visibility: 'hidden' });
						$$(dataDiv).setStyles({visibility: 'visible' });
						
				},
				evalScripts: true
			}
		).request();


}


function initScrollLayer() {																									
  if($('wnatelier10')) {
  	var wndo10 = new dw_scrollObj('wnatelier10', 'lyratelier10');
  	wndo10.setUpScrollbar("dragBar10", "track10", "v", 1, 1);
	}	
	if($('wnatelier20')) {
  	var wndo20 = new dw_scrollObj('wnatelier20', 'lyratelier20');
  	wndo20.setUpScrollbar("dragBar20", "track20", "v", 1, 1);
	}	
	if($('wnatelier30')) {
  	var wndo20 = new dw_scrollObj('wnatelier30', 'lyratelier30');
  	wndo20.setUpScrollbar("dragBar30", "track30", "v", 1, 1);
	}		
	if($('wnatelier40')) {
  	var wndo20 = new dw_scrollObj('wnatelier40', 'lyratelier40');
  	wndo20.setUpScrollbar("dragBar40", "track40", "v", 1, 1);
	}						  					  
  dw_scrollObj.GeckoTableBugFix('wnatelier', 'wnatelier0'); 					  
}

function openPalette(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.5',
	   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: '#ffffff',
	   width: '820px',
	   height: '480px',
	   position: 'absolute',
	   border: '1px solid #000',
	   top: '40%',
	   left: '40%',	   
	   marginLeft: '-250px',	   
	   marginTop: (getScrollTop()-200) + 'px',	   	   	   
	   zIndex: '1600',
	   overflow: 'auto',
	   visibility: 'hidden'
	});

	new Ajax(
		'/js/ajax/couleur.php',
		{
			update: dataDiv,
			data:"produit_id="+id,
			onSuccess: function(req) {

					$$(fondDiv).setStyles({visibility: 'visible' });
					$$('select').setStyles({visibility: 'hidden' });
					$$(dataDiv).setStyles({visibility: 'visible' });
	

			},
			evalScripts: true
		}
	).request();
}

function select_couleur(id_coul, imgCoul, prixCoul,nomCoul){
	$('produit_couleur_id').value = id_coul;
	$('fp_prix_coul').setStyles({marginTop: '0px'});
	if($('fp_tissu_color_img')) $('fp_tissu_color_img').innerHTML='<img src="'+imgCoul+'" alt="" style="width:66px;height:75px;" />';
	if(prixCoul > 0) {
		$('fp_prix_coul').innerHTML = 'Votre couleur :<br/><strong>'+nomCoul+' (+'+prixCoul+' &euro;)</strong>';
	}
	else {
		$('fp_prix_coul').innerHTML = 'Votre couleur :<br/><strong>'+nomCoul+'</strong>';
	}
	//$('fp_tissu_info').style.display='none';
	removeDivPanier();	
}

function showHideDescription(){
	if($('texte_description_court').style.display=='block'){
		$('texte_description_court').style.display='none';
		$('lire_suite').style.display='none';
		$('texte_description_long').style.display='block';
		$('lire_suite').style.display='block';
	} else {
		$('texte_description_long').style.display='none';
		$('lire_suite').style.display='none';
		$('texte_description_court').style.display='block';
		$('lire_suite').style.display='block';
	}
}

function loadFicheProduit(){
		if(jQuery("#listAttributs")){
			jQuery("#listAttributs > ul > li > input:first").trigger('click');
		}
		if(jQuery("#listAttributsSimple")){
			jQuery("#listAttributsSimple > input:first").trigger('click');
		}
    jQuery(".jqzoom").jqzoom({
        zoomType: 'standard',
        title: false,
        showPreload: false,
        zoomWidth: 470,
        zoomHeight: 278,
        position: 'right',
        xOffset : 15,
        yOffset : 0
    });
    loadChangeImage();
}

function popupCommandeTel() {

	if(!fondDiv){
			fondDiv = document.createElement('div');
			fondDiv.style.position = 'absolute';
			initPopUp();
	
			document.body.appendChild(fondDiv);
		}
		fondDiv.innerHTML = '';
	
		$(fondDiv).setStyles({
		   backgroundColor: '#000000',
		   width: '100%',
		   height: getScrollHeight(),
		   position: 'absolute',
		   opacity: '0.75',
		   overflow: 'hidden',
		   top: '0px',
		   zIndex: '1500',
		   visibility: 'hidden'
		});
	
		if(!dataDiv){
			dataDiv = document.createElement('div');
			dataDiv.style.position = 'absolute';
			document.body.appendChild(dataDiv);
		}

		$(dataDiv).setStyles({
		   width: '433px',
		   height: '176px',
		   background:'#fff url("/styles/images/produit/popup_commander_tel.png") no-repeat top left',
		   position: 'absolute',
		   top: '50%',
		   left: '50%',	   
		   marginLeft: '-216px',	
		   marginTop: '-88px',	   	   
		   zIndex: '1600',
		   visibility: 'hidden'
		});

	$(dataDiv).onclick = function() {removeDivPanier();};

	new Ajax(
		'/js/ajax/commandeTelephone.php',
		{
			update: dataDiv,
			onSuccess: function(req) {

					$$(fondDiv).setStyles({visibility: 'visible' });
					$$('select').setStyles({visibility: 'hidden' });
					$$(dataDiv).setStyles({visibility: 'visible' });
			},
			evalScripts: true
		}
	).request();


}


function popupLivraison() {

	if(!fondDiv){
			fondDiv = document.createElement('div');
			fondDiv.style.position = 'absolute';
			initPopUp();
	
			document.body.appendChild(fondDiv);
		}
		fondDiv.innerHTML = '';
	
		$(fondDiv).setStyles({
		   backgroundColor: '#000000',
		   width: '100%',
		   height: getScrollHeight(),
		   position: 'absolute',
		   opacity: '0.75',
		   overflow: 'hidden',
		   top: '0px',
		   zIndex: '1500',
		   visibility: 'hidden'
		});
	
		if(!dataDiv){
			dataDiv = document.createElement('div');
			dataDiv.style.position = 'absolute';
			document.body.appendChild(dataDiv);
		}

		$(dataDiv).setStyles({
		   width: '607px',
		   height: '721px',
		   background:'#fff8ee',
		   position: 'absolute',
		   top: jQuery(document).scrollTop()+200+'px',
		   left: '50%',	   
		   marginLeft: '-300px',	
		   marginTop: '-88px',	   	   
		   zIndex: '1600',
		   visibility: 'hidden'
		});

	$(dataDiv).onclick = function() {removeDivPanier();};

	new Ajax(
		'/js/ajax/pop-livraison.php',
		{
			update: dataDiv,
			onSuccess: function(req) {

					$$(fondDiv).setStyles({visibility: 'visible' });
					$$('select').setStyles({visibility: 'hidden' });
					$$(dataDiv).setStyles({visibility: 'visible' });
			},
			evalScripts: true
		}
	).request();


}


function popupCommandeSAV() {

	if(!fondDiv){
			fondDiv = document.createElement('div');
			fondDiv.style.position = 'absolute';
			initPopUp();
	
			document.body.appendChild(fondDiv);
		}
		fondDiv.innerHTML = '';
	
		$(fondDiv).setStyles({
		   backgroundColor: '#000000',
		   width: '100%',
		   height: getScrollHeight(),
		   position: 'absolute',
		   opacity: '0.75',
		   overflow: 'hidden',
		   top: '0px',
		   zIndex: '1500',
		   visibility: 'hidden'
		});
	
		if(!dataDiv){
			dataDiv = document.createElement('div');
			dataDiv.style.position = 'absolute';
			document.body.appendChild(dataDiv);
		}

		$(dataDiv).setStyles({
		   width: '433px',
		   height: '176px',
		   background:'#fff url("/styles/images/produit/popup_commander_tel.png") no-repeat top left',
		   position: 'absolute',
		   top: jQuery(document).scrollTop()+200+'px',
		   left: '50%',	   
		   marginLeft: '-216px',	
		   marginTop: '-88px',	   	   
		   zIndex: '1600',
		   visibility: 'hidden'
		});

	$(dataDiv).onclick = function() {removeDivPanier();};

	new Ajax(
		'/js/ajax/commandeSAV.php',
		{
			update: dataDiv,
			onSuccess: function(req) {

					$$(fondDiv).setStyles({visibility: 'visible' });
					$$('select').setStyles({visibility: 'hidden' });
					$$(dataDiv).setStyles({visibility: 'visible' });
			},
			evalScripts: true
		}
	).request();


}



function popupSatisfait() {

	if(!fondDiv){
			fondDiv = document.createElement('div');
			fondDiv.style.position = 'absolute';
			initPopUp();
	
			document.body.appendChild(fondDiv);
		}
		fondDiv.innerHTML = '';
	
		$(fondDiv).setStyles({
		   backgroundColor: '#000000',
		   width: '100%',
		   height: getScrollHeight(),
		   position: 'absolute',
		   opacity: '0.75',
		   overflow: 'hidden',
		   top: '0px',
		   zIndex: '1500',
		   visibility: 'hidden'
		});
	
		if(!dataDiv){
			dataDiv = document.createElement('div');
			dataDiv.style.position = 'absolute';
			document.body.appendChild(dataDiv);
		}

		$(dataDiv).setStyles({
		   width: '607px',
		   height: '721px',
		   background:'#fff8ee',
		   position: 'absolute',
		   top: jQuery(document).scrollTop()+200+'px',
		   left: '50%',	   
		   marginLeft: '-300px',	
		   marginTop: '-88px',	   	   
		   zIndex: '1600',
		   visibility: 'hidden'
		});

	$(dataDiv).onclick = function() {removeDivPanier();};

	new Ajax(
		'/js/ajax/pop-satisfait.php',
		{
			update: dataDiv,
			onSuccess: function(req) {

					$$(fondDiv).setStyles({visibility: 'visible' });
					$$('select').setStyles({visibility: 'hidden' });
					$$(dataDiv).setStyles({visibility: 'visible' });
			},
			evalScripts: true
		}
	).request();


}


function popupPaiementSecu() {
	if(!fondDiv){
			fondDiv = document.createElement('div');
			fondDiv.style.position = 'absolute';
			initPopUp();
	
			document.body.appendChild(fondDiv);
		}
		fondDiv.innerHTML = '';
	
		$(fondDiv).setStyles({
		   backgroundColor: '#000000',
		   width: '100%',
		   height: getScrollHeight(),
		   position: 'absolute',
		   opacity: '0.75',
		   overflow: 'hidden',
		   top: '0px',
		   zIndex: '1500',
		   visibility: 'hidden'
		});
	
		if(!dataDiv){
			dataDiv = document.createElement('div');
			dataDiv.style.position = 'absolute';
			document.body.appendChild(dataDiv);
		}

		$(dataDiv).setStyles({
		   width: '607px',
		   height: '721px',
		   background:'#fff8ee',
		   position: 'absolute',
		   top: jQuery(document).scrollTop()+200+'px',
		   left: '50%',	   
		   marginLeft: '-300px',	
		   marginTop: '-88px',	   	   
		   zIndex: '1600',
		   visibility: 'hidden'
		});

	$(dataDiv).onclick = function() {removeDivPanier();};

	new Ajax(
		'/js/ajax/pop-paiement-secu.php',
		{
			update: dataDiv,
			onSuccess: function(req) {

					$$(fondDiv).setStyles({visibility: 'visible' });
					$$('select').setStyles({visibility: 'hidden' });
					$$(dataDiv).setStyles({visibility: 'visible' });
			},
			evalScripts: true
		}
	).request();


}
function fbs_click() 
{
u=location.href;
t=document.title;
window.open('http://www.facebook.com/sharer.php?u='+encodeURIComponent(u)+'&t='+encodeURIComponent(t),'sharer','toolbar=0,status=0,width=626,height=436');
return false;
}

function popupPaiementPlusieurs() {

	if(!fondDiv){
			fondDiv = document.createElement('div');
			fondDiv.style.position = 'absolute';
			initPopUp();
	
			document.body.appendChild(fondDiv);
		}
		fondDiv.innerHTML = '';
	
		$(fondDiv).setStyles({
		   backgroundColor: '#000000',
		   width: '100%',
		   height: getScrollHeight(),
		   position: 'absolute',
		   opacity: '0.75',
		   overflow: 'hidden',
		   top: '0px',
		   zIndex: '1500',
		   visibility: 'hidden'
		});
	
		if(!dataDiv){
			dataDiv = document.createElement('div');
			dataDiv.style.position = 'absolute';
			document.body.appendChild(dataDiv);
		}

		$(dataDiv).setStyles({
		   width: '607px',
		   height: '721px',
		   background:'#fff8ee',
		   position: 'absolute',
		   top: jQuery(document).scrollTop()+200+'px',
		   left: '50%',	   
		   marginLeft: '-300px',	
		   marginTop: '-88px',	   	   
		   zIndex: '1600',
		   visibility: 'hidden'
		});

	$(dataDiv).onclick = function() {removeDivPanier();};

	new Ajax(
		'/js/ajax/pop-paiement-plusieurs.php',
		{
			update: dataDiv,
			onSuccess: function(req) {

					$$(fondDiv).setStyles({visibility: 'visible' });
					$$('select').setStyles({visibility: 'hidden' });
					$$(dataDiv).setStyles({visibility: 'visible' });
			},
			evalScripts: true
		}
	).request();


}


function loadChangeImage(){
    jQuery(".cadre_mini").each(function(i){
        jQuery(this).css('cursor', 'pointer').click(function(){
            var idVisu = jQuery(this).attr('id');
            //jQuery("#grand-visuel img:first").attr('src', jQuery("#grand-"+idVisu+" img").attr('src'));
            jQuery("#example_6 img:first").parents('a.jqzoom').attr('href', jQuery("#img_zoom_"+idVisu).attr('src'));     // pour le zoom produit
        });
    });
}

function active_desc(tech) {
	document.getElementById('desconglet').style.color='#6d6d6d';
	document.getElementById('serviceonglet').style.color='#ffffff';
	
	document.getElementById('desconglet').style.background='url(/styles/images/produit/bg_onglet_actif.jpg)';
	document.getElementById('serviceonglet').style.background='url(/styles/images/produit/bg_onglet.jpg)';
	
	document.getElementById('descdetail').style.display='inline';
	document.getElementById('servicedetail').style.display='none';
	
	if(tech == 1){
		document.getElementById('desctechonglet').style.color='#ffffff';
		document.getElementById('desctechonglet').style.background='url(/styles/images/produit/bg_onglet.jpg)';
		document.getElementById('desctechdetail').style.display='none';
	}
}

function active_desctech() {
	document.getElementById('desconglet').style.color='#ffffff';
	document.getElementById('serviceonglet').style.color='#ffffff';
	document.getElementById('desctechonglet').style.color='#6d6d6d';
	document.getElementById('desconglet').style.background='url(/styles/images/produit/bg_onglet.jpg)';
	document.getElementById('serviceonglet').style.background='url(/styles/images/produit/bg_onglet.jpg)';
	document.getElementById('desctechonglet').style.background='url(/styles/images/produit/bg_onglet_actif.jpg)';
	document.getElementById('descdetail').style.display='none';
	document.getElementById('servicedetail').style.display='none';
	document.getElementById('desctechdetail').style.display='inline';
}

function active_service(tech) {
	document.getElementById('desconglet').style.color='#ffffff';
	document.getElementById('serviceonglet').style.color='#6d6d6d';
	
	document.getElementById('desconglet').style.background='url(/styles/images/produit/bg_onglet.jpg)';
	document.getElementById('serviceonglet').style.background='url(/styles/images/produit/bg_onglet_actif.jpg)';
	
	document.getElementById('descdetail').style.display='none';
	document.getElementById('servicedetail').style.display='inline';
	
	if(tech == 1){
		document.getElementById('desctechonglet').style.color='#ffffff';
		document.getElementById('desctechonglet').style.background='url(/styles/images/produit/bg_onglet.jpg)';
		document.getElementById('desctechdetail').style.display='none';
	}
}

function show_onglet(my_id, champ, obj){
	jQuery("#ongletdetailficheproduit a").removeClass('onglet_produit_actif');
	jQuery(obj).addClass('onglet_produit_actif');
	jQuery("#contentdetailficheproduit #content_onglet").html('<div style="text-align:center;height:60px;padding-top:30px;"><img src="/styles/images/ajax-loader.gif" alt="chargement en cours"/></div>');
	jQuery.ajax({
	  url: "/js/ajax/getInfoFicheProduit.php?produit_id="+my_id+"&champ="+champ,
	  success: function(retour){
	    jQuery("#contentdetailficheproduit #content_onglet").html(retour);
	  }
	});
	
}

function activeongletdesc(my_id){
	jQuery(".ongletdescprod").removeClass('actif');
	jQuery(".contenu_texte").attr('style','display:none;');
	jQuery("#"+my_id).addClass('actif');
	jQuery("#"+my_id+"_content").attr('style','display:block;');
	
}

//Changement du mode de livraison dans le panier
function changeLivraison(my_id){
	jQuery(".prix2").css("display","none");
	jQuery(".choosen").css("display","none");
	
	jQuery("#prix2_"+my_id).css("display","block");
	jQuery("#choosen_"+my_id).css("display","block");
	document.form_port.submit();
}

function changeLivraison2(my_id){
	jQuery(".choosen").css("display","none");
	jQuery("#choosen_"+my_id).css("display","block");
}

//Affiche les infos sur la livraison dans le panier
function showDescComplete(my_id){
	jQuery(".desc_complete").css("display","none");
	jQuery("#desc_"+my_id).css("display","block");
}




function quitter_res()
{
	document.getElementById('font_resultat_contact').style.display='none';
	document.getElementById('resultat_contact').style.display='none';
}



function lire_video(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.5',
       overflow: 'hidden',
       top: '0px',
       zIndex: '1500',
       visibility: 'hidden'
    });
        $$(fondDiv).setStyles({visibility: 'visible' });

    
    
    jQuery.ajax({
      type:"post",
      url: "/js/ajax/getProduitInfos.php",
      data : "produit_id="+id+"&champ=produit_video_url",
      success: function(retour){  

          popupVideo(retour);
          
      }
    });
    
    
    jQuery(fondDiv).click ( function(){
        $$(fondDiv).setStyles({visibility: 'hidden' });
        $$(dataDiv).setStyles({visibility: 'hidden' });
        
        removeDivPanier();
    });    
    
}


function popupVideo(urlVideo){

	if(!dataDiv){
		dataDiv = document.createElement('div');
		dataDiv.style.position = 'absolute';
		document.body.appendChild(dataDiv);
	}

	$(dataDiv).setStyles({
	   backgroundColor: '#fff',
	   width: '710px',
	   position: 'absolute',
	   border: '1px solid #000',
	   top: '50%',
	   left: '50%',
	   marginLeft: '-355px',
	   marginTop: (getScrollTop()-310) + 'px',	   	   	   
	   zIndex: '1600',
	   visibility: 'hidden'
	});  
        jQuery.ajax({
          type:"post",
          url: "/js/ajax/pop-video.php",
          data : "urlVideo="+urlVideo,
          success: function(retour){  
                $$(dataDiv).setStyles({visibility: 'visible' });
                dataDiv.innerHTML = retour;
          }
        });
}


function loadMondialRelay(){

	// id livraison mondial relay
	var livr_24r = 19;

	if(jQuery('input[name="livraison_id"]:checked').length > 0 && jQuery('input[name="livraison_id"]:checked').attr('value') == livr_24r){
		loadPointMR('');
	}

	jQuery('input[name="livraison_id"]').click(function(){
		if(jQuery(this).attr('value') == livr_24r){
			loadPointMR('');
		}else{
			unloadPointMR();
		}
	});

}

function loadPointMR(cp){
	if(cp == ''){
		cp = jQuery('#adresse_cp').attr('value');
	}

	jQuery.ajax({
        type: "POST",
        url: '/js/ajax/loadPointMondialRelay.php',
        data: "code_postal=" + cp,
        success: function(msg){
            jQuery('#wrap-liste-point-mr').hide().html(msg).show();
        }
    });
}

function unloadPointMR(){
	jQuery('#wrap-liste-point-mr').html('');
}

function updatePointRelais(addr1, adrr2, cp, ville){
	jQuery('#mondial_relay_addr1').attr('value', addr1);
	jQuery('#mondial_relay_addr2').attr('value', adrr2);
	jQuery('#mondial_relay_cp').attr('value', cp);
	jQuery('#mondial_relay_ville').attr('value', ville);
	
}
