var last_id = null;
var last_img= null;
function show_block(id_block){
	if(last_id != null && last_id != id_block){
		close_block(last_id);
	}
	if(last_id != id_block){
		last_id=id_block;
		open_block(id_block);
	}
}
function show_menu(id_block){
	elem = document.getElementById('logo');
	elem.style.zIndex = 1;
	if(last_id != null && last_id != id_block){
		close_block(last_id);
	}
	if(last_id != id_block){
		last_id=id_block;
		open_block(id_block);
	}
}
function hide_menu(){
	elem = document.getElementById('logo');
	elem.style.zIndex = 5;
	if(last_id != null){
		close_block(last_id);
		last_id = null;
	}
}
function show_img(id_img){
	if(last_img != null && last_img != id_img){
		close_block(last_img);
	}
	if(last_img != id_img){
		last_img=id_img;
		open_block2(id_img);
	}
}
function hide_last(){
	if(last_id != null){
		close_block(last_id);
		last_id = null;
	}
}
function switch_blocks(id_open, id_close){
	open_block(id_open);
	close_block(id_close);
}
function open_block(id_block){
	elem = document.getElementById(id_block);
	if(elem.style.display == 'none' || elem.style.display == ''){
		elem.style.display = 'block';
	}else{
		close_block(id_block);
	}
}
function close_block(id_block){
	elem = document.getElementById(id_block);
	elem.style.display = 'none';
	last_id = null;
}
function open_block2(id_block){
	elem = document.getElementById(id_block);
	if(elem.style.display == 'none' || elem.style.display == ''){
		elem.style.display = 'block';
	}
}
function isDateValid(chaineDate) {
   if (chaineDate == "") return false;
   var ladate = (chaineDate).split("/");
   if ((ladate.length != 3) || isNaN(parseInt(ladate[0])) || isNaN(parseInt(ladate[1])) || isNaN(parseInt(ladate[2]))) return false;
   var unedate = new Date(eval(ladate[2]),eval(ladate[1])-1,eval(ladate[0]));
   var annee = unedate.getYear();
   if ((Math.abs(annee)+"").length < 4) annee = annee + 1900
   
   return ((unedate.getDate() == eval(ladate[0])) && (unedate.getMonth() == eval(ladate[1])-1) && (annee == eval(ladate[2])));
}

//défilement des news
var v_defil_news = 20; // temps en milliseconde 
var l_defil_news = 1;  //déplacement en pixel
var act_pos_news = 0; //position actuellle du panorama
var id_move_news;

var elem_news;
function init_news(){
	elem_news = document.getElementById("news-txt1");
	act_pos_news = elem_news.offsetLeft;
	elem_news.style.left = act_pos_news + "px";
	defil_news();
}
function defil_news(){
	act_pos_news = act_pos_news - l_defil_news;
	
	if(act_pos_news < -elem_news.offsetWidth){
		act_pos_news = elem_news.parentNode.offsetWidth;
	}
	elem_news.style.left = act_pos_news+"px";
	id_move_news=setTimeout("defil_news()", v_defil_news);
}

function defil_news_v_init(){
	l_defil_news = 1;
}
