// JavaScript Document

function EcrireCookie(nom, valeur)
{
var argv=EcrireCookie.arguments;
var argc=EcrireCookie.arguments.length;
var expires=(argc > 2) ? argv[2] : null;
var path=(argc > 3) ? argv[3] : null;
var domain=(argc > 4) ? argv[4] : null;
var secure=(argc > 5) ? argv[5] : false;
document.cookie=nom+"="+escape(valeur)+
((expires==null) ? "" : ("; expires="+expires.toGMTString()))+
((path==null) ? "" : ("; path="+path))+
((domain==null) ? "" : ("; domain="+domain))+
((secure==true) ? "; secure" : "");
}

function getCookieVal(offset)
{
var endstr=document.cookie.indexOf (";", offset);
if (endstr==-1) endstr=document.cookie.length;
return unescape(document.cookie.substring(offset, endstr));
}

function LireCookie(nom)
{
	var arg=nom+"=";
	var alen=arg.length;
	var clen=document.cookie.length;
	var i=0;
	while (i<clen)
	{
		var j=i+alen;
		if (document.cookie.substring(i, j)==arg) return getCookieVal(j);
		i=document.cookie.indexOf(" ",i)+1;
		if (i==0) break;

	}
	return null;
}

function EffaceCookie(nom)
{
date=new Date;
date.setMonth(date.getMonth()-1);
EcrireCookie(nom,null,date);
}

function AfficherMenuActu(menu,titre) {
	AnnulerCacherActu();
	with(document.getElementById(menu).style)
		visibility="visible";
	with(document.getElementById(titre).style)
		backgroundColor="#FF0000";
}

function AfficherTitreActu(titre) {
	with(document.getElementById(titre).style)
		backgroundColor="#FF0000";
}

function AfficherMenuTechno(menu, titre) {
	AnnulerCacherTechno();
	with(document.getElementById(menu).style)
		visibility="visible";
	with(document.getElementById(titre).style)
		backgroundColor="#00CC00";
}

function AfficherTitreTechno(titre) {
	with(document.getElementById(titre).style)
		backgroundColor="#00CC00";
}

function AfficherMenuMag(menu, titre) {
	AnnulerCacherMag();
	with(document.getElementById(menu).style)
		visibility="visible";
	with(document.getElementById(titre).style)
		backgroundColor="#eef5ff";
}

function AfficherTitreMag(titre) {
	with(document.getElementById(titre).style)
		backgroundColor="#0066ff";
}

function AfficherMenuCine(menu, titre) {
	AnnulerCacherCine();
	with(document.getElementById(menu).style)
		visibility="visible";
	with(document.getElementById(titre).style)
		backgroundColor="#0066FF";
}

function AfficherTitreCine(titre) {
	with(document.getElementById(titre).style)
		backgroundColor="#0066FF";
}

function AfficherTitreExtra(titre) {
	with(document.getElementById(titre).style)
		backgroundColor="#660099";
}

function MasquerTitreExtra(titre) {
	with(document.getElementById(titre).style)
		backgroundColor="#EFEFEF";
}

function CacherMenusActu() {
	with(document.getElementById('menuactulemonde').style)
			visibility="hidden"
	with(document.getElementById('menuactulefigaro').style)
			visibility="hidden"
	with(document.getElementById('menuactuliberation').style)
			visibility="hidden"
	with(document.getElementById('menuactulhumanite').style)
			visibility="hidden"
	with(document.getElementById('menuactulequipe').style)
			visibility="hidden"
}

function CacherMenusTechno() {
	with(document.getElementById('menutechnozdnet').style)
			visibility="hidden"
	with(document.getElementById('menutechnoclubic').style)
			visibility="hidden"
	with(document.getElementById('menutechnopcinpact').style)
			visibility="hidden"
}

function CacherMenusMag() {
	with(document.getElementById('menumagterraeconomica').style)
			visibility="hidden"
}

function CacherMenusCine() {
	with(document.getElementById('menucineutopiatoul').style)
			visibility="hidden"
}

function AfficherMenu(name) {
	AnnulerCacher();
	CacherMenus();
	with(document.getElementById(name).style)
		visibility="visible"
}


function AfficherSousMenu(sousmenu,menu) {
	AnnulerCacher();
	AnnulerCacherSousMenu();
	CacherMenus();
	CacherSousMenus();
	with(document.getElementById(menu).style)
		visibility = "visible"
	with(document.getElementById(sousmenu).style)
		visibility = "visible"
}


