	/*
	 * Based on Flyout menus for the University of Washington Home Page
	 * Altered to work on displaying and hiding already existing ul nodes
	 * For this purpose non-functional code elements are removed
	 * Alteration done by Artex, Netherlands, August 2006, www.artex.nl 
	 * University of Washington / Computing and Communications
	 * May, 2005
	 * Documentation of the original code can be found at
	 *     http://www.washington.edu/webinfo/case/flyout/
	 * $Id: flyout.js,v 2.9 2005/05/23 16:56:56 fmf Exp $
	 *
	 * You are free to copy and/or use these flyout menus (or
	 * derivative works) but please make sure this comment block
	 * remains intact and in its entirety at the top of the file.
	 */
	 	
	var d = document;
	FlyLyr.on = 1;
	
	if ("undefined" != typeof d.getElementById) {
		FlyLyr.isMac = navigator.platform.indexOf ("Mac") >= 0;
		FlyLyr.on = 1;
		var ua = navigator.userAgent;
		FlyLyr.isOpera = ua.indexOf (" Opera ") >= 0;
		FlyLyr.isKonq = ua.indexOf (" Konqueror") >= 0;
		
		initFlyLyr ();
		initDelay ();
	}
	
	function useLayer (id) {
		if (! FlyLyr.on)
			return;
		var elem = findObj ("l_" + id);
		if (! elem)
			return;
		new FlyLyr (id);
	}
	
	function FlyLyr (id) {
		this.lyr = findObj ("l_" + id);
		eval ('this.lyr.onmouseover = function () { mIn ("' + id + '") }');
		eval ('this.lyr.onmouseout = function () { mOut ("' + id + '") }');
		this.id = id;
		FlyLyr.lyrs[id] = this;
		for (var a in FlyLyr.defs)
			this[a] = FlyLyr.defs[a];
	}
	
	function flyDefs (defs) {
		if (! FlyLyr.on)
			return;
		if (! defs)
			defs = FlyLyr.defdefs;
		for (var def in defs)
			FlyLyr.defs[def] = defs[def];
	}
	
	function initFlyLyr () {
		FlyLyr.prototype.doHide = function () {
			this.stopHide ();
			this.realHide ();
			if (this.hideImage)
				this.hideImage (this.image, this.lyr);
			else if (this.outimg && this.image.tagName == "IMG")
				this.image.src = this.outimg;
			FlyLyr.showing[this.id] = null;
		};	
		FlyLyr.prototype.doShow = function () {
			this.stopShow ();
		for (var l in FlyLyr.hideQueue)
				if (FlyLyr.hideQueue[l])
					FlyLyr.hideQueue[l].doHide ();
			this.realShow ();
			FlyLyr.showing[this.id] = this;
		};
		FlyLyr.prototype.queueHide = function () {
			if (! FlyLyr.hideQueue[this.id]) {
				this.queuedHide = new Delay (this.timeout, this, "doHide");
				FlyLyr.hideQueue[this.id] = this;
			}
		};
		FlyLyr.prototype.queueShow = function () {
			if (! FlyLyr.showQueue[this.id]) {
				this.queuedShow = new Delay (this.pause, this, "doShow");
				FlyLyr.showQueue[this.id] = this;
			}
		};
		FlyLyr.prototype.stopHide = function () {
			if (this.queuedHide) {
				this.queuedHide.stop ();
				FlyLyr.hideQueue[this.id] = null;
			}
		};
		FlyLyr.prototype.stopShow = function () {
			if (this.queuedShow) {
	
				this.queuedShow.stop ();
				FlyLyr.showQueue[this.id] = null;
			}
		};
	
		FlyLyr.lyrs = new Object ();
		FlyLyr.showing = new Object ();
		FlyLyr.hideQueue = new Object ();
		FlyLyr.showQueue = new Object ();
		FlyLyr.defs = new Object ();
		FlyLyr.defdefs = {
			outimg: null,
			pause: 250,
			timeout: 1000,
			preDetach: null,
			showImage: null,
			hideImage: null
		}
		flyDefs ();
	
		FlyLyr.prototype.realHide = function () {
			for (l in FlyLyr.showQueue){
				if(l.substr(0,3)=="sub"){				
					findObj("l_"+l).style.display="none";
				}
			}
			this.lyr.style.display = "none";
		};
		FlyLyr.prototype.realShow = function () {
			//alert(this.lyr.id);
			this.lyr.style.display = "";
			//alert("dis" +this.lyr.style.display);
		};
	}
	
	function Delay (delay, obj, fn) {
		this.obj = obj;
		var uid = ++Delay.nuid;
		this.timeoutid = setTimeout ("Delay.dispatch (" + uid + ")", delay);
		this.uid = uid;
		this.func = fn;
		Delay.disparr[uid] = this;
	}
	
	function initDelay () {
		Delay.prototype.stop = function () {
			clearTimeout (this.timeoutid);
			Delay.disparr[this.uid] = null;
		};
		Delay.dispatch = function (uid) {
			var item = Delay.disparr[uid];
			if (! item)
				return;
			item.stop ();
			eval ("item.obj." + item.func + " ()");
		};
		Delay.nuid = 0;
		Delay.disparr = new Object;
	}
	
	function findObj (n) {
		return d.getElementById (n) || d[n] || (d.all && d.all[n]);
	}
	
	function mIn (id) {			
		if (! FlyLyr.on)
			return;
		var lyr = FlyLyr.lyrs[id];	
		if (! lyr) {
			useLayer (id);
			lyr = FlyLyr.lyrs[id];		
			if (! lyr)
				return;
		}
		if (FlyLyr.showing[id]){
			lyr.stopHide ();
		}else{		
			lyr.queueShow ();
		}
	}
	
	function mOut (id) {	
		if (! FlyLyr.on)
			return;
		if (! id) {
			for (var l in FlyLyr.showing)
				if (FlyLyr.showing[l])
					FlyLyr.showing[l].queueHide ();
			for (l in FlyLyr.showQueue)
				if (FlyLyr.showQueue[l])
					FlyLyr.showQueue[l].stopShow ();
		} else if (FlyLyr.showing[id])
			FlyLyr.showing[id].queueHide ();
		else if (FlyLyr.showQueue[id])
			FlyLyr.showQueue[id].stopShow ();
	}