// Fonctions utilitaires pour les fiches

function hideDiv (divName) {
	div = document.getElementById(divName);
	div.style.display = 'none';
}
/*
 * Ouverture de la fenêtre de lecture de catalogue.
 */
function newCatWindow(ref) {
	url = 'catalogue/cat_ref.php?ref=' + ref;
	propriete = "top=0, left=0, resizable=yes, status=no, directories=no, addressbar=no, toolbar=no, scrollbars=yes, menubar=no, location=no, statusbar=no"
	propriete += ",width=" + screen.availWidth + ",height=" + screen.availHeight;
	win = window.open(url, "Catalogue", propriete);
}
/*

function stripslashes( str ) {
    // *     example 1: stripslashes('Kevin\'s code');
    // *     returns 1: "Kevin's code"
    // *     example 2: stripslashes('Kevin\\\'s code');
    // *     returns 2: "Kevin\'s code"
    return (str+'').replace(/\0/g, '0').replace(/\\([\\'"])/g, '$1');
}
*/

/*
 * MyBox : boîte d'affichage des images
 * Reste à faire :
 *  - intégrer rel="mybox" pour les éléments <img /> à charger 
 *  - ajouter les blocs <div> html au chargement avec le DOM
 *  - ajouter les rêgles css aussi (ou laisser en externe pour configuration plus simple ?)
 * 
 */

