if (document.layers) {n=1;ie=0}
if (document.all) {n=0;ie=1}
var activemenu = new Object();
var menu = new Object();
var activediv
var HidingTimer

	var timeoutsec = 600;
	var alignlr = 'middle';
	var aligntb = 'middleside';
	var linkclass = 'linktext';
	var titleclass = 'titletext';
	var menubordercolor = '#000000';
	var menuwidth = 200;
	var menutype = 'table';
	var menuborderwidth = '1';
	var cellbgcolor = '#FFFFFF';
	var titlebgcolor = '#FFFFFF';
	var textovercol = '#FFFFFF';
	var textcolor = '#000000';
	var imgortext = "text";



document.write ("<style type='text/css'>" +
		".icsmenu { visibility: hidden; position: absolute; " +
		"left: 0; top: 0; z-index:100;}<\/style>");

function getRealLeft(el) {
    xPos = el.offsetLeft;
    tempEl = el.offsetParent;
    while (tempEl != null) {
        xPos += tempEl.offsetLeft;
        tempEl = tempEl.offsetParent;
    }
    return xPos;
}

function getRealTop(el) {
    yPos = el.offsetTop;
    tempEl = el.offsetParent;
    while (tempEl != null) {
        yPos += tempEl.offsetTop;
        tempEl = tempEl.offsetParent;
    }
    return yPos;
}

function initmenu(divnum, stuff){

	var a = arguments
	j = a.length;

     if (ie) {
	eval ('xpos = getRealLeft(' + divnum + ');');
	eval ('ypos = getRealTop(' + divnum + ');');
	netstuff = '';}

     if (n)  {
	if (imgortext == 'image') {
	eval ('xpos = document.' + divnum + '.x;');
	eval ('ypos = document.' + divnum + '.y;');}
	else {
		xpos = 1;
		ypos = 1;
		}
	netstuff = 'document.';
	}
//Set Menu Width 
	menuwidth = 0;
	str = a[1];
	var eqpos = str.indexOf ("=");
	if (str.substr(0,eqpos).toLowerCase() == 'menuwidth') {
		menuwidth = str.substr (eqpos + 1);	
	}

	if (menuwidth != 0) {
		lyrwidth = ' WIDTH=' + menuwidth;
	} else {
		lyrwidth = '';
	}

//Determine Menu type
	if (menutype == 'table') {
		isTable = 1;
		var tblend = '';
	} else {
		isTable = 0;
		var tblend = '<TR><TD VALIGN=TOP BGCOLOR=' + cellbgcolor + '>';
		writ = 1;
	}

//Actual Layer creation
	menuwidth=0;
	retstr="";
	bgind=0;
	if (a[1] != null) {
		document.write('<DIV ' + 'CLASS=icsmenu ID="' + divnum + 'form">');
		if (isTable){
		document.write ('<TABLE BORDER=0 CELLPADDING=0 CELLSPACING=0 BGCOLOR=#000000><TR><TD>');
		}
		document.write ('<TABLE BORDER=0 CELLPADDING=4 CELLSPACING=1' + lyrwidth + '>');
 		for (var x = 1; x < j; ++x) {
			str = a[x] 
			var eqpos = str.indexOf ("=");
			    if (eqpos > 0) 
				if (str.substr(0,eqpos).toLowerCase() == 'menuwidth') {
					}
				else {
					tind = 0;
					cellalign = ' VALIGN=MIDDLE';
					if (bgind) {
						bgcolor = ' BGCOLOR=' + cellbgcolor;
						bgind = 0;
						//imgbul = '<img' + ' src="img/bullet1.gif">';
					} else {
						bgcolor = ' BGCOLOR=' + cellbgcolor2;
						//imgbul = '<img' + ' src="img/bullet1.gif">';
						bgind = 1;
					}
						//<LI STYLE='list-style-type:square;color:#FFFFFF;font-size:4pt;'>
						//<font color='#DE9410'>&#149;</font>&nbsp;&nbsp;
        				retstr = "<table cellpadding=0 cellspacing=0 border=0><tr><td valign=top><font color='#FFFFFF'>&#149;</font>&nbsp;&nbsp;<\/td><td valign=middle><a href='" + str.substr (eqpos + 1) + "' onMouseOver='cancelHide(this);' onMouseOut='StartHide(\"" + divnum + "\",this);' class=\"" + linkclass + "\">" + str.substr (0, eqpos) + "<\/a><\/td><\/tr><\/table>";
					
		if ((isTable) || (tind)) {document.write ('<TR' + bgcolor + '><TD' + cellalign + '>' + retstr + '<\/TD><\/TR>' + tblend);writ=0;}
		else {if (writ) {document.write (tblend);
				 writ = 0;}
			document.write (retstr + '<BR>');}
			}
		};
		if (isTable) {document.write ('<\/TD><\/TR><\/TABLE><\/TD><\/TR><\/TABLE><\/DIV>\n\n');}
		else {document.write ('<\/TABLE><\/TD><\/TR><\/TABLE><\/DIV>\n\n');};
		
	}

	eval ('menu = ' + netstuff + divnum + 'form');
	if (imgortext == "text") {
		if (ie){
		eval ('picheight = ' + netstuff + divnum + '.parentElement.offsetHeight');
		eval ('picwidth = ' + netstuff + divnum + '.parentElement.offsetWidth');
			}
		
		if (n) {
			picheight = 1;
			picwidth = 1;
			}

	} else {
		eval ('picheight = ' + netstuff + divnum + '.height');
		eval ('picwidth = ' + netstuff + divnum + '.width');
	}

//Left/Right/Absolute Alignment
	if (ie){
		menuheight = menu.clientHeight;
		menuwidth1  = menu.clientWidth;}
	if (n) {
		menuheight = menu.clip.height;
		menuwidth1  = menu.clip.width;}

		if (alignlr == 'left') {xpos = xpos - menuwidth1 - 10;}
			else if (alignlr == 'right') {xpos = xpos + picwidth - 8;}
				else if (alignlr == 'middle') {xpos = xpos + (picwidth / 2);}
					else if (alignlr == 'dropdown') {xpos = xpos;}
						else if (alignlr == 'dropup') {xpos = xpos;}
							else {xpos = alignlr;}

//Top/Bottom/Middle/Absolute Alignment
		if (aligntb == 'middleside') {ypos = ypos - (menuheight / 2) + (picheight / 2);}
			else if (aligntb == 'bottomside') {ypos = ypos - menuheight + picheight;}	
				else if (aligntb == 'topside') {ypos = ypos;}
					else if (aligntb == 'dropdown') {ypos = ypos + picheight;}
						else if (aligntb == 'dropup') {ypos = ypos - menuheight;}	
							else {ypos = aligntb;};
	if (ie) {
		menu.style.posLeft = xpos;
		menu.style.posTop = ypos;
		menu.style.visibility = 'hidden';
		activediv = divnum;}
	if (n) {
		menu.moveTo(xpos,ypos);
		activediv = divnum;
		}

}

