<!--
// Copyright © Stephen C-E homepage.ntlworld.com/thepiglet Nov 2001
// Please do not use this or any derivation from this in whole or in part without my permission
// If you ask I'll probably say 'yes'!
//
var timer=null;
var timer2=null;
var number=0;
var idname = "menu"
var menudiv = new Array();
var anotherframe = this.parent.frames[1];
var oldy = -1;

//create layer(s)
	hovercolor   = "#FFFFFF";	// color name/code
	bgcolor      = "#1E1388";	// color name/code
	background   = "";		// picture url
	menu_border  = 1;		// IE only
	border_color = "#000000";	// IE only

function menublock(Left,Top,Width) { 
if(document.all) { Top+=0; Left+=5; Width-=8; }
	this.left  = Left;
	this.top   = Top;
	this.info  = "";
	this.Width = Width;
	T=0;
	for(i=3; i<arguments.length; i++) {
		if(document.all || document.getElementById) { this.info += "<TR><TD WIDTH="+Width+" onMouseOver='this.bgColor=\""+hovercolor+"\"' onMouseOut='this.bgColor=\"\"'>"+arguments[i]+"</TD></TR>"; }
		else { this.info += "<LAYER onMouseOver='this.bgColor=\""+hovercolor+"\"' onMouseOut='this.bgColor=\""+bgcolor+"\"' WIDTH="+Width+" POSITION=ABSOLUTE LEFT=2  TOP="+T+">&nbsp;"+arguments[i]+"</LAYER>"; }
		T+=20; 	}
}

function setup(){
 for(i=0; i<mLayer.length; i++) {
	if((document.all) || document.getElementById) { var content="<TABLE STYLE='border:solid "+menu_border+" "+border_color+"'>"+mLayer[i].info+"</TABLE></SPAN>"; }
	else if(document.layers) var content=mLayer[i].info;  
	menudiv[i]=makeone(content, anotherframe,mLayer[i].left,mLayer[i].top,mLayer[i].Width);
 }
 if (timer2==null)
	timer2=setInterval("catchscroll()",300);
}

// show layers (if they don't exist create them first)
function show()
{	if (timer) clearTimeout(timer);
	if (!created()) setup();
	hideall();
	for (var i = 0; i<arguments.length; i++) get(menudiv[arguments[i]], anotherframe).visibility = "visible"
}

//hide a layer
function hide(n){if (created()) get(menudiv[n], anotherframe).visibility = "hidden"}
//hide all layers
function hideall() {for (var i=0; i<menudiv.length; i++) hide(i);}
//set timer to hide all layers
function t_hide() {timer=setTimeout("hideall();",500);}
//clear timer
function clear() {clearTimeout(timer);}

//Detect Scrolling in the target frame and move the menus
function catchscroll() {
	if (created())
	{	newy = gety(anotherframe);
		if (oldy != newy) {
			oldy=newy;
			for (var i=0; i<menudiv.length; i++) moveTo(menudiv[i], mLayer[i].left, (mLayer[i].top + newy), anotherframe);
		}
	}
}

function gety(where) {
if (document.all) return where.document.body.scrollTop;
else return where.pageYOffset;
}

//create a layer somewhere
function makeone(htmlStr, where, x,y, width) {

if(document.layers) 
	{	if(where == null)
			elem=new Layer(width);
		else
			elem=new Layer(width, where);
		elem.onMouseOver= function() {parent.frames[0].clear();};
		elem.onMouseOut= function() {parent.frames[0].t_hide();};
		elem.document.open(); 
		elem.document.write(htmlStr); 
		elem.document.close(); 
		elem.moveTo(x,y);
		elem.bgColor = bgcolor;
		return elem.id;
	}
else
if(document.all) 
	{	var where2=where;
		if (where == null) where=document.body;
		else where=where.document.body;
		var thename = idname + number++
		var txt = '<DIV ID="' + thename +'"'
			+ ' STYLE="position:absolute; background-color:' +bgcolor+';left:'+x +';top:'+y+';"' + " onmouseover='parent.frames[0].clear();' onMouseOut='parent.frames[0].t_hide()'>"
			+ htmlStr 
			+ '</DIV>'; 

			where.insertAdjacentHTML("BeforeEnd",txt); 
			return thename;
	} 
	else 
	if (document.getElementById)
	{
		if(where == null) where=document.body;
		else where=where.document.body;

		var thename = idname + number++;
		var newRange = document.createRange();
		elem = document.createElement("DIV");
		with (elem) {
			setAttribute("style","position:absolute;left:"+x+"px;top:"+y+"px; background-color:"+ bgcolor +";");
			setAttribute("onmouseover","parent.frames[0].clear()");
			setAttribute("onmouseout","parent.frames[0].t_hide()");
			setAttribute("id", thename);
		}
	
		where.appendChild(elem);

		newRange.setStartBefore(elem);
		strFrag = newRange.createContextualFragment(htmlStr);	
		elem.appendChild(strFrag);
		return thename;
	}
}

//move a layer somewhere
function moveTo(thething, x, y, where) {  
		var thisthing=get(thething, where);
		thisthing.left = x;
		thisthing.top  = y;
}

//get the style thing required for the browser
function get(thething, where){
	var thing = getobj(thething, where)
	if (document.all || document.getElementById)
		return thing.style;
	else 
		return thing;
}

//get the object
function getobj(thething, where){
// and don't think about getting something that's not there or nested!
if (where==null) where = this;

	if (document.all) 
		return where.document.all(thething);  
	else if (document.getElementById) 
		return where.document.getElementById(thething);  
	 else if (document.layers) 
		return where.document.layers[thething];  
}

//have I created anything in the other frame yet?
function created(){
	if (menudiv.length == 0) { 
		return false;}
	else
	{	var temp = getobj(menudiv[0],anotherframe); 
		if ((temp==null) || (temp=="undefined")) return false;
		else return true;
	}
}
//-->