<!--//--><![CDATA[//><!--

sfHover = function() {
	var sfEls = document.getElementById("rubriques").getElementsByTagName("li");
	for (var i=1; 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);

//--><!]]>

window.onload=function(){

	/*parfait sous FF
	Nifty("div.breves","big transparent");
	Nifty("div#left .menu-titre","big transparent top");	

	Nifty("div.encart","big transparent");
	Nifty("div#centrecontent .menu-titre","big transparent top");	
	*/
	/* Affichage des blocs à bors arrondis */
	Nifty("div#texte-sommaire","big transparent");
	Nifty("div#jumpmenu","big transparent");

	Nifty("div#hierarchie","br big transparent");

	Nifty("div.breves","big transparent");
	Nifty("div.options","big transparent");

	Nifty("h2.menu-titre","bottom big transparent");	

	Nifty("h3.menu-titre","medium transparent");
	
	/*
	Nifty("div#visuel-sommaire","big transparent");
	*/

	/* Affichage du fade dans le contenu des articles FF only 
	changeOpac(20,'contre-encart');
	div_fadeIn('contre-encart', 500);
	*/
}

/* =========== FADING ============ */

// Fait un fondu d'entrée (Alpha x->100)
function div_fadeIn(id, temps)
{
	opacity(id, currentOpac(id), 100, temps);
}

// Fait un fondu de sortie (Alpha x->0)
function div_fadeOut(id, temps)
{
	opacity(id, currentOpac(id), 0, temps);
}

function opacity(id, opacStart, opacEnd, millisec) {
	//speed for each frame
	var speed = Math.round(millisec / 100);
	var timer = 0;

	//determine the direction for the blending, if start and end are the same nothing happens
	if(opacStart > opacEnd) {
		for(i = opacStart; i >= opacEnd; i--) {
			setTimeout("changeOpac(" + i + ",'" + id + "')",(timer * speed));
			timer++;
		}
	} else if(opacStart < opacEnd) {
		for(i = opacStart; i <= opacEnd; i++)
			{
			setTimeout("changeOpac(" + i + ",'" + id + "')",(timer * speed));
			timer++;
		}
	}
}

//change the opacity for different browsers
function changeOpac(opacity, id) {
	var object = document.getElementById(id).style; 
	object.opacity = (opacity / 100);
	//object.MozOpacity = (opacity / 100);
	//object.KhtmlOpacity = (opacity / 100);
	//object.filter = "alpha(opacity=" + opacity + ")";
}

function currentOpac(id) {
	//standard opacity is 100
	var currentOpac = 100;
	
	//if the element has an opacity set, get it
	if(document.getElementById(id).style.opacity < 100) {
		currentOpac = document.getElementById(id).style.opacity * 100;
	}

	return currentOpac;
}

function displayLogo(path){
	var id_article = '52';
	var id_secteur = '1';
	logo = new Image(146,199);
	if (path != 0) {
		logo.src = "IMG/"+path;
	}else if (id_article != '' && id_secteur < 3){
		logo.src = "IMG/arton52.png";
	}else{
		 logo.src = "IMG/arton144.jpg";
	}
	document.getElementById('country').innerHTML = "<img src='"+logo.src+"' usemap='#europe' />";
}

function displayName(name){
	var x = document.getElementById(name).style;
	if (x.display == 'inline') x.display = 'none';
	else x.display = 'inline';

	return false;
}

function timetablesMsg(){

	cdata = document.getElementsByTagName('description');

	if(cdata[0]){
		msg = cdata[0].innerHTML;

		//alert(msg);
		tmp = msg.replace('<!--[CDATA[', '');
		tmp2 = tmp.replace(']]-->', '');
		error_msg = tmp2.replace('Interactive Rail Maps', '<a href="http://downloads.raileurope.com/map_of_europe/europe.html" target="_blank">Interactive Rail Maps</a>');
		//alert(error_msg);
		display = document.getElementById('error_msg').innerHTML = "<span style='color:red;padding:5px;'>"+error_msg+"</span>";

	}else{
		return false;
	}
}