/**
 * Open an image in a new window (no menu, no statusbar, ...)
 * Please not that the window is sized based on imgw and imgh, so
 * size must be provided in function call!
 * @imgurl
 *    URL to image to load
 * @imgtitle
 *    Title for new window
 * @imgw
 *    Width for image
 * @imgh
 *    Height for image
 */
function OpenPicWindow(imgurl, imgtitle, imgw, imgh) {
	var openPicWindow = null;
	// javascript:MM_openBrWindow('images/stnicolas/stnico4L.gif','St Nicolas au club','width=600,height=405')
	properties = "toolbar=no,location=no,directories=no,status=no,scrollbars=no,resizable=no,copyhistory=no,menubar=no";
	openPicWindow = window.open('image.php?image='+imgurl+'&width='+imgw+'&height='+imgh+'&title='+imgtitle,'', "width="+imgw+", height="+imgh+", "+properties);
	openPicWindow.focus();
}

// Open in a new window...
function MM_openBrWindow(url, imgtitle, features) {
  var openBrWindow = null;
  if (url.indexOf("http://") ==-1) {
	properties = "toolbar=no,location=no,directories=no,status=no,scrollbars=no,resizable=no,copyhistory=no,menubar=no";
	openBrWindow = window.open('about:blank','',features + ", "+properties);
	openBrWindow.document.open();
	openBrWindow.document.write('<html><head><title>'+imgtitle+'</title></head>');
	openBrWindow.document.write('<body topmargin="0" leftmargin="0" marginwidth="0" marginheight="0">');
	openBrWindow.document.write('<a href="JavaScript:self.close()" title="Cliquer sur l\'image pour fermer la fen&ecirc;tre."><img src="'+url+'" hspace="0" vspace="0" border="0" /></a>');
	openBrWindow.document.write('</body></html>');
	openBrWindow.document.close();
	openBrWindow.focus();
  } else {
	properties = "toolbar=no,location=no,directories=no,status=no,scrollbars=no,resizable=yes,copyhistory=no,menubar=no";
	var winStr = url;
	winStr=winStr+"XXX"+bildunterschrift;
	while (winStr.search(/\//)!=-1) {
	  winStr=winStr.replace(/\//,"ZZZ");
	  }
	while (winStr.search(/\-/)!=-1) {
	  winStr=winStr.replace(/\-/,"MMM");
	  }
	while (winStr.search(/\./)!=-1) {
	  winStr=winStr.replace(/\./,"PPP");
	  }
	while (winStr.search(/\:/)!=-1) {
	  winStr=winStr.replace(/\:/,"DDD");
	  }
	openBrWindow = window.open('about:blank',winStr,features + ", "+properties);
	openBrWindow.focus();
  }
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.0
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && document.getElementById) x=document.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function LycosHit() {
	domain = document.URL.substring(7,document.URL.indexOf('/',8));

	if (domain == "members.lycos.co.uk")
		tld = "co.uk";
	else
		tld = domain.substring(domain.lastIndexOf('.')+1);

	main = ".lycos.";

	if (tld == "fr")
		site = "multimania";
	else if (tld == "net") {
		site = "pagesperso.accesinternet";
		main = ".laposte.";
	} else {
		site = "tripod";
		if (tld == "se")
			main = ".spray.";
		if (tld == "dk")
			main = ".jubii.";
	}

	url = 'hit.' + site + main + tld;

	var res;
	if (window.screen)
		res = screen.width + 'x' + screen.height + 'x' + screen.colorDepth;
	else
		res = '';

	var ord	= new Date();
	if (main == ".laposte.") {
	//	var tag = '<a class="lycoshit" hrefF="http://' + site + main + tld + '/build/stats/" target="_blank">' + '<img src="http://' + url + '/hit/?ord=' + ord.getTime() + '&res=' + res + '" border="0" width="85" height="30" /></a>';
		var tag = '<img style="position: absolute; left: 1px; top: 1px; " src="http://' + url + '/hit/?ord=' + ord.getTime() + '&res=' + res + '" border="0" width="0" height="0" />';
	} else {
		var tag = '<img style="position: absolute; left: 1px; top: 1px; " src="http://' + url + '/hit/?ord=' + ord.getTime() + '&res=' + res + '" border="0" width="0" height="0" />';
	}

	document.write(tag);
}

function SimpleHit(page) {
	var res;
	if (window.screen)
		res = screen.width + 'x' + screen.height + 'x' + screen.colorDepth;
	else
		res = '';
	siz = document.width + 'x' + document.height;

	var ord	= new Date();
	var tag = '<img style="position: absolute; left: 1px; top: 1px; " src="hitlog.php?ord=' + ord.getTime() + '&res=' + res + '&siz=' + siz + '&page=' + page + '" border="0" />';
	document.write(tag);
}

function ToggleVisibility(id) {
	if(document.getElementById) {
		if (document.getElementById('div'+id).style.display == "none") {
			document.getElementById('div'+id).style.display = "block";
			document.getElementById('a'+id).firstChild.data = "Masquer les détails";
		} else {
			document.getElementById('div'+id).style.display = "none";
			document.getElementById('a'+id).firstChild.data = "Afficher les détails";
		}
	}
}

function ShowInfo(id) {
	if(document.getElementById) {
		document.getElementById('info_'+id).style.display = "block";
	}
}

function HideInfo(id) {
	if(document.getElementById) {
		document.getElementById('info_'+id).style.display = "none";
	}
}

function ToggleMenu(id, vid) {
	if (id == vid) {
		document.getElementById('m_'+id).style.display = "block";
		document.getElementById('a_'+id).setAttribute("class", "menu-v");
	} else {
		document.getElementById('m_'+id).style.display = "none";
		document.getElementById('a_'+id).setAttribute("class", "menu-h");
	}
}
function ShowMenu(id) {
	if (document.getElementById) {
		ToggleMenu('club', id);
		ToggleMenu('judo', id);
		ToggleMenu('self', id);
		ToggleMenu('stage', id);
		ToggleMenu('www', id);
		ToggleMenu('liens', id);
		ToggleMenu('cours', id);
	}
}

function killFrames() {
	if (top != self)
		top.location = self.location;
}
