var  menuselect;

function afficheId(baliseId) 
{
	if(menuselect)	cacheId(menuselect);
	
	afficheDIV('specialeffect');
	
	if (document.getElementById && document.getElementById(baliseId) != null) 
	{
	    document.getElementById(baliseId).style.visibility='visible';
	    document.getElementById(baliseId).style.display='block';
	    menuselect = baliseId;
	}
}

function cacheId(baliseId) 
{
		cacheDIV('specialeffect');
  if (document.getElementById && document.getElementById(baliseId) != null) 
    {
    document.getElementById(baliseId).style.visibility='hidden';
    document.getElementById(baliseId).style.display='none';
    }
}



function afficheDIV(baliseId) 
{
	
	if (document.getElementById && document.getElementById(baliseId) != null) 
	{
	    document.getElementById(baliseId).style.visibility='visible';
	    document.getElementById(baliseId).style.display='block';

	}
}

function cacheDIV(baliseId) 
{
  if (document.getElementById && document.getElementById(baliseId) != null) 
    {
    document.getElementById(baliseId).style.visibility='hidden';
    document.getElementById(baliseId).style.display='none';
    }
}


function changeActu(param) {
	
	
		var xhr_object = null;
		
		if(window.XMLHttpRequest) // Firefox
			xhr_object = new XMLHttpRequest();
		else if(window.ActiveXObject) // Internet Explorer
			xhr_object = new ActiveXObject("Microsoft.XMLHTTP");
		else { // XMLHttpRequest non supporté par le navigateur
			alert("Votre navigateur ne supporte pas les objets XMLHTTPRequest...");
		return;
		}		
		
		if(param) {	
			data = param;
		} else {
			data = "";	
		}
		

		filename = "ajax_actu.php";
		
			xhr_object.open("POST", filename, true);
			xhr_object.onreadystatechange = function() {   
				if(xhr_object.readyState == 4) {
					
					var d = document.getElementById("contenu");
					d.innerHTML =xhr_object.responseText;

	   
				}
			}  
	 
		
			xhr_object.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
			xhr_object.send(data);
}


function changeContenu(page,parametres) {
		
		if(menuselect)	cacheId(menuselect);

	
		var xhr_object = null;
		
		if(window.XMLHttpRequest) // Firefox
			xhr_object = new XMLHttpRequest();
		else if(window.ActiveXObject) // Internet Explorer
			xhr_object = new ActiveXObject("Microsoft.XMLHTTP");
		else { // XMLHttpRequest non supporté par le navigateur
			alert("Votre navigateur ne supporte pas les objets XMLHTTPRequest...");
		return;
		}		
		
		if(parametres) { data = parametres; }
		else { data = ""; }
		

		filename = "ajax_"+page+".php";
		
			xhr_object.open("POST", filename, true);
			xhr_object.onreadystatechange = function() {   
				if(xhr_object.readyState == 4) {
					
					var d = document.getElementById("contenu");
					d.innerHTML =xhr_object.responseText;
					afficheDIV('contenu');

	   
				}
			}  
	 
		
			xhr_object.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
			xhr_object.send(data);
}


function changeContenuBigOne(page,parametres) {
		
		afficheDIV('bigone');
	
		var xhr_object = null;
		
		if(window.XMLHttpRequest) // Firefox
			xhr_object = new XMLHttpRequest();
		else if(window.ActiveXObject) // Internet Explorer
			xhr_object = new ActiveXObject("Microsoft.XMLHTTP");
		else { // XMLHttpRequest non supporté par le navigateur
			alert("Votre navigateur ne supporte pas les objets XMLHTTPRequest...");
		return;
		}		
		
		if(parametres) { data = parametres; }
		else { data = ""; }
		

		filename = "ajax_"+page+".php";
		
			xhr_object.open("POST", filename, true);
			xhr_object.onreadystatechange = function() {   
				if(xhr_object.readyState == 4) {
					
					var d = document.getElementById("contenubigone");
					d.innerHTML =xhr_object.responseText;

	   
				}
			}  
			xhr_object.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
			xhr_object.send(data);
}


function intro(mondiv) {
    afficheDIV('fond'); 
    afficheDIV(mondiv);
    var d = document.getElementById(mondiv);
    var L = document.body.clientWidth;
    var H = document.body.clientHeight;
    var l=d.style.width;
    var h=d.style.height;
    splitString = l.split("px");
    l = splitString[0];
    splitString = h.split("px");
    h= splitString[0]; 
    M = L-l;
    P = H-h;
    d.style.left = M-(M/2)+"px";
    d.style.top = P-(P/2)+"px";
}

function fermeintro(mondiv) {
    cacheDIV('fond'); 
    cacheDIV(mondiv);
} 

function live() {
    window.open('live.php','TVRadio','top=50,left=50,screenx=50,screeny=50,scrollbars=no,width=245,height=275');
    
}