function ShowMenu (divnum,e){  
	clearTimeout(HidingTimer);
	if (ie) {
	eval ('menu =' + divnum + 'form');	
	if (menu.style.visibility == 'hidden') {
		if ((activediv != null) && (activediv != divnum)) {
			HideMenu(activediv);}
		menu.style.visibility = 'visible';
		activediv = divnum;}
	}
	if (n) {
	eval ('menu = document.' + divnum + 'form');
	if (imgortext == 'text'){
		xPos = e.pageX + 100;
		yPos = e.pageY - 30;
		menu.moveTo(xPos,yPos);
	}
	if (alignlr > 0){
		xPos = alignlr;
		menu.moveTo(xPos,yPos);
		}
	if (menu.visibility == 'hide') {
		HideMenu(activediv);
		menu.visibility = 'show';
		activediv = divnum;}
	else if (menu.visibility == 'show'){HideMenu(divnum);}
}}

function HideMenu (divnum2){
	if (ie) {
	eval('menutohide = ' + divnum2 + 'form');
	menutohide.style.visibility = 'hidden';}
	if (n) {
	menu2 = new Object();
	eval('menu2 = document.' + divnum2 + 'form');
	menu2.visibility = 'hide';}
	}

//StartHide function starts a timer that lasts about a second giving the user
//the chance to move onto a drop down menu before it closes

function StartHide (divnum3,th){
	HidingTimer = setTimeout('HideMenu("' + divnum3 + '");', timeoutsec);
		if ((ie) && (th != null)){th.style.color= textcolor;}
}

//Cancelhide function cancels the HidingTimer - in other words the user
//Has sucessfully jumped to a drop down menu

function cancelHide (th){
	if ((ie) && (th != null)) {th.style.color= textovercol;}
	clearTimeout(HidingTimer);
}