// init du nombre de rubriques dans le menu
var menunbr = 4;
//
var menunbr2 = 10;   
// 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) {
	var tmp;
	var listIds = [
					'p3p', 'p2p', 'p1p', 'p1a', 'p1b', 'p1c', 'p1d', 'p1e', 'p1f', 'p1g', 
					'p1h', 'p2a', 'p2b', 'p2c', 'p2d', 'p2e', 'p2f', 'p2g', 'p2h', 'p3a', 
					'p3b', 'p3c', 'p3d', 'p3e', 'p3f', 'p4a', 'p4b', 'p4c', 'p4d', 'p5a', 
					'p5b', 'p5c', 'p5d', 'p5e', 'p6a', 'p6b', 'p6c', 'p6d', 'p6e', 'p7a', 
					'p7b', 'p7c', 'p7d', 'p7e', 'p7f', 'p7g', 'p7h', 'p8a', 'p8b', 'p8c', 
					'p8d', 'p8e', 'p8f', 'p8g', 'p8h', 'p9a', 'p9b', 'p9c', 'p9e', 'p10a', 
					'p10b', 'p10c', 'p10d', 'p10e', 'p7b', 'p11a', 'p11b', 'p11c', 'p11d', 
					'p11e', 'p11f', 'p11g', 'p11h','p7d',  'p7e', 'p9d', 'p8c', 'p1i', 'p2i', 
					'p12a', 'p12b'
				];
	for(var i=0; i<listIds.length; i++) {
		tmp = theDoc.getElementById(listIds[i]);
		if(null!=tmp) tmp.style.color = "#58585A";
	}
	if (linkID) {
		tmp = theDoc.getElementById(linkID);
		if(null!=tmp) tmp.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;
}
