/*-- -----------------------------------------------------------------------
        Copyright 1998-2007 Loco-Boose Hobbies.  All rights reserved.
 --------------------------------------------------------------------------- */

menuObj = ""
lastMenuID = ""
timerID = ""
lastMenu = "menuHome"

function showMenu(currMenu, menuID, showBar, menuNameID) {
	if (lastMenu != menuNameID) {
		if (document.getElementById) {
			document.getElementById(lastMenu).className = "style1"
		}
		else if (document.all) {
			document.all.lastMenu.className = "style1"
		}
		else if (document.layers) {
			document.lastMenu = "style1"
		}
	}

	clearTimeout(timerID)
	timerID = setTimeout('hideAll()', 10*1000)

	if (document.getElementById) {
		document.getElementById(menuID).style.color = "#003399"
	}
	else if (document.all) {
		document.all.menuID.style.color = "#003399"
	}
	else if (document.layers) {
		document.menuID.style.color = "#003399"
	}

	if (menuObj.visibility == "visible") {
		hideMenu()
	}

	menuObj = document.getElementById(currMenu).style
	menuObj.visibility = "visible"

	if (document.getElementById) {
		document.getElementById(menuID).style.color = "#003399"
	}
	else if (document.all) {
		document.all.menuID.style.color = "#003399"
	}
	else if (document.layers) {
		document.menuID.style.color = "#003399"
	}

	if (showBar == "bars") {
		if (document.getElementById) {
			document.getElementById('whiteBarTop').style.visibility = "visible"
			document.getElementById('whiteBarBottom').style.visibility = "hidden"
		}
		else if (document.all) {
			document.all.whiteBarTop.style.visibility = "visible"
			document.all.whiteBarBottom.style.visibility = "hidden"
		}
		else if (document.layers) {
			document.whiteBarTop.style.visibility = "visible"
			document.whiteBarBottom.style.visibility = "hidden"
		}
	}

	lastMenuID = menuID
	lastMenu = menuNameID
}
function hideMenu() {
	menuObj.visibility = "hidden"

	if (document.getElementById) {
		document.getElementById('whiteBarTop').style.visibility = "hidden"
		document.getElementById('whiteBarBottom').style.visibility = "hidden"
		document.getElementById(lastMenuID).style.color = "#330000"
	}
	else if (document.all) {
		document.all.whiteBarTop.style.visibility = "hidden"
		document.all.whiteBarBottom.style.visibility = "hidden"
		document.all.lastMenuID.style.color = "#330000"
	}
	else if (document.layers) {
		document.whiteBarTop.style.visibility = "hidden"
		document.whiteBarBottom.style.visibility = "hidden"
		document.lastMenuID.style.color = "#330000"
	}
}
function hideAll() {
	hideMenu()
	if (document.getElementById) {
		document.getElementById(lastMenu).className = "style1"
	}
	else if (document.all) {
		document.all.lastMenu.className = "style1"
	}
	else if (document.layers) {
		document.lastMenu.className = "style1"
	}
}

//var newWindow = null;

function openWindow(contentURL,windowName,windowWidth,windowHeight, scroll, tool, menu) {
	var winleft = (screen.width - windowWidth) / 2;
	var winUp = (screen.height - windowHeight) / 2;
	winProp = 'width='+windowWidth+',height='+windowHeight+',left='+winleft+',top='+winUp+',scrollbars='+scroll+',toolbar='+tool+',menubar='+menu+',resizable';
	Win = window.open(contentURL, windowName, winProp);
	//Win.moveTo(winleft,winUp);
	Win.focus();
}

/* function closeWindow() {
	if (newWindow != null)  {	
	 newWindow.close();
	 newWindow = null;
	}
}

function toggleWindow(contentURL,windowName,windowWidth,windowHeight) {
	if (newWindow == null) {
		widthHeight = 'HEIGHT=' + windowHeight + ',WIDTH=' + windowWidth;
		newWindow = window.open(contentURL,windowName,widthHeight);
		newWindow.focus()
	}
	else {	
	 	newWindow.close();
	 	newWindow = null;
	}
}*/