jQuery(function($) {
	
	var preLoad = "";

	/*
	<div id="imgAbs"></div>
	<div id="imgCont"><img id="imgPop" src="" /></div>
	*/
	
	$(function() {
		// Append the mybox HTML code at the bottom of the document
		// Version mise en commentaire popur le bug 'reload'
		/*
		var html = '';
		html += '<div id="mybox_overlay"></div>';
		html += '<div id="mybox_wrap">';
		html += '<div class="mybox_loading" id="mybox_loading"><div></div></div>';
		html += '<div id="mybox_outer">';
		html += '<div id="mybox_inner">';
		html += '<div id="mybox_close"></div>';
		html += '<div id="mybox_bg"><div class="mybox_bg mybox_bg_n"></div><div class="mybox_bg mybox_bg_ne"></div><div class="mybox_bg mybox_bg_e"></div><div class="mybox_bg mybox_bg_se"></div><div class="mybox_bg mybox_bg_s"></div><div class="mybox_bg mybox_bg_sw"></div><div class="mybox_bg mybox_bg_w"></div><div class="mybox_bg mybox_bg_nw"></div></div>';
		html += '<a href="javascript:;" id="mybox_left"><span class="mybox_ico" id="mybox_left_ico"></span></a><a href="javascript:;" id="mybox_right"><span class="mybox_ico" id="mybox_right_ico"></span></a>';
		html += '<div id="mybox_content"></div>';
		html += '<div id="mybox_title"></div>';
		html += '</div>';
		html += '</div>';
		html += '</div>';
		*/
		/*
		$("body").append(mydiv = $('<div id="mybox" />'));
		mydiv.append(
			$([ overlay = $('<div id="imgAbs" />')[0],
				center = $('<div id="imgCont" />')[0]
			]).css("display", "none")
		);
		close = $('<div id="close" style="display: block;"/>').appendTo(center);
		img = $('<img id="imgPop" src="" />').appendTo(center);
		*/
		/*
		$("body").append(
			$([ overlay = $('<div id="imgAbs" />')[0],
				center = $('<div id="imgCont" />')[0]
			]).css("display", "none")
		);
		img = $('<img id="imgPop" src="" />').appendTo(center);
		*/
		
		html = '';
		html += '<div id="mybox">';
		html += '<div id="imgAbs"></div>';
		// html += '<div id="imgInner">';
		// html += '<div id="close" style="display: block;"></div>';
		html += '<div id="imgCont"><div id="imgClose"></div><img id="imgPop" src="blank.gif" /></div>';
		// html += '</div>';
		html += '</div>';
		$(html).appendTo("body");
		
	});

	

	$.mybox = function (imgSrc) {
		// document.getElementById('imgAbs').style.visibility = 'hidden'; 
		// document.divs['imgAbs'].style.display = 'block';

		// alert ("imgBox !");
		var settings = { 
			thumbListId: "thumbs", 
			imgViewerId: "viewer" 
		}; 
		var divs = { 
			imgAbs : document.getElementById('imgAbs'), 
			imgCont : document.getElementById('imgCont'),
			imgPop : document.getElementById('imgPop'),
			imgClose : document.getElementById('imgClose')
		}; 
		var win = { 
			width : $(window).width(),
			height : $(window).height()
		};



		var imgAbs = document.getElementById('imgAbs');
		// var imgLoad = document.getElementById('imgLoad');
		var imgCont = document.getElementById('imgCont');
		var imgPop = document.getElementById('imgPop');
		var imgClose = document.getElementById('imgClose');

		$("#imgAbs").click(close);
		$("#imgCont").click(close);
		$("#imgPop").click(close);
		
		$("#imgClose").css('display', 'none');		
		imgClose.style.display = 'none';
		

		imgAbs.style.display = 'block';
		/*
		var tb_pathToImage = "/scripts/loading.gif";
		imgLoader = new Image();// preload image
		imgLoad.src = tb_pathToImage;
		imgLoad.style.display = 'block';
		*/
		imgCont.style.width = '100px';
		imgCont.style.height = '100px';
		imgCont.style.left = win.width/2 - 50 + 'px';
		imgCont.style.top = win.height/2 - 50 + 'px';

		imgCont.style.background = "#fff url(/scripts/loading.gif) no-repeat center";
		imgCont.style.display = 'block';

		var preLoad = new Image();
		// preLoad.onload = displayBox(win, divs);
		// var displayBox = function(win, divs) {
		
		preLoad.onload = function() {
			var imgWidth = preLoad.width;
			var imgHeight = preLoad.height;
			/*
			var imgPop = document.getElementById('imgPop');
			var imgCont = document.getElementById('imgCont');
			var imgAbs = document.getElementById('imgAbs');
			*/
			
			divs.imgCont.style.backgroundImage = "";
			divs.imgPop.style.display = 'none';
			divs.imgPop.style.width = imgWidth+'px';
			divs.imgPop.style.height = imgHeight+'px';
			
			// Voir les css
			var marginWidth = (10+2+5) * 2;
			marginWidth = 20;
			// imgCont.style.top = $('html,body').scrollTop-100+'px';
			// imgCont.style.top = scrollTop-100+'px';
			
			var contWidth = imgWidth + marginWidth;
			var contHeight = Math.min (win.height-80, imgHeight);
			// alert (contWidth + ' ' + contHeight);
			// var contTop = 50; // Math.max ( (winHeight-100)/2-contHeight/2, 50);
			// var contTop = Math.max ( (winHeight-100)/2-contHeight/2, 50);
			var contTop = (win.height - contHeight) / 2 - 20;
			var contLeft = (win.width - contWidth) / 2;
			
			$.browser.msie6=
				$.browser.msie
				&&/MSIE 6\.0/i.test(window.navigator.userAgent)
				&&!/MSIE 7\.0/i.test(window.navigator.userAgent)
				&&!/MSIE 8\.0/i.test(window.navigator.userAgent);

			// Pour IE6
			if ( $.browser.msie6 ) {
				var scrollTop = $(window).scrollTop();
				/*
				imgAbs.style.left = '0px';
				imgAbs.style.top = '0px';
				imgAbs.style.height = '5000px';
				imgAbs.style.width = '5000px';
				imgAbs.style.height = '100%';
				imgAbs.style.width = '100%';
				*/
				imgAbs.style.top = scrollTop+'px';
				imgAbs.style.height = win.height+'px';
				imgAbs.style.width = win.width+'px';
				contTop = scrollTop+50;
				// alert ("IE 6 ou ...");
			}
		
			var bAnimate = true;
			if (bAnimate) {
				divs.imgCont.style.width = '100px';
				divs.imgCont.style.height = '100px';
				divs.imgCont.style.left = win.width/2 - 50 + 'px';
				divs.imgCont.style.top = win.height/2 - 50 + 'px';
				if ( $.browser.msie6 ) {
					divs.imgCont.style.top = winHeight/2 + scrollTop + 'px';
				}

				// Ouverture de la fenêtre par animation
				// alert (contLeft + ' ' + contWidth);
				$("#imgCont").animate({left: contLeft, width: contWidth}, "fast");
				$("#imgCont").animate({top: contTop, height: contHeight},
					{queue: true, complete: function() {
							divs.imgPop.src = imgSrc;
							divs.imgPop.style.display = '';
							divs.imgCont.style.overflow = 'auto';
							// imgClose.style.width = '30px';
							// imgClose.style.height = '30px';
							divs.imgClose.style.display = 'block';
						}
					} );

			/*
			$("#imgCont").animate({top: contTop, height: contHeight},"normal");
			imgPop.src = imgSrc;
			imgPop.style.display = '';
			*/
			} else {
				divs.imgPop.src = imgSrc;
				divs.imgPop.style.display = '';

				divs.imgCont.style.width = contWidth + 'px';
				divs.imgCont.style.height = contHeight + 'px';
				divs.imgCont.style.left = contLeft + 'px';
				divs.imgCont.style.top = contTop + 'px';
			}
		}

		// Lance le chargement (preload)
		preLoad.src = imgSrc;
		// var str = '<iframe src=\'' + link.href + '\'><\/iframe>';
		

		return false;
	}

	function close () {
		preLoad.onload = null;
		$("#imgCont").stop(true);
		document.getElementById('imgAbs').style.display = 'none'; 
		document.getElementById('imgCont').style.display = 'none';
		document.getElementById('imgPop').style.display = 'none';
		document.getElementById('imgClose').style.display = 'none'; 
		// $("#imgClose").css('display', 'none');
		// $("#imgClose").css('width', '1px');
		// $("#imgClose").css('height', '1px');
	}
	
	$.fn.mybox = function() {
		var links = this;		
		return links.unbind("click").click(function() {
			var link = this;
			imgSrc=link.href;
			return $.mybox(imgSrc);
		});
	};
	
	$("a[rel^='mybox']").mybox(function(el) {
		return (this == el) || ((this.rel.length > 5) && (this.rel == el.rel));
	});
});


