var win="";
function opennamewin(u, n, w, h) {
	if (win!="") {if (! win.closed) { win.close();}}
	stats="toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no," ;
	stats += "resizable=no,width="+w+",height="+h+",left=0,top=0";
	win= window.open (u,n,stats);
	win.focus();
}

function popup(obj)
{
	if (obj != null)	opennamewin(obj.href, obj.target, 532, 640);
}

var debug=false;

function getnextnode(source,o) {
	if (!o) return false;
	oo=false;
	if (o.firstChild) return o.firstChild;
	if (o.nextSibling) return o.nextSibling;
	o=o.parentNode;
	while (!oo && o && (o!=source)) {
		oo=o.nextSibling;
		o=o.parentNode;
	}
	return oo;
}

function position(o,s) {
	l=0;
	t=0;
	while (o) {
		l+=o.offsetLeft;
		t+=o.offsetTop;
		o=o.offsetParent;
		if (o.id=="page") o=false;
	}
	r=(s==0) ? l:t;
	return r;
}


picto="";
function zoom(picture,legende){
	picto = picture;
	wi=100;
	hi=100;
	titre="Zoom";
	legendetex=legende;
	stats="toolbar=no,location=no,directories=no,status=no,menubar=no," ;
	stats += "resizable=yes,width=" + wi + ",height="+hi ;
	imgwin = window.open ("",titre,stats);
	window.setTimeout("makepage(picto,legendetex)",100) ;
	return false;
}

function makepage(pic,legendetexx)
{
	legendetexxx=legendetexx;
	if (legendetexxx=="") espace=0;
	else espace=85;

	imgwin.document.clear();
	imgwin.document.write("<head><title>Croustipate</title>");
	imgwin.document.write("<s"+"cript language='Java"+"Script'>function resizeme(){picheight=document.images['posterpic'].height;picwidth=document.images['posterpic'].width;this.window.resizeTo(picwidth+40,picheight+60+"+espace+");}<"+"/s"+"cript>");
	imgwin.document.write("</head><body style='background-color:#c12634' onload='window.setTimeout(\"resizeme();\",100);' ondblclick='window.close();'><center><table><tr><td>");
	imgwin.document.write("<img name='posterpic' align='absmiddle' src='"+pic+"' border='0' alt=''>");
	imgwin.document.write("</td></tr>");

	if (espace>0)
	{
		imgwin.document.write("<tr><td><center><font face='Verdana,sans-serif' size=2>"+legendetexxx+"<font size=1><br>Double clic sur la fenêtre pour fermer</font></font></center></td></tr></table></center></body>");
	}

	imgwin.document.close();
	imgwin.focus();
}

window.onload=startList;
function startList() {
	if (document.all&&document.getElementById) {
		navRoot = document.getElementById("menu");
		node = navRoot;//getnextnode(navRoot);
		while (node) {
			node = getnextnode(navRoot,node);
			if (node) {
				if (node.nodeName=="LI") {
					node.onmouseover=function() {
						this.className+=" menuover";
					}
					node.onmouseout=function() {
						this.className=this.className.replace(" menuover", "");
					}
				}
			}
		}
	}
}

function getnextnode(source,o) {
	if (!o) return false;
	oo=false;
	if (o.firstChild) return o.firstChild;
	if (o.nextSibling) return o.nextSibling;
	o=o.parentNode;
	while (!oo && o && (o!=source)) {
		oo=o.nextSibling;
		o=o.parentNode;
	}
	return oo;
}

function hide_col_droite(id_section)
{
	bloc = "bloc_actu";
	if (id_section == '38') bloc = "bloc_en_cours";
	if (id_section == '39') bloc = "bloc_presse";
	
	
	if (bloc == "bloc_en_cours" || bloc == "bloc_actu" || bloc == "bloc_presse")
	{
		if (document.getElementById)
		{
			obj = document.getElementById(bloc);
			if (obj)
			{
				obj.style.display="none";
			}
			
		}
	}
}

var sommaire_retour="<div class=\"haut\" ><a href=\"#haut\"><img src=\"/images/haut.gif\" alt=\"haut de la page\" title=\"haut de la page\" /></a></div>";

function sommaire(n,typ) {
	if (! n) return false;
	if (!typ) typ="H1";
	if (document.getElementById) {
		navRoot = document.getElementById(n);
		if (!navRoot) return false;
		navRootSom = document.getElementById(n+"_sommaire");
		if (!navRootSom) return false;
		node = navRoot;//getnextnode(navRoot);
		sommaire="";
		nsommaire=0;
		while (node) {
			node = getnextnode(navRoot,node);
			if (node) {
				if (node.className==typ || node.nodeName==typ) {
					nsommaire++;
					le_lien=n+"_sommaire_"+nsommaire;
					
					sommaire+="<li><a href=\"#"+le_lien+"\">"+node.innerHTML+"</a></li>\n";
					if (nsommaire==1) node.innerHTML="<a name=\""+le_lien+"\"></a>"+node.innerHTML;
					else node.innerHTML=sommaire_retour+"<a name=\""+le_lien+"\"></a>"+node.innerHTML;
				}
			}
		}
		if (sommaire!="") {
			sommaire="<ul>\n"+sommaire+"</ul>";
			navRootSom.innerHTML+=sommaire;
			navRootSom.style.display="block";
			//navRoot.innerHTML+=sommaire_retour;
		}
	}

}
