		if (!Array.prototype.indexOf)
		{
			Array.prototype.indexOf = function(elt /*, from*/)
				{
					var len = this.length;
			
					var from = Number(arguments[1]) || 0;
					from = (from < 0)
						? Math.ceil(from)
						: Math.floor(from);
					if (from < 0)
						from += len;
						
					for (; from < len; from++)
					{
						if (from in this &&
						this[from] === elt)
						return from;
					}
				return -1;
			};
		}

		var FlyoutZIndex = new Array();
		var FlyoutDivs = new Array();
		var FlyoutBaseZIndex = 100;
		
		function FlyoutBringToFront(div)
		{
			var x;
			var MaxHeight = FlyoutBaseZIndex;
			
			for(x=0;x<FlyoutDivs.length;x++) {
				if (FlyoutZIndex[x] > MaxHeight) MaxHeight =  FlyoutZIndex[x];
			}
			
			x = FlyoutDivs.indexOf(div);
			if (x<0) {
				FlyoutDivs.push(div);
				FlyoutZIndex.push(MaxHeight+1);
				div.style.zIndex = MaxHeight+1;
			} else {
				var y;
				for(y=0;y<FlyoutDivs.length;y++) {
					FlyoutZIndex[y]--;
					FlyoutDivs[y].style.zIndex = FlyoutZIndex[y];
				}
				FlyoutZIndex[x] = MaxHeight;
				FlyoutDivs[x].style.zIndex = MaxHeight;
			}
		}

		function FlyoutBind(AnchorID, DivID, BaseHeight, Vel)
		{
			var StartCounting = function () {eval("FlyoutStartCounting('"+DivID+"');");};
			var Reset = function () {eval("FlyoutReset('"+DivID+"');");};
			var BringToFront = function () {eval ("FlyoutBringToFront(this);");}
			var a, d;
			a = document.getElementById(AnchorID);
			d = document.getElementById(DivID);
			if (a && d) {
				a.onmouseout = StartCounting;
				a.href="javascript: Flyout('"+DivID+"');";
				d.onmouseout = StartCounting;
				d.onmouseover = Reset;
				d.onmousedown = BringToFront;
			
				d.BaseHeight = BaseHeight;
				d.TargetHeight = 0;
				d.Vel = Vel;
				d.Timeout = 10;
				d.Countdown = false;
				d.Counter = 0;
			}
		}
		
        function FlyoutTimer(DivID)
        {
			var d = document.getElementById(DivID);
	        if (d.Countdown == true) d.Counter--;
	        if (d.Counter == 0) d.TargetHeight = 0;
			var undefined;

			var h = d.style.height;
			if (h==undefined || h=="") h=0;
			else h = parseInt(h);
	        var diff = d.TargetHeight-h;
	        if (diff>0) {
		        if (Math.abs(diff)<d.Vel) h = d.TargetHeight;
		        else h += d.Vel;
	        } else if (diff<0) {
		        if (Math.abs(diff)<d.Vel) h = d.TargetHeight;
		        else h -= d.Vel;
	        }
	        if (h == 0) {
		        d.style.display = "none";
	        } else {
		        d.style.height = h+"px";
		        setTimeout("FlyoutTimer('"+DivID+"');", d.Timeout);
	        }
        }

        function FlyoutReset(DivID)
        {
			var d = document.getElementById(DivID);
	        d.Counter = 100;
	        d.Countdown = false;
        }

        function FlyoutStartCounting(DivID)
        {
			var d = document.getElementById(DivID);
	        d.Countdown = true;
        }

        function Flyout(DivID)
        {
			var d = document.getElementById(DivID);
	        FlyoutReset(DivID);
	        d.style.display = "block";
	        d.TargetHeight = d.BaseHeight;
	        FlyoutTimer(DivID);
			FlyoutBringToFront(d);
        }