function openEbook ( ebkSrc )
{
	imgWnd = window.open ( 'afficher_ebook.php?source=' + ebkSrc, 'Information', 'toolbar=0, location=0, directories=0, status=0, scrollbars=0, resizable=0, copyhistory=0, menuBar=0');
	return false;
}
function openImage ( imgSrc )
{
	imgWnd = window.open ( '../produits/afficher_image.php?imgURL=' + imgSrc, 'Information', 'toolbar=0, location=0, directories=0, status=0, scrollbars=0, resizable=0, copyhistory=0, menuBar=0');
	return false;
/*
	OwnWnd = window.open ( '../produits/afficher_image.php?imgURL=' + imgSrc, 'Information', 'toolbar=0, location=0, directories=0, status=0, scrollbars=0, resizable=0, copyhistory=0, menuBar=0');
	OwnWnd = window.open ( '../produits/afficher_image.php?imgURL=' + imgSrc, 'Information', 'toolbar=0, width=800, location=0, directories=0, status=0, scrollbars=1, resizable=1, copyhistory=0, menuBar=0');
	OwnWnd = window.open ( '../produits/afficher_fichier.php?source=' + imgSrc, 'Information', 'toolbar=0, width=800, location=0, directories=0, status=0, scrollbars=1, resizable=1, copyhistory=0, menuBar=0');
*/
	// window.open (imgSrc, 'Image', 'toolbar=0, location=0, directories=0, status=0, scrollbars=1, resizable=1, copyhistory=0, menuBar=0');
	// window.open (imgSrc, 'Image', 'toolbar=0, width=800, location=0, directories=0, status=0, scrollbars=1, resizable=1, copyhistory=0, menuBar=0');
}

/*
 *  Notez que les URL distantes ne seront pas chargées instantanément. 
 * Lorsque l'appel à window.open() se termine et renvoie sa valeur, 
 * la fenêtre contient toujours about:blank. Le chargement proprement dit de l'URL est reporté 
 * et ne commence effectivement qu'après la fin de l'exécution du bloc de script courant. 
 * La création de la fenêtre d'une part et le chargement de la ressource référencée d'autre part 
 * sont faits de manière asynchrone. 
 * 
 * https://developer.mozilla.org/fr/DOM/window.open
 */

