function Popup50ans() {
  window.open("/50ans/accueil.php", "SGR", "toolbar=no,scrollbars=yes,location=no,directories=no,menubar=no,width=820,height=520,resizable=yes");
}

function popupJTS() {
  win = window.open("http://mediaserver.rtbf.be/sites/rtbf-media/themes/rtbfmedia/iPlayer/MediaPlayer.php", 'RTBF', "width=840,height=550,scrollbars=yes,location=no,directories=no,status=RTBF,menubar=no,toolbar=no,resizable=no");
  win.focus();
}

function PopupImage(url, w, h, label, ph) {
  var Ww=w+26;
  var Wh=ph+30;
  var d="<html><head><title>"+label+"</title></head><body onLoad='focus();' style='margin:0;background-color:#DE0021;'><div align='center' style='padding-top: 3px;'>";
  d=d+"<a href='javascript:close();' style='font-family:Arial;font-size:10pt;color:white;'><img src='"+url+"' width='"+w+"' height='"+h+"' alt=\""+label+"\" title=\""+label+"\" style='border:2px white solid;'><br>Cliquez pour fermer</a>";
  d=d+"</div></body></html>";

  var photoWin=window.open('', 'Photo', 'toolbar=no,scrollbars=yes,location=no,directories=no,menubar=no,width='+Ww+',height='+Wh+',resizable');
  photoWin.document.open();
  photoWin.document.write(d);
  photoWin.document.close();
  photoWin.focus();
}


function setCookie(name, value, expires, path, domain, secure) {

document.cookie = name + "=" + escape(value) + 
 ((expires == null) ? "" : "; expires=" + expires.toGMTString()) +
 ((path == null) ? "" : "; path=" + path) +
 ((domain == null) ? "" : "; domain=" + domain) +
 ((secure == null) ? "" : "; secure");
 
 //alert("cookie mis comme "+document.cookie);
}

 // detection d'un cookie
function getCookieVal(offset) {
var endstr = document.cookie.indexOf(";",offset);
if (endstr == -1) 
endstr = document.cookie.length;
//alert("je trouve: "+unescape(document.cookie.substring(offset,endstr)));
return unescape(document.cookie.substring(offset,endstr));
}

function getCookie(name) {
var arg = name + "=";
var alen = arg.length;
var clen = document.cookie.length;
var i = 0;
while (i<clen) {
 var j = i + alen;
 if (document.cookie.substring(i,j) == arg) {
  //alert("oui"+j);
return getCookieVal(j);
   }
 i = document.cookie.indexOf(" ",i) + 1;
 if (i ==0) break;
}
return null;
}

var popupWin=null;

function fenetre(url, name,width,height) {
popupWin = window.open(url, name,width,height);
}

function Navigue1()  {
 oualler1= document.leform1.selectmenu.options
[document.leform1.selectmenu.selectedIndex].value;

window.location.href = oualler1;
}

var isDHTML = 0;
var isID = 0;
var isAll = 0;
var isLayers = 0;

if (document.getElementById) {isID = 1; isDHTML = 1;}
else {
if (document.all) {isAll = 1; isDHTML = 1;}
else {
browserVersion = parseInt(navigator.appVersion);
if ((navigator.appName.indexOf('Netscape') != -1) && (browserVersion == 4)) {isLayers = 1; isDHTML = 1;}
}}

function findDOM(objectID,withStyle) {
	if (withStyle == 1) {
		if (isID) { return (document.getElementById(objectID).style) ; }
		else { 
			if (isAll) { return (document.all[objectID].style); }
		else {
			if (isLayers) { return (document.layers[objectID]); }
		};}
	}
	else {
		if (isID) { return (document.getElementById(objectID)) ; }
		else { 
			if (isAll) { return (document.all[objectID]); }
		else {
			if (isLayers) { return (document.layers[objectID]); }
		};}
	}
}


function withStyle() {
if (window.innerWidth != null)
return window.innerWidth;
if (document.body.clientWidth != null) {
return document.body.clientWidth;
}
return(null);
}

