// init du nombre de rubriques dans le menu
var menunbr = 4;
//
var menunbr2 = 8;
// init autres var
var theDoc = document;
var y;
var hr;

function divmenu(divID,divHeight)
{
	if (theDoc.getElementById("p_div_"+divID).style.display!="")
	{
		for (i=1;i<(menunbr+1);i++)
		{
			eval ("document.getElementById('p_div_"+i+"').style.display='none';");
			eval ("document.getElementById('p"+i+"').style.color='#58585A';");
/*			eval ("document.getElementById('p"+i+"').style.fontWeight='';");*/
		}
		theDoc.getElementById("p_div_"+divID).style.display="";
		theDoc.getElementById("p"+divID).style.color="#FFFFFF";	
		theDoc.getElementById("motioncontainer").style.visibility="hidden";
/*		theDoc.getElementById("p"+divID).style.fontWeight="bold";*/

		if (navigator.platform.indexOf("Mac") != 0)
		{
			theDoc.getElementById("p_div_"+divID).style.height="0";
			speed = ((divHeight/12.5)+8);
			open_it(divHeight,"p_div_"+divID,speed)
		}
	}
   else 
   {
	theDoc.getElementById("p_div_"+divID).style.display="none";
   }
   
}

function divmenu2(divID,divHeight)
{
	if (theDoc.getElementById("s_div_"+divID).style.display!="")
	{
		for (i=1;i<(menunbr2+1);i++)
		{
			eval ("document.getElementById('s_div_"+i+"').style.display='none';");
			eval ("document.getElementById('s"+i+"').style.color='#58585A';");
/*			eval ("document.getElementById('p"+i+"').style.fontWeight='';");*/
		}
		theDoc.getElementById("s_div_"+divID).style.display="";
		//theDoc.getElementById("s"+divID).style.color="#FFFFFF";	
/*		theDoc.getElementById("p"+divID).style.fontWeight="bold";*/

		if (navigator.platform.indexOf("Mac") != 0)
		{
			theDoc.getElementById("s_div_"+divID).style.height="0";
			speed = ((divHeight/12.5)+8);
			open_it(divHeight,"s_div_"+divID,speed)
		}
	}
   else 
   {
	theDoc.getElementById("s_div_"+divID).style.display="none";
   }
}

function swap_c(linkID) {
	theDoc.getElementById('p3p').style.color="#58585A";
	theDoc.getElementById('p2p').style.color="#58585A";
	theDoc.getElementById('p1p').style.color="#58585A";
	theDoc.getElementById('p1a').style.color="#58585A";
	theDoc.getElementById('p1b').style.color="#58585A";
	theDoc.getElementById('p1c').style.color="#58585A";
	theDoc.getElementById('p1d').style.color="#58585A";
	theDoc.getElementById('p1e').style.color="#58585A";
	theDoc.getElementById('p1f').style.color="#58585A";
	theDoc.getElementById('p2a').style.color="#58585A";
	theDoc.getElementById('p2b').style.color="#58585A";
	theDoc.getElementById('p2c').style.color="#58585A";
	theDoc.getElementById('p2d').style.color="#58585A";
	theDoc.getElementById('p2e').style.color="#58585A";
	theDoc.getElementById('p2f').style.color="#58585A";
	theDoc.getElementById('p3a').style.color="#58585A";
	theDoc.getElementById('p3b').style.color="#58585A";
	theDoc.getElementById('p3c').style.color="#58585A";
	theDoc.getElementById('p3d').style.color="#58585A";
	theDoc.getElementById('p3e').style.color="#58585A";
	theDoc.getElementById('p3f').style.color="#58585A";
	theDoc.getElementById('p4a').style.color="#58585A";
	theDoc.getElementById('p4b').style.color="#58585A";
	/*theDoc.getElementById('p4c').style.color="#58585A";
	theDoc.getElementById('p4d').style.color="#58585A";*/
	theDoc.getElementById('p5a').style.color="#58585A";
	theDoc.getElementById('p5b').style.color="#58585A";
	theDoc.getElementById('p5c').style.color="#58585A";
	theDoc.getElementById('p5d').style.color="#58585A";
	theDoc.getElementById('p6a').style.color="#58585A";
	theDoc.getElementById('p7a').style.color="#58585A";
	theDoc.getElementById('p7b').style.color="#58585A";
	theDoc.getElementById('p8a').style.color="#58585A";
	theDoc.getElementById('p8b').style.color="#58585A";
/*	theDoc.getElementById('p7c').style.color="#58585A";	*/
/*	theDoc.getElementById('p7b').style.color="#58585A";*/
	if (linkID)
		theDoc.getElementById(linkID).style.color="#FFFFFF";
}