function utf8_decode ( str_data ) {
    // http://kevin.vanzonneveld.net
    // +   original by: Webtoolkit.info (http://www.webtoolkit.info/)
    // +      input by: Aman Gupta
    // +   improved by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
    // +   improved by: Norman "zEh" Fuchs
    // +   bugfixed by: hitwork
    // +   bugfixed by: Onno Marsman
    // +      input by: Brett Zamir (http://brett-zamir.me)
    // +   bugfixed by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
    // *     example 1: utf8_decode('Kevin van Zonneveld');
    // *     returns 1: 'Kevin van Zonneveld'
 
    var tmp_arr = [], i = 0, ac = 0, c1 = 0, c2 = 0, c3 = 0;
    
    str_data += '';
    
    while ( i < str_data.length ) {
        c1 = str_data.charCodeAt(i);
        if (c1 < 128) {
            tmp_arr[ac++] = String.fromCharCode(c1);
            i++;
        } else if ((c1 > 191) && (c1 < 224)) {
            c2 = str_data.charCodeAt(i+1);
            tmp_arr[ac++] = String.fromCharCode(((c1 & 31) << 6) | (c2 & 63));
            i += 2;
        } else {
            c2 = str_data.charCodeAt(i+1);
            c3 = str_data.charCodeAt(i+2);
            tmp_arr[ac++] = String.fromCharCode(((c1 & 15) << 12) | ((c2 & 63) << 6) | (c3 & 63));
            i += 3;
        }
    }
 
    return tmp_arr.join('');
}

/* 
$(document).ready(function() {
	var link;
	(link = $('.linkFiche')).parent().append (
		extDiv = $('<div class="divExtract" />').append (
		'<p>'+link[0]+'</p>' +
		'<p>'+$(link)[0]+'</p>' +
		'<a href="' + $(link)[0].href + '"></a>')
	);
	//'<object object type="text/html" data="' + $(this).href + '"></object>')
	// var str = '<'+'object type="text/html" data="'+link.href+'"><\/object>';
	// extDiv.append (str);	
});
function affHtmlFrame (link) {
	var extDiv = $(link).parents().next('.divExtract');
	extDiv.slideToggle();
}
*/
function affHtmlFrame (link) {

	var clSel = '.';
	var divClass = 'divExtract';
	var linkClass = 'linkFiche';
	var openClass = 'opened';
	// $(this).parent().next('div').toggle();
	// var extDiv = $(link).parents().next('div');
	
	// $(link).parent().append ('<div class="divExtract"></div>');
	// var extDiv = $(link).parent().next('.divExtract');
	
	// .append(mydiv = $('<div id="mybox" />'));
	
	var lastDiv = null;
	lastDiv = $(clSel+divClass);

	// On referme la dernière ouverte si elle existe
	if (lastDiv.length > 0) {
		lastDiv.toggle();
		lastDiv.remove();
	}
	// On referme la dernière ouverte si c'est la même
	if ($(link).is(clSel+openClass)) {
		$(link).toggleClass (openClass);
		return false;
	}

	// On affiche la nouvelle si il y a lieu
	$('.'+linkClass).removeClass (openClass);
	$(link).parent().append (extDiv = $('<div />').attr('class', divClass));

	// extDiv.load(link.href);
	// document.getElementById('divTest1').innerHTML = '<'+'object type="text/html" data="' + link.href + '"><\/object>';
	// document.getElementById('divTest2').innerHTML = '<iframe src=\'' + link.href + '\'><\/iframe>';
	// document.getElementById('divTest1').innerHTML = '<'+'object type="text/html" data="'+link.href+'"><\/object>';

	// extDiv.innerHTML = '<'+'object type="text/html" data="'+link.href+'"><\/object>';
	// var str = '<'+'object type="text/html" data="'+link.href+'"><\/object>';
	// var str = '<object type="text/html" data="http://jocatop.dev/images/lectheme/lectecritcm/accident.htm">';
	// extDiv.html = str;
	
	/*
	// Récupère le contenu d'un fichier	
	var data = $.get ( link.href, function (data){ 
			// data = utf8_decode (data);
			var str = '<'+'object type="text/html" data="'+data+'"><\/object>';
			extDiv.append (str);
			extDiv.toggle();
		});

	*/
	// Version object/frame fonctionnelle
	var str = '<'+'object type="text/html" data="'+link.href+'"><\/object>';
	var str = '<iframe src=\'' + link.href + '\'><\/iframe>';
	
	extDiv.append (str);
	extDiv.toggle();
	
	$(link).toggleClass ('opened');	
	return false;
}

