var WCH_Constructor = function() {
	//	exit point for anything but IE5.0+/Win
	if ( !(document.all && document.getElementById && !window.opera && navigator.userAgent.toLowerCase().indexOf("mac") == -1) ) {
		this.Apply = function() {};
		this.Discard = function() {};
		return;
	}

	//	private properties
	var _bIE55 = false;
	var _bIE6 = false;
	var _oRule = null;
	var _bSetup = true;
	var _oSelf = this;

	//	public: hides windowed controls
	this.Apply = function(vLayer, vContainer, bResize) {
		if (_bSetup) _Setup();

		if ( _bIE55 && (oIframe = _Hider(vLayer, vContainer, bResize)) ) {
			oIframe.style.visibility = "visible";
		} else if(_oRule != null) {
			_oRule.style.visibility = "hidden";
		}

	};

	//	public: shows windowed controls
	this.Discard = function(vLayer, vContainer) {
		if ( _bIE55 && (oIframe = _Hider(vLayer, vContainer, false)) ) {
			oIframe.style.visibility = "hidden";
		} else if(_oRule != null) {
			_oRule.style.visibility = "visible";
		}
	};

	//	private: returns iFrame reference for IE5.5+
	function _Hider(vLayer, vContainer, bResize) {
		var oLayer = _GetObj(vLayer);
		var oContainer = ( (oTmp = _GetObj(vContainer)) ? oTmp : document.getElementsByTagName("body")[0] );
		if (!oLayer || !oContainer) return;
		//	is it there already?
		var oIframe = document.getElementById("WCHhider" + oLayer.id);
		
		//	if not, create it
		if ( !oIframe ) {
			//	IE 6 has this property, IE 5 not. IE 5.5(even SP2) crashes when filter is applied, hence the check
			var sFilter = (_bIE6) ? "filter:progid:DXImageTransform.Microsoft.Alpha(style=0,opacity=0);" : "";
			//	get z-index of the object
			var zIndex = oLayer.style.zIndex;
			if ( zIndex == "" ) zIndex = oLayer.currentStyle.zIndex;
			zIndex = parseInt(zIndex);
			//	if no z-index, do nothing
			if ( isNaN(zIndex) ) return null;
			//	if z-index is below 2, do nothing (no room for Hider)
			if (zIndex < 2) return null;
			//	go one step below for Hider
			zIndex--;
			var sHiderID = "WCHhider" + oLayer.id;
			oContainer.insertAdjacentHTML("afterBegin", '<iframe class="WCHiframe" src="javascript:false;" id="' + sHiderID + '" scroll="no" frameborder="0" style="position:absolute;visibility:hidden;' + sFilter + 'border:0;top:0;left;0;width:0;height:0;background-color:#ccc;z-index:' + zIndex + ';"></iframe>');
			oIframe = document.getElementById(sHiderID);
			//	then do calculation
			_SetPos(oIframe, oLayer);
		} else if (bResize) {
			//	resize the iFrame if asked
			_SetPos(oIframe, oLayer);
		}
		return oIframe;
	};

	//	private: set size and position of the Hider
	function _SetPos(oIframe, oLayer) {
		//	fetch and set size
		oIframe.style.width = oLayer.offsetWidth + "px";
		oIframe.style.height = oLayer.offsetHeight + "px";
		//	move to specified position
		oIframe.style.left = oLayer.offsetLeft + "px";
		oIframe.style.top = oLayer.offsetTop + "px";
	};

	//	private: returns object reference
	function _GetObj(vObj) {
		var oObj = null;
		switch( typeof(vObj) ) {
			case "object":
				oObj = vObj;
				break;
			case "string":
				oObj = document.getElementById(vObj);
				break;
		}
		return oObj;
	};

	//	private: setup properties on first call to Apply
	function _Setup() {
		_bIE55 = (typeof(document.body.contentEditable) != "undefined");
		_bIE6 = (typeof(document.compatMode) != "undefined");

		if (!_bIE55) {
			if (document.styleSheets.length == 0)
				document.createStyleSheet();
			var oSheet = document.styleSheets[0];
			oSheet.addRule(".WCHhider", "visibility:visible");
			_oRule = oSheet.rules(oSheet.rules.length-1);
		}

		_bSetup = false;
	};
};
var WCH = new WCH_Constructor();