function swap_jj(img_name,to_what) {
	//if (extension==undefined)
		//extension = '.jpg';
//	alert (to_what);
	document.getElementById("motioncontainer").style.visibility="hidden";
	document.getElementById("telecharger").style.display="";
	var tmp = document.getElementById("telecharger2");
	var str=to_what;
	to_what2 = (str.replace(/fr/,""));
	tmp.href = "/visuels"+to_what2+".zip";
	
	var swap, towhat;
	swap	= eval('document.images.'+img_name);
	towhat='/_img/'+to_what+".jpg";
	swap.src	= towhat;
}

function revue() {
	swap_jj('visuel','fr/presse_vide');
	swap_c();
	for (i=1;i<(6);i++){
			eval ("document.getElementById('p_div_"+i+"').style.display='none';");
			eval ("document.getElementById('p"+i+"').style.color='#58585A';");
	}
	theDoc.getElementById("motioncontainer").style.visibility="visible";
	document.getElementById("telecharger").style.display="none";
}

function open_it(max,name,hm)
{
	
	if (hm<0) return;
	maxi = max;
	divname = name;
	act = theDoc.getElementById(divname).style.height;
	act2 = parseInt(act);

	if (act2>=maxi) { clearTimeout(tempoO); theDoc.getElementById(divname).style.height=maxi+"px"; return; };

	y = ((act2-1)+hm);
	hr = hm-1;
	theDoc.getElementById(divname).style.height=y+"px";
	tempoO = setTimeout('open_it(maxi,divname,hr)', 30);
}

// Ben-J 
function createQCObject() { 
   var req; 
   if(window.XMLHttpRequest){ 
      // Firefox, Safari, Opera... 
      req = new XMLHttpRequest(); 
   } else if(window.ActiveXObject) { 
      // Internet Explorer 5+ 
      req = new ActiveXObject("Microsoft.XMLHTTP"); 
   } else { 
      alert('Problem creating the XMLHttpRequest object'); 
   } 
   return req; 
} 

// Make the XMLHttpRequest object 
var http = createQCObject(); 

function displayAjax(m,t) {
//	var ran_no=(Math.round((Math.random()*9999)));
	http.open('GET', 'espace_presse_pop.php?i='+m+'&t='+t+'');
   	http.onreadystatechange = function() {
		if(http.readyState == 4 && http.status == 200) { 
      		var response = http.responseText;
      		if(response) {
				document.getElementById("alertFromAjaxTop").style.display = '';
				document.getElementById("alertFromAjax").style.left = ((document.getElementsByTagName('HTML')[0].scrollWidth/2)-415)+'px';
				document.getElementById("alertFromAjax").style.top = '5px';
				document.getElementById("alertFromAjax").style.display = '';
				document.getElementById("alertFromAjax").innerHTML = http.responseText;
      		} 
   		} 
	} 
	http.send(null);
}

function popen(urlstr,name,largeur,hauteur)
{
	var top=(screen.height-hauteur)/2;
    var gch=(screen.width-largeur)/2;
	new_win = window.open(urlstr, name, 'toolbar=no, location=no, directories=no, status=no, scrollbars=yes, resizable=no, menubar=no, width='+largeur+', height='+hauteur+', top='+top+', left='+gch+'');
	new_win.focus();
	return;
}