function Affichegrande(cheminImage,texte)
{
newImage = new Image;
newImage.src = cheminImage;
html = 
	'<HTML><HEAD><TITLE>Image</TITLE><meta http-equiv="Pragma" content="no-cache"></HEAD><BODY leftmargin=0 marginwidth=0 topmargin=0 marginheigth=0 oncontextmenu="return false"><CENTER>'+
	'<a href="#" onClick="window.close()"><IMG SRC="'+cheminImage+'" BORDER=0 NAME=monImage alt="'+texte+'" border="0" onLoad="window.resizeTo(document.monImage.width+20,document.monImage.height+80); window.moveTo((screen.width-document.monImage.width)/2,5)"> </a></CENTER></BODY></HTML>';
// if (fois == 1 ) ouvrirImage.close();
ouvrirImage = window.open('','_blank','toolbar=0,location=0,menuBar=0,scrollbars=0,resizable=0');
ouvrirImage.document.write(html);
// fois=1;
}

function openImageJs ( imgSrc )
{
	//Affichegrande (imgSrc, 'Test');
	//return true;	
	
	var image = new Image();
	// alert (imgSrc);
	
	// Retrouve l'identifiant de la fenêtre 
	/*
	imgWnd = window.open ('', 'Information');
	// Essaie de la fermer
	if (imgWnd) {
		// alert ('Close !');
		imgWnd.close();
	}
	*/
	image.onload = function()
	{
		var width = screen.width;
		var height = screen.height;

		var imgWidth = image.width + 80;
		var imgHeight = image.height + 120;
		
		// imgWnd = window.open ( imgSrc,  'Information', 'width=' + imgWidth + ', height=' + imgHeight + ', ' + 'toolbar=0, location=1, directories=0, status=0, scrollbars=0, resizable=1, copyhistory=0, menuBar=0');
					
		var leftpos = width / 2 - imgWidth / 2;
		var toppos = height / 2 - imgHeight / 2;
		// alert (leftpos + ", " + toppos);		

		html =  '<html><head><title>Image</title></head><body leftmargin=0 marginwidth=0 topmargin=0 marginheigth=0>';
		html += '<center><a href="#" onclick="window.close()"><img src="' + imgSrc + '" border="0" /></a></center>';
		html += '</body></html>';
		imgWnd = window.open ( '', 'Image', 'width=' + imgWidth + ', height=' + imgHeight + ', ' + 'alwaysRaised=1, toolbar=0, location=0, directories=0, status=0, scrollbars=0, resizable=0, copyhistory=0, menuBar=0');
		imgWnd.resizeTo (imgWidth, imgHeight);
		imgWnd.moveTo (leftpos, toppos);
		imgWnd.document.write (html);
		
		imgWnd.focus();
	}
	// Lance le chargement (preload)
	image.src = imgSrc;
	return false;
}


//Fonctions utilitaires pour les fiches

function switchImage(img, src)
{
   // on crée l'objet
   var image = new Image();
 
   // événements : cas d'erreur
   image.onerror = function()
   {
      alert("Erreur lors du chargement de l'image");
   }
   image.onabort = function()
   {
      alert("Chargement interrompu");
   }
 
   // événement : une fois le chargement terminé
   image.onload = function()
   {
      if(typeof img == "string")
	     img = document.getElementById(img);
      img.src = image.src;
      img.width = image.width;
      img.height = image.height;
   }
 
   // on modifie l'adresse de l'objet "image", ce qui lance le chargement
   image.src = src;            
}


