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;
window.onload=startList;	

function startList() {
	if (document.getElementById) {
		debug=document.getElementById("debug");
		navRoot = document.getElementById("page");
		node = navRoot;//getnextnode(navRoot);
		maxi=1500;
		
		while (node && maxi>0) {
			maxi--;
			node = getnextnode(navRoot,node);
			if (node) {
				if (node.className=="droite") {
					node.style.height=node.parentNode.offsetHeight+"px";
					//node.style.left=(node.parentNode.offsetLeft+node.parentNode.offsetWidth-2)+"px";
					node.style.left=node.parentNode.offsetWidth+position(node.parentNode,0)-2+"px";
					node.style.display="block";
				}
				if (node.className=="bas") {
					node.style.width=(node.parentNode.offsetWidth)+"px";
					//node.style.top=(node.parentNode.offsetHeight+node.parentNode.offsetTop-2)+"px";
					node.style.top=node.parentNode.offsetHeight+position(node.parentNode,1)-2+"px";
					//node.style.left=(node.parentNode.offsetLeft)+"px";
					node.style.left=position(node.parentNode,0)+"px";
					node.style.display="block";
				}
				if (node.className=="bbas") {
					node.style.width=(node.parentNode.offsetWidth)+"px";
					node.style.top=node.parentNode.offsetHeight-2+"px";
					node.style.left="0px";
					node.style.display="block";
				}
				if (node.className=="haut") {
					node.style.width=(node.parentNode.offsetWidth)+"px";
					//node.style.top=(node.parentNode.offsetTop-2)+"px";
					node.style.top=position(node.parentNode,1)-2+"px";
					//node.style.left=(node.parentNode.offsetLeft)+"px";
					node.style.left=position(node.parentNode,0)+"px";
					node.style.display="block";
					
				}
				if (node.className=="hhaut") {
					node.style.width=(node.parentNode.offsetWidth)+"px";
					node.style.top=node.parentNode.offsetTop-2+"px";
					node.style.left="0px";
					node.style.display="block";
					
				}
				if (node.className=="gauche") {
					node.style.height=node.parentNode.offsetHeight+"px";
					//node.style.left=(node.parentNode.offsetLeft-2)+"px";
					node.style.left=position(node.parentNode,0)-2+"px";
					node.style.display="block";
				}
			}
		}
	}
}

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,scrollbars=yes,menubar=no," ;
	stats += "resizable=yes,width=" + wi + ",height="+hi ;
	imgwin = window.open ("",titre,stats);
	window.setTimeout("makepage(picto,legendetex)",100) ;
}

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();
}

var okmenu=false;
function affmenu() {
	if (document.getElementById) {
		okmenu=true;
		document.getElementById("menfamille").style.display="block";
		document.getElementById("menfamille").style.left=position(document.getElementById("reffamille"),0)+3+"px";
		document.getElementById("menfamille").style.top=position(document.getElementById("reffamille"),1)+18+"px";
	}
}
function hidemenu() {
	okmenu=false;
	window.setTimeout("disparait();",1000);
}
function disparait() {
	if (!okmenu) {
		if (document.getElementById) {
			document.getElementById("menfamille").style.display="none";
		}
	}
}	

function fermer_jeu() {
	bloc = document.getElementById("flashjeu");
	le_wrapper = document.getElementById("wrapper1");		
	if (bloc) bloc.style.display='none';
	if (le_wrapper) le_wrapper.style.display='none';	
}

function send_mail(personne, domaine, tld) {
	ret = personne+'@'+domaine+'.'+tld;
	return location.href='mailto:'+ret;
}