// Bibliothèque de scripts  

//****************************************************************
// Affichage des sous-menus 
//****************************************************************

sfHover = function() {
	if(document.getElementById("navigation")) {
		var sfEls = document.getElementById("navigation").getElementsByTagName("LI");
		for (var i=0; i<sfEls.length; i++) {
			sfEls[i].onmouseover=function() {
				this.className+=" sfhover";
			}
			sfEls[i].onmouseout=function() {
				this.className=this.className.replace(new RegExp(" sfhover\\b"), "");
			}
		}
	}
	if(document.getElementById("recherche")) {
		var sfEls = document.getElementById("recherche").getElementsByTagName("LI");
		for (var i=0; i<sfEls.length; i++) {
			sfEls[i].onmouseover=function() {
				this.className+=" sfhover";
			}
			sfEls[i].onmouseout=function() {
				this.className=this.className.replace(new RegExp(" sfhover\\b"), "");
			}
		}
	}
	if(document.getElementById("navigationdroite")) {
		var sfEls = document.getElementById("navigationdroite").getElementsByTagName("LI");
		for (var i=0; i<sfEls.length; i++) {
			sfEls[i].onmouseover=function() {
				this.className+=" sfhover";
			}
			sfEls[i].onmouseout=function() {
				this.className=this.className.replace(new RegExp(" sfhover\\b"), "");
			}
		}
	}
	if(document.getElementById("vosbesoins")) {
		var sfEls = document.getElementById("vosbesoins").getElementsByTagName("LI");
		for (var i=0; i<sfEls.length; i++) {
			sfEls[i].onmouseover=function() {
				this.className+=" sfhover";
			}
			sfEls[i].onmouseout=function() {
				this.className=this.className.replace(new RegExp(" sfhover\\b"), "");
			}
		}
	}
}
if (window.attachEvent) window.attachEvent("onload", sfHover);

//****************************************************************
// Fonction d'import des animations Flash 
//****************************************************************

function RunFlash(swf, hauteur, largeur, nom) {
	document.write("<object width=\""+largeur+"\" height=\""+hauteur+"\" id=\""+nom+"\" classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0\">\n");
	document.write("<param name=\"quality\" value=\"high\">\n");
	document.write("<param name=\"wmode\" value=\"transparent\">\n");
	document.write("<param name=\"movie\" value=\""+swf+"\">\n");
	document.write("<embed src=\""+swf+"\" quality=\"high\" wmode=\"transparent\" width=\""+largeur+"\" height=\""+hauteur+"\" name=\""+nom+"\" align=\"middle\" type=\"application/x-shockwave-flash\" pluginspage=\"http://www.macromedia.com/go/getflashplayer\">\n");
	document.write("</object>\n");
}


//****************************************************************
// Affichage des POPUP 
//****************************************************************

function funcPopup(varUrl, varWidth, varHeight, varResize, varScroll) {
	var ScreenW = screen.availWidth;
	var ScreenH = screen.availHeight;
	if (!varScroll || varScroll == '') {
		varScroll = 'no';
	}
	var WinPopUp = window.open(varUrl, '', "toolbar=no, menubar=no, scrollbars=" + varScroll + ", resizable=" + varResize + ", location=no, directories=no, status=no, width=" + varWidth + ", height=" + varHeight);
	WinPopUp.moveTo(Math.round((ScreenW-varWidth)/2), Math.round((ScreenH-varHeight)/2));	
}


//****************************************************************
// Affichage des POPUP 
//****************************************************************
function detectFlash()
{
	var sPasCool = "Vous ne possédez pas de version de Flash. Ceci peut affecter la navigation du site.";
	if( navigator.mimeTypes.length > 0 )
	{
		return navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin != null;
	}
	else if( window.ActiveXObject )
	{
		try
		{
			return new ActiveXObject( "ShockwaveFlash.ShockwaveFlash" );
		}
		catch( oError )
		{
			return alert(sPasCool);
		}
	}
	else

	{
		return alert(sPasCool);
	}
}

function display_detail_panier(id)
{
	if($("#detail_"+id).css("display") == 'block'){
		$("#detail_"+id).css("display","none");
		$("#zoom_"+id).src('/sites/all/images/zoom_in.png');
	}else{
		$('#zoom_'+id).src('/sites/all/images/zoom_out.png');
		$("#detail_"+id).css("display","block");		
	}
}

/*
	Definit dynamiquement la hateur d'une iframe
*/
function setIFrameHeight(varId) 
{ 
	var hauteur;
	var iframe 	= document.getElementById(varId);  
    if (iframe) {
    	if (document.all) {
      		hauteur = iframe.contentWindow.document.body.scrollHeight + 100;
      	} else { 
      		hauteur = iframe.contentWindow.document.body.offsetHeight + 100;
      	}
		iframe.setAttribute("height", hauteur);
    }
} 