function stripe() {
	if (!document.getElementsByTagName('tr')) return;
	var tr = document.getElementsByTagName('tr');
	for (var i = 0; i < tr.length; i = i + 2) {
		// if (tr[i].className != 'tmiddle')
		tr[i].setAttribute('class', 'odd');
	}
}


/*
var hImageVar0 = new Array ( );
hImageVar0Out = new Image ();  hImageVar0Out.src = "http://80.13.249.25/defines/dynaimage.php?id=91a1a249c7ebe9367549b27e33e58782";
hImageVar0Over = new Image ();  hImageVar0Over.src = "http://80.13.249.25/defines/dynaimage.php?id=e30ff15c1fe8a32ae321241aaf99a837";

function jsImageVar0OnLoad ( )
{
    document.write ( '<IMG SRC="' + hImageVar0Out.src + '" onClick="javascript:  OwnWnd = window.open ( \'../produits/afficher_fichier.php?source=http:cc47cc4780cc4613cc46249cc4625cc47imagescc479308cc47fichier_9308_1cc00463_400664c7_304ccc46gif\', \'Information\', \'toolbar=0, width=800, location=0, directories=0, status=0, scrollbars=1, resizable=1, copyhistory=0, menuBar=0\'); OwnWnd.focus();" onMouseOver="this.src=hImageVar0Over.src;  jsOnMouseOver ( this );" onMouseOut="this.src=hImageVar0Out.src;" BORDER="0" ALIGN="top" ID="hImageVar0">');
}

function jsOpenImage (imgSrc)
{
	window.open ( imgSrc, 'Image', 'toolbar=0, width=800, location=0, directories=0, status=0, scrollbars=1, resizable=1, copyhistory=0, menuBar=0');
}

function jsShowImage (imgSrc)
{
	// document.getElementById('imgAbs').style.visibility = 'hidden'; 
	// document.divs['imgAbs'].style.display = 'block';
	document.images['popup_img'].src = imgSrc;
	document.getElementById('popup_fond').style.display = 'block'; 
	document.getElementById('popup_cont').style.display = 'block'; 
}

function jsHideImage ()
{
	document.getElementById('popup_fond').style.display = 'none'; 
	document.getElementById('popup_cont').style.display = 'none'; 
}

function jsFastAddPanierML ( sReference, sDesignation, sPrix, sCrypt, sProduit )
{
    window.open ( '../panier/panier.php?ref=' + sReference + '&des=' + sDesignation + '&prx=' + sPrix + '&fast=1' + '&crx=' + sCrypt, 'panier',
    'width=16, height=16, toolbar=0, location=0, directories=0, status=0, scrollbars=no, resizable=no, copyhistory=0, menuBar=0');
    // history.back();
    alert ( 'Vous venez d\'ajouter \'' + sProduit + '\' à votre panier.\n Vous pouvez consulter ce dernier en cliquant sur \'Voir mon panier\'.' );
}
function switchImage(imgName, imgSrc) 
{
  if (document.images)
  {
    if (imgSrc != "none")
    {
      document.images[imgName].src = imgSrc;
    }
  }
}

// Issu du 9014

var hImageVar0 = new Array ( );
hImageVar0Out = new Image ();  hImageVar0Out.src = "http://80.13.249.25/defines/dynaimage.php?id=91a1a249c7ebe9367549b27e33e58782";
hImageVar0Over = new Image ();  hImageVar0Over.src = "http://80.13.249.25/defines/dynaimage.php?id=e30ff15c1fe8a32ae321241aaf99a837";

function jsImageVar0OnLoad ( )
{
    document.write ( '<IMG SRC="' + hImageVar0Out.src + '" onClick="javascript:  OwnWnd = window.open ( \'../produits/afficher_fichier.php?source=http:cc47cc4780cc4613cc46249cc4625cc47imagescc479308cc47fichier_9308_1cc00463_400664c7_304ccc46gif\', \'Information\', \'toolbar=0, width=800, location=0, directories=0, status=0, scrollbars=1, resizable=1, copyhistory=0, menuBar=0\'); OwnWnd.focus();" onMouseOver="this.src=hImageVar0Over.src;  jsOnMouseOver ( this );" onMouseOut="this.src=hImageVar0Out.src;" BORDER="0" ALIGN="top" ID="hImageVar0">');
}

function jsOpenImage (imgSrc)
{
	window.open ( imgSrc, 'Image', 'toolbar=0, width=800, location=0, directories=0, status=0, scrollbars=1, resizable=1, copyhistory=0, menuBar=0');
}

function jsShowImage (imgSrc)
{
	// document.getElementById('imgAbs').style.visibility = 'hidden'; 
	// document.divs['imgAbs'].style.display = 'block';
	document.images['popup_img'].src = imgSrc;
	document.getElementById('popup_fond').style.display = 'block'; 
	document.getElementById('popup_cont').style.display = 'block'; 
}

function jsHideImage ()
{
	document.getElementById('popup_fond').style.display = 'none'; 
	document.getElementById('popup_cont').style.display = 'none'; 
}

function jsFastAddPanierML ( sReference, sDesignation, sPrix, sCrypt, sProduit )
{
    window.open ( '../panier/panier.php?ref=' + sReference + '&des=' + sDesignation + '&prx=' + sPrix + '&fast=1' + '&crx=' + sCrypt, 'panier',
    'width=16, height=16, toolbar=0, location=0, directories=0, status=0, scrollbars=no, resizable=no, copyhistory=0, menuBar=0');
    // history.back();
    alert ( 'Vous venez d\'ajouter \'' + sProduit + '\' à votre panier.\n Vous pouvez consulter ce dernier en cliquant sur \'Voir mon panier\'.' );
}
function switchImage(imgName, imgSrc) 
{
  if (document.images)
  {
    if (imgSrc != "none")
    {
      document.images[imgName].src = imgSrc;
    }
  }
}


function switchImage_Ex (imgName, imgSrc)
{
  var img = document.getElementById(imgName);

  jsImg = new Image();
  jsImg.src = imgSrc;

  var cx = jsImg.width;
  var cy = jsImg.height;

  alert ('width : ' + cx + 'px, ' + 'height : ' + cy + 'px');
  img.width = '500px';
  img.height = '500px';
  img.src = imgSrc;
  img.style.display = "inline";

//*
  img.style.display = "inline";
  if (document.images)
  {
    if (imgSrc != "none")
    {
	  alert ('switch ' + imgSrc);
      document.images[imgName].src = imgSrc;
    }
  }
//
  return false;
}

<!--
<script>


    for(i=0; i<document.getElementsByName(pnom).length; i++) {
      tabID[i] = document.getElementsByName(pnom).item(i).id;
      var vlURL = document.getElementsByName(pnom).item(i).getAttribute("src");
      tabPictD[i] = new Image();
      tabPictD[i].src = vlURL;



function showHideItems(link,obj, btnImg){
  var myItem = document.getElementById(obj);
  var myButton = document.getElementById(btnImg);
  var showMore = myButton.src.indexOf('more.gif') !=-1;
  myItem.style.display = (showMore)? "block":"none"
  swapImage(myButton,showMore);
  link.title = (showMore)?"Hide extra content":"Show extra content";
  return false;
}

function swapImage(btnImg, showMore) {
  btnImg.src = btnImg.src.replace((showMore)?"more.gif":"less.gif",(showMore)?"less.gif":"more.gif");
}
</script>
-->
function showBox(imgSrc)
{
	tb_init('a.thickbox, area.thickbox, input.thickbox');
	imgLoader = new Image();// preload image
	imgLoader.src = tb_pathToImage;
	tb_showIframe();
	// tb_show(document.getElementById("hiddenModalContent"), "#TB_inline?&height=75&width=200&inlineId=hiddenModalContent&modal=true", false);
	// tb_show (imgSrc, "#TB_inline?&height=720&width=500&inlineId=TB_image1&modal=false", false);

	sParam = imgSrc+'?height=720&width=700';
	sParam = imgSrc+'?KeepThis=true&TB_iframe=true&height=400&width=600';
	// alert (sParam);
	// tb_resize (800, 600);
	tb_show ('Test', sParam, false);
}



*/