var bt_ok_over = new Image();
bt_ok_over.src ="/images/bt_ok_2.png";

var cNews=0;
var aPhrase=new Array();
var iWord = aPhrase.length;		
var temp=new String();
var timer=15,cTime=0;		
var timerID;
var flashInfo = document.getElementById("flash-info");		
		


function lancerPrompteur(){	
	if(!(navigator.platform.indexOf("MacPPC")!=-1 && navigator.userAgent.indexOf("MSIE")!=-1))
		//timerID=window.setInterval("prompteur2()",2000);
		prompteurInit();
} 

function prompteur3(){		 
	if(iWord == aPhrase.length){						
		setTimeout('prompteurInit()',3000);	
	}
	else{
	//On affiche les mots 
		temp += aPhrase[iWord]+" ";
		document.getElementById("flash-info").childNodes[0].childNodes[1].childNodes[0].nodeValue=temp; 
		iWord++;
		setTimeout('prompteur3()',150);		
	}					
}
		
function prompteurInit() {
	(cNews < aNews.length-1) ? cNews++ : cNews=0;
	aPhrase = aNews[cNews].split(" ");
	iWord=0;temp="";   
	var lelien = document.getElementById("flash-info").childNodes[0].childNodes[1]; 
	lelien.href = aLiens[cNews]; 
	lelien.childNodes[0].nodeValue="";		 
	setTimeout('prompteur3()',150);	
}

/* fonction qui gere le rollover des boutons */
setBt_ok = function(){
	if (document.getElementById) {		bt = document.getElementById("bt_recherche"); 
		bt.onmouseover = function(){ this.src="/images/bt_ok_2.png";}
		bt.onmouseout = function(){	this.src="/images/bt_ok_1.png";}
		
		bt=document.getElementById("acces-direct");
		if(bt){
			for (i=0; i<bt.childNodes.length; i++) {				node = bt.childNodes[i];				if (node.nodeName=="INPUT") {					node.onmouseover=function() {this.src="/images/bt_ok_2.png";}					node.onmouseout=function() { this.src="/images/bt_ok_1.png";}				}			}
		}
	}	
} 
/*Fonction qui gere le menu */
startList = function() {	if (document.all && document.getElementById) {			navRoot = document.getElementById("menu");		for (i=0; i<navRoot.childNodes.length; i++) {			node = navRoot.childNodes[i];			if (node.nodeName=="LI") {				node.onmouseover=function() {					this.className+="over"; 				}				node.onmouseout=function() {					this.className=this.className.replace("over", "");				}			}		}	}}
accessTo = function(form){
	var compo = form.composantes; 
	var serv =  form.services;
	var centres =  form.centres;
	var pres = form.presidence;
	if(pres[pres.selectedIndex].value != "#") {
		document.location = pres[pres.selectedIndex].value;
		return false;
	}
	if(compo[compo.selectedIndex].value != "#") {
		document.location = compo[compo.selectedIndex].value;
		return false;
	}
	if(serv[serv.selectedIndex].value != "#") {
		document.location = serv[serv.selectedIndex].value;
		return false;
	}
	if(centres[centres.selectedIndex].value != "#") {
		document.location = centres[centres.selectedIndex].value;
		return false;
	}
	return false;
}

var formfocus = function(){
	var f = document.accessto; 
	if(f != undefined){
		var it = ["presidence","composantes","services","centres"];
		for(var i in it) if(f[it[i]].name != this.name) f[it[i]].selectedIndex = 0;
	}
}
initAccessTo = function(){
	var f = document.accessto;
	if(f != undefined){
	var it = ["presidence","composantes","services","centres"];
		f.composantes.selectedIndex=0;
		f.composantes.onfocus = formfocus;
		f.services.selectedIndex=0;
		f.services.onfocus = formfocus;
		f.centres.selectedIndex=0;
		f.centres.onfocus = formfocus;
		f.presidence.selectedIndex=0;
		f.presidence.onfocus = formfocus;
	}
}


window.onload=function(){
	initAccessTo();
	startList();
	setBt_ok();
}