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';
}
function open_block2(id_block){
	elem = document.getElementById(id_block);
	if(elem.style.display == 'none' || elem.style.display == ''){
		elem.style.display = 'block';
	}
}

function ctrl_frm_coords(obj, etat, id_visible){
	elem = document.getElementById(id_visible);
	
	if(obj.checked && etat){
		elem.style.display = 'table-row';
	}else{
		elem.style.display = 'none';
	}
}
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])));
}
function print_mail(pre, suf, vClass, vStyle){
	var mail="<a href=\"mailto:";	 
	mail += pre;
	mail +="@";
	mail += suf;
	mail += "\"";
	if(vClass!=""){
		mail += " class=\"" + vClass + "\"";
	}
	if(vStyle!=""){
		mail += " style=\"" + vStyle + "\"";
	}
	mail += ">";
	mail += pre;
	mail +="@";
	mail += suf;
	mail +="</a>"; 
	document.write(mail);
}
