function show (rowID) { 
	var tr = document.getElementById ('tr' + rowID); 
	if (tr.className == "hide") { 
		tr.className = "show"; 
		//document.images['img'+rowID].src = "images/design/menu_niveau_un_open.jpg"; 
	} else { 
		tr.className = "hide"; 
		//document.images['img'+rowID].src = "images/design/menu_niveau_un.jpg"; 
	} 
}

function ChangeImage (unBouton, uneImage) {
	document[unBouton].src = uneImage;
}

function fermerFenetre () {
	window.opener.location.href = "pages.php";
	this.close();
}

function supprimerQuoi (quoi, id) {
	var supprimerPopup;
	supprimerPopup = window.open ("supprimer.php?quoi="+quoi+"&id="+id+"", "PopUp", "height=300,width=550,menubar=no,scrollbars=no,alwaysRaised=yes,dependent=yes,resizable=no,status=no,screenX=20,screenY=20,innerHeight=0,innerWidth=0,outerHeight=0,outerWidth=0");
	supprimerPopup.focus();	
}

function ajouterMenu () {
	var ajouterMenu;
	ajouterMenu = window.open ("ajouter_menu.php", "PopUp", "height=300,width=550,menubar=no,scrollbars=no,alwaysRaised=yes,dependent=yes,resizable=no,status=no,screenX=20,screenY=20,innerHeight=0,innerWidth=0,outerHeight=0,outerWidth=0");
	ajouterMenu.focus();	
}

function ajouterRubrique () {
	var ajouterRubrique;
	ajouterRubrique = window.open ("ajouter_rubrique.php", "PopUp", "height=300,width=550,menubar=no,scrollbars=no,alwaysRaised=yes,dependent=yes,resizable=no,status=no,screenX=20,screenY=20,innerHeight=0,innerWidth=0,outerHeight=0,outerWidth=0");
	ajouterRubrique.focus();	
}

function ajouterSection () {
	var ajouterSection;
	ajouterSection = window.open ("ajouter_section.php", "PopUp", "height=350,width=550,menubar=no,scrollbars=no,alwaysRaised=yes,dependent=yes,resizable=no,status=no,screenX=20,screenY=20,innerHeight=0,innerWidth=0,outerHeight=0,outerWidth=0");
	ajouterSection.focus();	
}

function ajouterTeaser () {
	var ajouterTeaser;
	ajouterTeaser = window.open ("ajouter_teaser.php", "PopUp", "height=350,width=550,menubar=no,scrollbars=yes,alwaysRaised=yes,dependent=yes,resizable=no,status=no,screenX=20,screenY=20,innerHeight=0,innerWidth=0,outerHeight=0,outerWidth=0");
	ajouterTeaser.focus();	
}

function ajouterPage () {
	var ajouterPage;
	ajouterPage = window.open ("ajouter_page.php", "PopUp", "height=350,width=550,menubar=no,scrollbars=yes,alwaysRaised=yes,dependent=yes,resizable=no,status=no,screenX=20,screenY=20,innerHeight=0,innerWidth=0,outerHeight=0,outerWidth=0");
	ajouterPage.focus();	
}

function ajouterVariable () {
	var ajouterVariable;
	ajouterVariable = window.open ("ajouter_variable.php", "PopUpVariable", "height=350,width=550,menubar=no,scrollbars=yes,alwaysRaised=yes,dependent=yes,resizable=no,status=no,screenX=20,screenY=20,innerHeight=0,innerWidth=0,outerHeight=0,outerWidth=0");
	ajouterVariable.focus();	
}

function contenuTeaser (id, language) {
	var largeurEcran = screen.availWidth;
	var hauteurEcran = screen.availHeight;
	var ajouterTeaser;
	ajouterTeaser = window.open ("teaser_contenu.php?IDTeaser=" + id +"&language=" + language +"", "PopUp", "height=500,width=700,menubar=no,scrollbars=yes,alwaysRaised=yes,dependent=yes,resizable=no,status=no,screenX=10,screenY=10,innerHeight=0,innerWidth=0,outerHeight=0,outerWidth=0");
	ajouterTeaser.focus();	
}

function contenuPage (id, language) {
	var largeurEcran = screen.availWidth;
	var hauteurEcran = screen.availHeight;
	var ajouterPage;
	ajouterPage = window.open ("pages_contenu.php?IDPage=" + id +"&language=" + language +"", "PopUp", "height=500,width=700,menubar=no,scrollbars=yes,alwaysRaised=yes,dependent=yes,resizable=no,status=no,screenX=10,screenY=10,innerHeight=0,innerWidth=0,outerHeight=0,outerWidth=0");
	ajouterPage.focus();	
}