function closePop() {
	self.close();
}

function setMenuClass()
{
        uriNoHtml = document.location.href.substring(0,document.location.href.lastIndexOf('.'));
/*        alert(uriNoHtml);*/
        fname = uriNoHtml.substr(uriNoHtml.lastIndexOf('/')+1);
/*        alert(fname);*/
        uriNoHtml = uriNoHtml.substring(0,uriNoHtml.lastIndexOf('/'));
        dname = uriNoHtml.substr(uriNoHtml.lastIndexOf('/')+1);
/*        alert(dname);*/
        ele = document.getElementById(fname);
        if (ele != null) 
        {
            ele.className = "topMenuOn";
        }
        ele = document.getElementById(dname);
        if (ele != null) 
        {
            ele.className = "topMenuOn";
        }
}

var rotateImageIndex = 0;
var rotateBasePath;
var rotateImageArray;
var rotateImageElement;

function rotateSetup(basePath,imageArray,interval)
{
    rotateImageIndex = -1;
    rotateBasePath = basePath;
    rotateImageArray = imageArray;
    rotateImage();
    setInterval(rotateImage,interval*1000);
}
function rotateImage()
{
    rotateImageIndex ++;
    if (rotateImageIndex >= rotateImageArray.length) rotateImageIndex = 0;    
    document.getElementById('rotateImageTag').src = rotateBasePath + rotateImageArray[rotateImageIndex];
}

function openPic(img,imgName,title,width,height)
{
var newWidth = Number(width) + 30;
var newHeight = Number(height) + 80;
var winLeft = (screen.width - newWidth) / 2;
var winUp = (screen.height - newHeight) / 2;
var winProp = 'width='+newWidth+',height='+newHeight+',left='+winLeft+',top='+winUp+',scrollbars=0';
var picWin = window.open('',imgName,winProp);

picWin.document.write(
'<html>',
'<head>',
'<title>'+title+'</title>',
'<link rel="stylesheet" href="../lbh.css">',
'</head>',
'<body leftmargin=0 topmargin=0 marginwidth=0 marginheight=0 background="../uiImages/gold_bgd.gif">',
'<table width='+newWidth+' cellpadding=0 cellspacing=0>',
'	<tr>',
'		<td width='+newWidth+' height=10 colspan=3><img src="../uiImages/transparent.gif" width='+width+' height=10></td>',
'	</tr>',
'	<tr>',
'		<td width=15 height=15><img src="../uiImages/transparent.gif" width=15 height=5></td>',
'		<td width='+width+' align="center" valign="middle">',
'		<p class="poph3">'+title+'</p>',
'		<td width=15 height=15><img src="../uiImages/transparent.gif" width=15 height=5></td>',
'		</td>',
'	</tr>',
'	<tr>',
'		<td width='+newWidth+' height=10 colspan=3><img src="../uiImages/transparent.gif" width='+newWidth+' height=10></td>',
'	</tr>',
'	<tr>',
'		<td width='+newWidth+' colspan=3 align="center" valign="middle"><img src="'+img+'" title="'+title+'" width='+width+' height='+height+'></td>',
'	</tr>',
'	<tr>',
'		<td width='+newWidth+' height=10 colspan=3><img src="../uiImages/transparent.gif" width='+newWidth+' height=10></td>',
'	</tr>',
'	<tr>',
'		<td width=15 height=15><img src="../uiImages/transparent.gif" width=10 height=5></td>',
'		<td width='+width+' height=15 valign="bottom"><P class="pop1">> <A HREF="javascript:self.close()" class="pop1"> Close Window</A></P></td>',
'		<td width=15 height=15><img src="../uiImages/transparent.gif" width=10 height=5></td>',
'	</tr>',
'</table>',
'</body>',
'</html>' //no comma after last line
);
picWin.document.close();
picWin.focus();
}
