version = navigator.appVersion.toLowerCase();
agent = navigator.userAgent.toLowerCase();
ie = (version.indexOf('msie')>-1);
win = (version.indexOf('windows')>-1);
opera = (agent.indexOf('opera')>-1);

function toggleList (w) {
/*
 * Opens and closes folders (expandable sitemap)
 */
	ul=w.nextSibling.nextSibling.nextSibling;

	if(ul)
		if (ul.nodeName.toLowerCase()=="ul")
			if(ul.className=="off"){
				ul.className="on"
				w.className="open on"
			} else {
				ul.className="off"
				w.className="open off"
			}
	return false;
}

function toggleDisplay (Id) {
/*
 * Shows and hides elements of the given Id 
 */
	if (document.getElementById(Id)) {
		if (document.getElementById(Id).style.display == "block") {
			document.getElementById(Id).style.display = "none";
		} else {
			document.getElementById(Id).style.display = "block";
		}
	return true;
	} else {
	return false;
	}
}

function writePrint(Text) {
	document.write('\074a a  class="Print" href=\"javascript:window.print();\"\076'+Text+'\074/a\076');
}

function writeAddToFavorite(Text,URL,WebName) {
	if ((opera) && (win)) return false;
	else if ((ie) && (win)) document.write('\074a class="AddToFavorite" href='+"'javascript:window.external.addFavorite(\""+URL+"\",\""+WebName+"\")'"+'\"\076'+Text+'\074/a\076 \074span\076|\074/span\076');
	return false;
}

/*
 * Opens gallery picture
 */

function OpenGalleryImage (Address) {
	width = 820;
	leftPos = (window.screen.width/2)-(width/2);
	height = (window.screen.height-200);
	topPos  = ((window.screen.height)/2)-(height/2)-30;
	CloseGalleryImageWindow ();
	return window.open (Address,"ImageWindow","width="+width+", height="+height+", left="+leftPos+", top="+topPos+",dependent=yes, titlebar=no, scrollbars=yes, resizable=yes, status=no");
}

function CloseGalleryImageWindow () {
	if (window.ImageWindow && !window.ImageWindow.closed)	ImageWindow.close()
}

/* Perform functions on unload */
function LeavePage () {
	CloseGalleryImageWindow ();
}