function CacherMenus() {
	with(document.getElementById("ressources").style)
			visibility="hidden"
	with(document.getElementById("outilschuck").style)
			visibility="hidden"
}

function CacherSousMenus() {
	with(document.getElementById("emploisdutemps").style)
			visibility="hidden";
	with(document.getElementById("plaquettes").style)
			visibility="hidden";
	with(document.getElementById("clubs").style)
			visibility="hidden";	
}

var timeout;
var timeoutsousmenu;
var timeoutactu;
var timeouttechno;
var timeoutmag;
var timeoutcine;

function MasquerMenu() {
	timeout=setTimeout("CacherMenus()",750);
}

function MasquerSousMenu() {
	timeoutsousmenu=setTimeout("CacherSousMenus()",500);
}

function MasquerMenusActu(titre) {
	with(document.getElementById(titre).style)
		backgroundColor="#FFF2F2";
	timeoutactu=setTimeout("CacherMenusActu()",500);
}

function MasquerMenusTechno(titre) {
	with(document.getElementById(titre).style)
		backgroundColor="#F2FFF2";
	timeouttechno=setTimeout("CacherMenusTechno()",500);
}

function MasquerMenusMag(titre) {
	with(document.getElementById(titre).style)
		backgroundColor="#eef5ff";
	timeoutmag=setTimeout("CacherMenusMag()",500);
}

function MasquerMenusCine(titre) {
	with(document.getElementById(titre).style)
		backgroundColor="#F7FAFF";
	timeoutcine=setTimeout("CacherMenusCine()",500);
}

function AnnulerCacher() {
	if (timeout) {
		clearTimeout(timeout);
	}
}

function AnnulerCacherSousMenu() {
	if (timeoutsousmenu) {
		clearTimeout(timeoutsousmenu);
	}
}

function AnnulerCacherActu() {
	if (timeoutactu) {
		clearTimeout(timeoutactu);
	}
}

function AnnulerCacherTechno() {
	if (timeouttechno) {
		clearTimeout(timeouttechno);
	}
}

function AnnulerCacherMag() {
	if (timeoutmag) {
		clearTimeout(timeoutmag);
	}
}

function AnnulerCacherCine() {
	if (timeoutcine) {
		clearTimeout(timeoutcine);
	}
}

function AfficherBlocActu(closebloc, openbloc, titre) {
	CacherMenusActu();
	MasquerMenusActu(titre);
	with(document.getElementById(closebloc).style)
			display="none"
	with(document.getElementById(openbloc).style)
			display="block"
	date=new Date;
	date.setMonth(date.getMonth()+12);
	EcrireCookie("choix_actu", openbloc, date);
}	

function AfficherBlocTechno(closebloc, openbloc, titre) {
	CacherMenusTechno();
	MasquerMenusTechno(titre);
	with(document.getElementById(closebloc).style)
			display="none"
	with(document.getElementById(openbloc).style)
			display="block"
	date=new Date();
	date.setMonth(date.getMonth()+12);
	EcrireCookie("choix_techno", openbloc, date);
}

function AfficherBlocMag(closebloc, openbloc, titre) {
	CacherMenusMag();
	MasquerMenusMag(titre);
	with(document.getElementById(closebloc).style)
			display="none"
	with(document.getElementById(openbloc).style)
			display="block"
	date=new Date();
	date.setMonth(date.getMonth()+12);
	EcrireCookie("choix_mag", openbloc, date);
}
	
function deroulermilieu(name) {
	with(document.getElementById(name).style){
		if (display == "none" || display == "")
			display = "block";
		else
			display = "none"	
	}
}

function roulerderoulermilieu(name1, name2) {
	with(document.getElementById(name1).style){
		if (display == "none" || display == "")
			display = "block";
		else
			display = "none"	
	}
	
	with(document.getElementById(name2).style){
		if (display == "block" || display == "")
			display = "none";
		else
			display = "block"	
	}
}

function roulerderoulersimplemilieu(name1, name2) {
	with(document.getElementById(name1).style){
		if (display == "none" || display == "")
			display = "block";
		else
			display = "none"	
	}
	
	with(document.getElementById(name2).style){
			display = "none";	
	}
}

