//$=========================================================================================
//$=========================================================================================
//$ Fonctions generales
//$=========================================================================================


function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function HideShowSpan(strName, strDisplay)
{
	document.getElementById(strName).style.display = strDisplay;
}  



function AjoutFavoris(strUrl, strTitle) 
{
//alert(navigator.appName);
//alert(navigator.appVersion);

	if ( navigator.appName != 'Microsoft Internet Explorer' )
	{ 
//alert("if");		
		window.sidebar.addPanel(strTitle,strUrl,""); 
	}
	else
	{ 
//alert("else");		
		window.external.AddFavorite(strUrl,strTitle);
	}
/*	
	else
	{
		alert("Fonction non supportée par votre navigateur !");
	}
*/	
}


function includeFlash(id, version, width, height, align, movie, bgcolor, menu, loop, quality, scale, salign, flashvars, noembed, wmode) {
	htmlFlash  = '<object id="' + id + '" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=' + version + '" width="' + width + '" height="' + height + '" align="' + align + '">';
	htmlFlash += '<param name="wmode" value="' + wmode + '" />';
	htmlFlash += '<param name="movie" value="' + movie + '" />';
	htmlFlash += '<param name="bgcolor" value="' + bgcolor + '" />';
	htmlFlash += '<param name="menu" value="' + menu + '" />';
	htmlFlash += '<param name="loop" value="' + loop + '" />';
	htmlFlash += '<param name="quality" value="' + quality + '" />';
	htmlFlash += '<param name="scale" value="' + scale + '" />';
	htmlFlash += '<param name="salign" value="' + salign + '" />';
	htmlFlash += '<param name="flashvars" value="'+ flashvars + '" />';
	htmlFlash += '<embed name="' + id + '" src="' + movie + '" wmode="' + wmode + '" width="' + width + '" height="' + height + '" swLiveConnect="true" salign="' + salign + '" align="' + align + '" flashvars="' + flashvars + '" scale="'+ scale + '" bgcolor="' + bgcolor + '" quality="' + quality + '" menu="' + menu + '" loop="'+ loop + '" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash"></embed>';
	htmlFlash += '<noembed>' + noembed + '</noembed>';
	htmlFlash += '</object>';
	document.write(htmlFlash);
}

function FCT_OpenWindow(strUrl, strName, strOption) 
{ 
	var strNewWindow = "";
        var ExpReg = "";
        var DefineHeight = null;
        var DefineWidth = null;
        var DefineTop = null;
        var DefineLeft = null;
        var NewTop = 0;
        var NewLeft = 0;
        var NewOption = "";
        
        //$ Recherche la valeur du 'top' de la fenêtre
        ExpReg = new RegExp('top\\s*=\\s*(\\d+)', 'gi');
        if(strOption.match(ExpReg))DefineTop =  RegExp.$1;
        
        //$ Recherche la valeur du 'left' de la fenêtre
        ExpReg = new RegExp('left\\s*=\\s*(\\d+)', 'gi');
        if(strOption.match(ExpReg))DefineLeft =  RegExp.$1;
        
        //$ Recherche la valeur du 'width' de la fenêtre
        ExpReg = new RegExp('width\\s*=\\s*(\\d+)', 'gi');
        if(strOption.match(ExpReg))DefineWidth =  RegExp.$1;
        
        //$ Recherche la valeur du 'height' de la fenêtre
        ExpReg = new RegExp('height\\s*=\\s*(\\d+)', 'gi');
        if(strOption.match(ExpReg))DefineHeight =  RegExp.$1;
        
        //$ Déterminer le nouveau 'top'
        if(DefineTop == null) //$ Si l'option ne contient pas de 'top'
        {
                // Si l'option ne contient pas de 'height' on place le 'top' en 0
                if (DefineHeight == null)DefineTop = "top=0";
                else 
                {
                        DefineTop = ((screen.availHeight - DefineHeight) / 2);
                        DefineTop = "top=" + parseInt(DefineTop);
                }       
                
                //$ Si l'option n'est pas vide
                if(strOption != "")DefineTop = "," + DefineTop;
        }
        else DefineTop = "";
        
        //$ Déterminer le nouveau 'left'
        if(DefineLeft == null) //$ Si l'option ne contient pas de 'left'
        {
                // Si l'option ne contient pas de 'width' on place le 'left' en 0
                if (DefineWidth == null)DefineLeft = "left=0";
                else
                {
                        DefineLeft = ((screen.availWidth - DefineWidth) / 2);
                        DefineLeft = "left=" + parseInt(DefineLeft);
                }
                
                //$ Si l'option n'est pas vide
                if(strOption != "")DefineLeft = "," + DefineLeft;
        }
        else DefineLeft = "";
                
        var NewOption = strOption + DefineLeft + DefineTop;        
	strNewWindow = window.open(strUrl, strName, NewOption);	
	strNewWindow.creator = self;
}


//$=========================================================================================
//$=========================================================================================
