function createOverlay(lnk,ttl) {
	if(!document.getElementById("ol")) {
		lnk=typeof(lnk)=='string'?lnk:""; var w, h, os = 34;
		var isIE=window.navigator.systemLanguage?true:false;
		var obj=document.getElementsByTagName("body")[0];
		var pg=document.createElement('div'); pg.id="ol";
    	if(isIE) {/* pg.style.filter="alpha(opacity:100)"; */
		}else {pg.style.opacity=0;} 
		obj.appendChild(pg);
		pg.innerHTML = '<div id="fd"><\/div>'
		+ '<table id="tb" class="ol" width="100%" height="100%" cellspacing="0" cellpadding="0" border="0"><tbody>'
		+ '<tr><td width="'+os+'" height="'+os+'" class="ol_lt" id="ol_lt"><\/td><td height="'+os+'" class="ol_t"><\/td><td width="'+os+'" height="'+os+'" class="ol_rt"><\/td><\/tr>'
		+ '<tr><td width="'+os+'" class="ol_l"><\/td><td id="ol_ct" class="ol_ct" height="100%"><iframe src="" id="ol_if" name="ol_if" hspace="0" vspace="0" frameborder="0" scrolling="auto" height="100%" width="100%"><\/iframe><\/td><td width="'+os+'" class="ol_r"><\/td><\/tr>'
		+ '<tr><td width="'+os+'" height="'+os+'" class="ol_lb"><\/td><td height="'+os+'" class="ol_b"><\/td><td width="'+os+'" height="'+os+'" class="ol_rb"><\/td><\/tr>'
		+ '<\/tbody><\/table><div id="cl" title="Fermer" onClick="dumpOverlay();" onmouseover="dumpOver();" onmouseout="dumpOut();"><\/div>'
		+ '<div id="tx"><div id="tl"><a class="ex" href="'+lnk+'" target="_blank" title="Open page in new window">'+ttl+'<\/a><\/div><\/div>';	 
		if(isIE) {
			document.documentElement.scrollTop = 0; w = document.documentElement.clientWidth; h = document.documentElement.clientHeight; 
			if(w<=0||h<=0){document.body.scrollTop = 0; w = obj.clientWidth; h = obj.clientHeight;}
			if(w>0&&h>0){
				pg.style.width=w+'px'; pg.style.height=h+'px'; obj=document.getElementById("fd");
				obj.style.width=w+'px'; obj.style.height=h+'px'; obj=document.getElementById("ol_ct");
				obj.style.width=(w-os-os)+'px'; obj.style.height=(h-os-os)+'px';
			}
		}else {document.getElementById("cl").className = "ol_cl"; }
  		if(!isIE) {
  			fadeOverlay(pg.id,"ol_if",0,isIE,lnk);
  		}else {
			document.getElementById("ol_if").src = lnk;
  		}
	}
}
function dumpOverlay() {
	if(document.getElementById("ol")) {document.body.removeChild(document.getElementById('ol'));}
	//if(window.opera) {document.body.parentNode.style.backgroundColor='transparent';}	
}
function dumpOver() {
	var obj=document.getElementById("ol_lt"); if(obj.className=="ol_lt") {obj.className = "ol_cl";}
}
function dumpOut() {
	if(document.getElementById("ol")) {var obj=document.getElementById("ol_lt"); if(obj.className=="ol_cl") {obj.className = "ol_lt";}}
}
function fadeOverlay(id,fr,opac,isIE,lnk) {
	var obj=document.getElementById(id);
	var ifr=document.getElementById(fr);
    if(opac<=100) {
    	if(isIE) {obj.style.filter="alpha(opacity:"+opac+")";
    	ifr.style.filter="alpha(opacity:"+opac+")";
		}else {obj.style.opacity=opac/100;} opac+=20;
		window.setTimeout("fadeOverlay('"+id+"','"+fr+"',"+opac+","+isIE+",'"+lnk+"')",50);
	}else {document.getElementById("ol_if").src = lnk;}
}
function getOverlays(className) {
	var children = document.getElementsByTagName('a'); 
	var elements = new Array(); var i, j, child, classNames;
	for(i=0;i<children.length;i++) {
		child=children[i];
		classNames=child.className.split(' ');
		for(j=0;j<classNames.length;j++) {
			if(classNames[j]==className) {
				elements.push(child);
				break;
			}
		}
	}
	return elements;
}
function initOverlays(className) {
	var i, tmp, txt, url, lnk = getOverlays(className);
	var isIE = window.navigator.systemLanguage?true:false;
	for (i=0;i<lnk.length;i++) {
		url = lnk[i].getAttribute('href'); 
		tmp = lnk[i].innerHTML;
		tmp = tmp.replace(/(<([^>]+)>)/ig,"");
		txt = tmp||lnk[i].title||lnk[i].href;
		if(isIE) {
			lnk[i].onclick = new Function('createOverlay("'+url+'","'+txt+'");return false;');
		}else {
			lnk[i].setAttribute("onClick","createOverlay('"+url+"','"+txt+"');return false;");
		}
	}
}

var overlayOnload = window.onload;
window.onload = function () { if(overlayOnload) overlayOnload(); initOverlays('overlay'); }