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();
	if (year<1000) year = year + 1900;

	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);
}

document.write("<LINK REL='stylesheet' TYPE='text/css' HREF='http://arche.francetv.fr/1024/france5/style.css'>") ;

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
function showHide(lyr, what){
	document.getElementById(lyr).style.visibility=what;
}

function HideAll(){
	for  (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;
}

/*function clk(_el,_class,_page) {
	if (document.location.href=="http://www.france5.fr")	{
		{if(document.images)
			{
			(new Image()).src="http://prof.estat.com/cgi-bin/ft/08637?class="+escape(_class)+"&page="+escape(_page)+"&estat_url="+escape(_el.href)+"?";
			}
		}
	}
	return true;
}*/

function clk(_el,_class,_page) {
	if (document.location.href=="http://www.france5.fr")	{
		{if(document.images)
			{
			(new Image()).src="http://stat3.cybermonitor.com/cgi-bin/ft/08637?svc_mode=I&svc_campaign="+escape(_class)+"&svc_position="+escape(_page)+"&estat_url="+escape(_el.href)+"%3F";
			}
		}
	}
	return true;
}