function afficheDate(){
 var months=new Array(13);
 months[1]="Janvier";
 months[2]="Février";
 months[3]="Mars";
 months[4]="Avril";
 months[5]="Mai";
 months[6]="Juin";
 months[7]="Juillet";
 months[8]="Août";
 months[9]="Septembre";
 months[10]="Octobre";
 months[11]="Novembre";
 months[12]="Décembre";
 
 var today=new Date(); 
 var lmonth=months[today.getMonth() + 1];
 var date=today.getDate();
 var daynum = today.getDay() + 1;
 
 if(date==1) date = "1er";   
 if(daynum==1) day = "Dimanche";   
 if(daynum==2) day = "Lundi";
 if(daynum==3) day = "Mardi";
 if(daynum==4) day = "Mercredi";
 if(daynum==5) day = "Jeudi";
 if(daynum==6) day = "Vendredi";
 if(daynum==7) day = "Samedi";
 
 var year = today.getYear();
 
 var todaysdate= (day + " " + date + " " + lmonth + " " + year);
 document.write(todaysdate);
}

function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}

MM_reloadPage(true);
function MM_findObj(n, d) { //v4.0
  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 && document.getElementById) x=document.getElementById(n); return x;
}

function MM_showHideLayers() { //v3.0
  var i,p,v,obj,args=MM_showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v='hide')?'hidden':v; }
    obj.visibility=v; }
}
function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

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 clk(_el,_class,_page){
	if(document.images){
		(new Image()).src="http://prof.estat.com/cgi-bin/ft/01113?class="+escape(_class)+"&page="+escape(_page)+"&estat_url="+escape(_el.href)+"?";
	}
	return true;
}

function launchRecherche(fonction){
	if (document.forms['rechercher'].KEYWORDS.value=="")	{
		alert("Vous devez saisir un mot clé");
		return false;
	} else{
		if (document.forms['rechercher'].recherche(0).checked==false)	{
			document.rechercher.method="POST";			
			document.rechercher.action="http://www.france5.fr/recherche/resultat_recherche.cfm?requesttimeout=500&chemin=/recherche/&texte="+document.forms['rechercher'].KEYWORDS.value;
		}
		return true;
	} 
}

// NEW VERSION

// BIBLIO
var hiddingTimer = false;

function hideTimerStart() {
	hideTimerStop();
	if(!hiddingTimer)
		hiddingTimer = window.setTimeout('HideAll()', '200');
}

function hideTimerStop() {
	if(hiddingTimer) {
		window.clearTimeout(hiddingTimer);
		hiddingTimer = false;
	}
}

function showHide(lyr, what){
	hideTimerStop();
	document.getElementById(lyr).style.visibility=what;
}

function HideAll(){
	hideTimerStop();
	for  (var i=1; i<=10; i++){
		document.getElementById('nav'+i).style.visibility='hidden';
	}
}

function init(){
	for  (i=1; i<=10; i++){
		obj = document.getElementById('ancre_'+i);
		posLeft = getLeft(obj);
		posTop = getTop(obj);
		document.getElementById('nav'+i).style.left=posLeft;
		document.getElementById('nav'+i).style.top=posTop;
	}
}

function getLeft(MyObject){
    if (MyObject.offsetParent) return (MyObject.offsetLeft + getLeft(MyObject.offsetParent));
    else return (MyObject.offsetLeft);
}

function getTop(MyObject){
    if (MyObject.offsetParent) return (MyObject.offsetTop + getTop(MyObject.offsetParent));
    else return (MyObject.offsetTop);
}

// base
function rollOverOrg(ImgNme)
{
        obj=document.images[ImgNme];
        obj.src=(obj.src.lastIndexOf('_on')!=-1)? obj.src.replace(/_on/gi,"_off"):obj.src.replace(/_off/gi,"_on");
}

// layers
function rollOver(ImgNme)
{
        obj=(document.images)? document.images[ImgNme]:0; ClicNme=(document.clicImg)? document.clicImg.name:""; 
        if (!obj && document.layers) {
                for (i=0; i<document.layers.length; i++) { ObjLyr=document.layers[i].document;
                        if (ObjLyr.images && ObjLyr.images[ImgNme]) obj=ObjLyr.images[ImgNme];}}                
        if (ClicNme!=ImgNme) obj.src=(obj.src.lastIndexOf('_on')!=-1)? obj.src.replace(/_on/gi,"_off"):obj.src.replace(/_off/gi,"_on");
        document.OnImg=obj;
}

