/* ================================================================ 
This copyright notice must be untouched at all times.

The original version of this javascript and the associated (x)html
is available at http://www.stunicholls.com/gallery/multi-page.html
Copyright (c) 2005-2007 Stu Nicholls. All rights reserved.
This javascript and the associated (x)html may be modified in any 
way to fit your requirements.
=================================================================== */

clickMenu = function(menu) {
	var getEls = document.getElementById(menu).getElementsByTagName("LI");
	var getAgn = getEls;

	for (var i=0; i<getEls.length; i++) {
			getEls[i].onclick=function() {
				for (var x=0; x<getAgn.length; x++) {
				getAgn[x].className=getAgn[x].className.replace("unclick", "");
				getAgn[x].className=getAgn[x].className.replace("click", "unclick");
				}
			if ((this.className.indexOf('unclick'))!=-1) {
				this.className=this.className.replace("unclick", "");;
				}
				else {
				this.className+=" click";
				}
			}
			getEls[i].onmouseover=function() {
				this.className+=" hover";
			}
			getEls[i].onmouseout=function() {
				this.className=this.className.replace("hover", "");
			}
		}
		clickGallery('gallery');
	}

clickGallery = function(menu) {
	var getEls = document.getElementById(menu).getElementsByTagName("LI");
	var getAgn = getEls;

	for (var i=0; i<getEls.length; i++) {
			getEls[i].onclick=function() {
				for (var x=0; x<getAgn.length; x++) {
				getAgn[x].className=getAgn[x].className.replace("galleryon", "");
				}
				this.className+=" galleryon";
			if ((this.className.indexOf('sub'))!=-1) {
				if ((this.className.indexOf('page'))!=-1) {
					this.className=this.className.replace("page", "");
				}
				else {
				this.className+=" page";
				}
			}
		}
	}
}

function popupimage(img) {  
w=window.open("",'image','width=400,height=400,left=100,toolbar=no,scrollbars=no,resizable=no'); 
w.document.write("<HTML><HEAD><TITLE>Galerie photos</TITLE></HEAD>"); 
w.document.write("<SCRIPT language=javascript>function checksize() { if (document.images[0].complete) { window.resizeTo(document.images[0].width+10,document.images[0].height+30); window.focus();} else { setTimeout('checksize()',250) } }</"+"SCRIPT>"); 
w.document.write("<BODY onload='checksize()' onblur='window.close()' onclick='window.close()' leftMargin=0 topMargin=0 marginwidth=0 marginheight=0>");
w.document.write("<TABLE width='100%' border='0' cellspacing='0' cellpadding='0' height='100%'><TR>");
w.document.write("<TD valign='middle' align='center'><IMG src='"+img+"' border=0 alt='Mon image' title='Cliquez pour fermer la photo'>"); 
w.document.write("</TD></TR></TABLE>");
w.document.write("</BODY></HTML>"); 
w.document.close(); 
} 