function popUp(evt,objectID){
if (xDHTML) {
var largPage = withStyle();
domStyle=findDOM(objectID,1);
dom=findDOM(objectID,0);
etat=domStyle.visibility;
if (dom.offsetWidth)
largElem=dom.offsetWidth;
else {
if (dom.clip.width)
largElem=dom.clip.width;
}
if (etat=="visible"||etat=="show") {
domStyle.visibility="hidden";
}
else {
if (evt.pageY) {
//NS
topVal=evt.pageY-115;
valGche=evt.pageX-(largElem/2);
}
else {
if (evt.y) {
//IE
topVal=evt.y-115+document.body.scrollTop;
valGche=evt.x-(largElem/2)+document.body.scrollLeft;
}
}
if (valGche<2) {
valGche=2;
}
else {
if ((valGche+largElem)>largPage) {
valGche=valGche-(largElem/2);
}
}
domStyle.top=topVal;
domStyle.left=valGche;
domStyle.visibility="visible";
}
}
}

///Les menus
var menuTop = 45;
var menuLeft = 400;

var domSMenu = null;
var oldDomSMenu = null;
var t = 0;
var lDelay = 3;
var lCount = 0;
var pause = 100;

function popMenu(menuNum){
	if (isDHTML) {
///// Place la visibilité du menu précédent sur hidden
		t = 2;
		if (oldDomSMenu) {
			oldDomSMenu.visibility = 'hidden'; 
			oldDomSMenu.zIndex = '0'; 
			t = 2; 
			lCount = 0;
		}

///// Définit les DOM des objets menu

		var idMenu = 'menuHead';
		var domMenu = findDOM(idMenu,0);

		var idMenuOpt = 'menuHead' + menuNum;
		var domMenuOpt = findDOM(idMenuOpt,0);		

		var idSMenu = 'menu' + menuNum;
		var domSMenu = findDOM(idSMenu,1);

///// Définit les positions des sous-menus
	
		if (isID || isAll) { 	
				var menuLeft = (domMenu.offsetLeft) + (domMenu.offsetLeft) + 137;
				var menuTop = (domMenuOpt.offsetTop)+ 90;

			}
			
			if (isLayers) {
						var menuLeft = document.layers[idMenu].layers[idMenuOpt].pageX +137;
				var menuTop = domMenu.pageY + 110;
		}
		
		/*if (isLayers) {
						var menuLeft = document.layers[idMenu].layers[idMenuOpt].pageX - 5;
				var menuTop = domMenu.pageY + domMenu.clip.height - 5;
		}*/

///// Positionne et affiche le menu
		if (oldDomSMenu != domSMenu) {	
			domSMenu.left = menuLeft; 
			domSMenu.top = menuTop
			domSMenu.visibility = 'visible';
			domSMenu.zIndex = '100';
			oldDomSMenu = domSMenu;
		}

///// Réinitialise oldDom s'il est identique au DOM en cours
		else { oldDomSMenu = null; }
	}

////// Retourne une valeur 'null' pour les navigateurs non-DHTML
	else { return null; }
}

function delayHide() {
///// Vérifie si un menu est affiché et si la variable global 't'
///// a pris la valeur 0
    if ((oldDomSMenu) && (t == 0)) {

///// Masque l'ancien menu, réinitialise les conditions de menu, 
///// et arrête d'exécution de la fonction
        oldDomSMenu.visibility = 'hidden'; 
        oldDomSMenu.zIndex = '0';
        oldDomSMenu = null;
        lCount = 0; 
        return false;
    }

///// Interrompt la fonction si un autre menu est ouvert
    if (t == 2) { lCount = 0; return false; }

///// Répète la fonction en ajoutant chaque fois 1 à lCount, jusqu'à ce que
///// lCount soit égal à lDelay puis définit 't' sur 0 pour que le menu
///// soit masqué lorsqu'elle s'exécute à nouveau
    if (t == 1) { 
        lCount = lCount + 1;
        if (lDelay <= lCount) { t = 0; }
        if (lDelay >= lCount) { setTimeout('delayHide(' + t + ')',pause); }
    }
}