function ChangerRubriques () {
	xmlhttp.open ('POST', "changer_rubriques.php", false);
	var IDSection = document.forms["AjouterPage"].IDSection.value;
   	xmlhttp.setRequestHeader ('Content-Type','application/x-www-form-urlencoded');
	xmlhttp.send("IDSection= " + IDSection + "");
	document.getElementById('DIVRubriques').innerHTML = xmlhttp.responseText;
}

function getSection () {

	var IDRubrique = document.AjouterPage.IDRubrique.options[document.AjouterPage.IDRubrique.selectedIndex].value;
	xmlhttp.open ('GET', "get_section_by_rubrique.php?IDRubrique=" + IDRubrique + "", true);
   	xmlhttp.setRequestHeader ('Content-Type','application/x-www-form-urlencoded');

	if (xmlhttp) {				
		xmlhttp.onreadystatechange = function() {
			if (xmlhttp.readyState == 4) { /* 4 : état "complete" */		
				if (xmlhttp.status == 200) { /* 200 : code HTTP pour OK */							 
					document.getElementById ('getSectionByRubrique').innerHTML = xmlhttp.responseText;
				}
			}
		}
	} 

	xmlhttp.send (null);	
}

function MM_CheckFlashVersion(reqVerStr,msg){
  with(navigator){
    var isIE  = (appVersion.indexOf("MSIE") != -1 && userAgent.indexOf("Opera") == -1);
    var isWin = (appVersion.toLowerCase().indexOf("win") != -1);
    if (!isIE || !isWin){  
      var flashVer = -1;
      if (plugins && plugins.length > 0){
        var desc = plugins["Shockwave Flash"] ? plugins["Shockwave Flash"].description : "";
        desc = plugins["Shockwave Flash 2.0"] ? plugins["Shockwave Flash 2.0"].description : desc;
        if (desc == "") flashVer = -1;
        else{
          var descArr = desc.split(" ");
          var tempArrMajor = descArr[2].split(".");
          var verMajor = tempArrMajor[0];
          var tempArrMinor = (descArr[3] != "") ? descArr[3].split("r") : descArr[4].split("r");
          var verMinor = (tempArrMinor[1] > 0) ? tempArrMinor[1] : 0;
          flashVer =  parseFloat(verMajor + "." + verMinor);
        }
      }
      // WebTV has Flash Player 4 or lower -- too low for video
      else if (userAgent.toLowerCase().indexOf("webtv") != -1) flashVer = 4.0;

      var verArr = reqVerStr.split(",");
      var reqVer = parseFloat(verArr[0] + "." + verArr[2]);
  
      if (flashVer < reqVer){
        if (confirm(msg))
          window.location = "http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash";
      }
    }
  } 
}

function ouvrirPopup (url, width) {
	var popup;
	popup = window.open(url, "popup", "height=800,width=" + width + ",menubar=no,scrollbars=no,alwaysRaised=yes,dependent=yes,resizable=no,status=no,screenX=20,screenY=20,innerHeight=0,innerWidth=0,outerHeight=0,outerWidth=0");
	popup.focus();		
}

var xmlhttp = false;

/* Compilation conditionnelle d'IE */
/*@cc_on
@if (@_jscript_version >= 5)
	try {
		xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
 	}
 	catch (e) {
		try {
	   		xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
		}
		catch (E) {
	   		xmlhttp = false;
		}
 	}
@else
	xmlhttp = false;
@end @*/

/* on essaie de créer l'objet si ce n'est pas déjà fait */
if (!xmlhttp && typeof XMLHttpRequest != 'undefined') {
	try {
		xmlhttp = new XMLHttpRequest();
 	}
 	catch (e) {
		xmlhttp = false;
 	}
}

function getNextPosition () {

	var IDRubrique = document.AjouterRubrique.IDRubrique.options[document.AjouterRubrique.IDRubrique.selectedIndex].value;
	xmlhttp.open ('GET', "get_next_position.php?IDRubrique=" + IDRubrique + "", false);
   	xmlhttp.setRequestHeader ('Content-Type','application/x-www-form-urlencoded');
	
	if (xmlhttp) {		
		xmlhttp.onreadystatechange = function() {
			if (xmlhttp.readyState == 4) { /* 4 : état "complete" */		
				if (xmlhttp.status == 200) { /* 200 : code HTTP pour OK */		 
					document.getElementById ('SPANNextPosition').innerHTML = xmlhttp.responseText;
				}
			}
		}
	} 

	xmlhttp.send (null);
	
}