///////////////////////////////////////////////////////
// MENUS
///////////////////////////////////////////////////////
function onmouseover_menu(id){
	document.getElementById(id).style.background = "#7B8CA5";
}

function onmouseout_menu(id){
	document.getElementById(id).style.background = "";
}

function openPage(id){
	document.location.href = id + ".php";
}

function activeMenu(id){
	document.getElementById(id).style.borderBottom = "solid 2px #F0A400";
	document.getElementById(id).style.borderTop = "solid 2px #7B8CA5";
}

function activeSousMenu(id,n){
	for(var i=1;i<=n;i++){
		document.getElementById("menu" + i).style.color = "";
		document.getElementById("menu" + i).style.fontWeight = "normal";
		document.getElementById("module" + i).style.display = "none";
	}
	
	document.getElementById("menu" + id).style.color = "#A25461";
	document.getElementById("menu" + id).style.fontWeight = "bold";
	document.getElementById("module" + id).style.display = "block";
}

function afficheMois(id){
	var mois;
	
	if(id=='now'){
		var aujourd_hui = new Date();
		var annee = Number(aujourd_hui.getFullYear());
		var mois = Format2Pos(Number(aujourd_hui.getMonth() + 1));
		mois = annee + '_' + mois;
	}
	else{
		mois = id;
	}

	if(document.getElementById(mois)!=null){
		if(document.getElementById(mois).style.display == "none"){
			document.getElementById(mois).style.display = "block";
			document.getElementById("img_" + mois).src = "images/rubrique_programme/moins.png";
		}
		else{
			document.getElementById(mois).style.display = "none";
			document.getElementById("img_" + mois).src = "images/rubrique_programme/plus.png";
		}
	}
}

function Format2Pos(nb)
{
  if(Number(nb)<10)
  {return '0'+nb}
  else
  {return nb}
}

function afficheEvent(id){
	if(document.getElementById(id)!=null){
		if(document.getElementById(id).style.display == "none"){
			document.getElementById(id).style.display = "block";
			document.getElementById("img_" + id).src = "images/rubrique_programme/moins2.png";
		}
		else{
			document.getElementById(id).style.display = "none";
			document.getElementById("img_" + id).src = "images/rubrique_programme/plus2.png";
		}
	}
}

///////////////////////////////////////////////////////
// OUVERTURE PAGE                               
///////////////////////////////////////////////////////
function NewPage(url,pagewidth,pageheight){
   var margeleft, margetop, largeur, hauteur;

	if((typeof(pagewidth)!="undefined")&&(typeof(pageheight)!="undefined")){
		largeur=pagewidth;
		hauteur=pageheight;
	}
	else{
		largeur=700;
		hauteur=550;
	}
	
	if(largeur < screen.availWidth){
		margeleft=(screen.availWidth-largeur)/2;
	}
	else{
		largeur=screen.availWidth;
		margeleft=0;
	}

	if(hauteur < screen.availHeight){
		margetop=(screen.availHeight-hauteur)/2;
	}
	else{
		hauteur=screen.availHeight;
		margetop=0;
	}
	
	window.open(url,"_blank","menubar=no,scrollbars=yes,resizable=yes,width="+largeur+"px,height="+hauteur+"px,left="+margeleft+",top="+margetop+"");
}