// clic
function Clic(ImgNme)
{
        obj=(document.images)? document.images[ImgNme]:0; ClicNme=(document.clicImg)? document.clicImg.name:""; 
        if (!obj && document.layers) {
                for (i=0; i<document.layers.length; i++) { ObjLyr=document.layers[i].document;
                        if (ObjLyr.images && ObjLyr.images[ImgNme]) obj=ObjLyr.images[ImgNme];}}        
        if (document.clicImg) document.clicImg.src=document.clicImg.src.replace(/_on/gi,"_off");
        obj.src=obj.src.replace(/_off/gi,"_on");
        document.clicImg=obj;
}

///////////////////////////////
// SCRIPT DE DETECTION FLASH //
///////////////////////////////
//requiredVersion est la valeur du plugin que l'on veut détecter
var requiredVersion = 7;
var flash2Installed = false;
var flash3Installed = false;
var flash4Installed = false;
var flash5Installed = false;
var flash6Installed = false;
var flash7Installed = false;
var maxVersion = 7;
//actualVersion sera la valeur du plugin installé sur la machine
var actualVersion = 0;
var jsVersion = 1.0;

var isWin = (navigator.appVersion.indexOf("Windows") != -1) ? true : false;
var ns4=(document.layers);
var ie4=(document.all&&!document.getElementById);
var ie5=(document.all&&document.getElementById);
var ns6=(!document.all&&document.getElementById);
var isMac=(navigator.appVersion.indexOf("Mac")>=0)?1:0;
var dom=(document.getElementById)? 1:0;
var isIE = (ie4 || ie5)?1:0;

jsVersion = 1.1;
if(isIE && isWin){
  document.write('<SCR' + 'IPT LANGUAGE=VBScript\> \n');
  document.write('on error resume next \n');
  document.write('flash2Installed = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.2"))) \n');
  document.write('flash3Installed = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.3"))) \n');
  document.write('flash4Installed = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.4"))) \n');
  document.write('flash5Installed = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.5"))) \n');
  document.write('flash6Installed = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.6"))) \n');
  document.write('flash7Installed = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.7"))) \n');
  document.write('</SCR' + 'IPT\> \n'); // break up end tag so it doesn't end our script
}
function detectFlash() {
  if (navigator.plugins) {
    if (navigator.plugins["Shockwave Flash 2.0"] || navigator.plugins["Shockwave Flash"]) {
      var isVersion2 = navigator.plugins["Shockwave Flash 2.0"] ? " 2.0" : "";
      var flashDescription = navigator.plugins["Shockwave Flash" + isVersion2].description;
      var flashVersion = parseInt(flashDescription.charAt(flashDescription.indexOf(".") - 1));
      flash2Installed = flashVersion == 2;
      flash3Installed = flashVersion == 3;
      flash4Installed = flashVersion == 4;
      flash5Installed = flashVersion == 5;
      flash6Installed = flashVersion == 6;
      flash7Installed = flashVersion >= 7;
    }
  }
  else if (isMac){
	//pour MAC IE, on estime que le plugin est installé...
	actualVersion = 7;
 }
  for (var i = 2; i <= maxVersion; i++) {
    if (eval("flash" + i + "Installed") == true){
		actualVersion = i;
	}
  }
  if(navigator.userAgent.indexOf("WebTV") != -1) actualVersion = 3;
  if (actualVersion >= requiredVersion) {
  	//la version du plugin installé est supérieure ou égale à la version nécessaire
	} 
	else {
		//la version du plugin installé est inférieure à la version nécessaire
       noflash();
    }
}
detectFlash();

function noflash(){
	if(isIE && isWin){
		//keud
	}
	else{
		/*if (confirm("The flash plugin installed on your computer is not the latest one.\nYou may experience some graphic buggs.\nWe recommand that you download the latest flash plugin...")){
			window.open("http://www.macromedia.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash","_blank","toolbar=yes,location=yes,directories=yes,status=yes,scrollbars=yes,resizable=yes,copyhistory=yes");
		}*/
	}
}

function quelleVersion(){
	alert("version plugin flash installé = " + actualVersion);
}