/*
		jimi malcolm
		malcolmj1@juno.com
		http://guide.ticalc.org
*/
var oLastBtn=0;
function RaiseButton(){
	window.event.cancelBubble=true;
	oBtn = window.event.srcElement;
	var bChosen = false;
	if(oLastBtn && oLastBtn != oBtn){HideButton();}
	if(oBtn.buttonType){oBtn.className = oBtn.buttonType + "Up";
		oLastBtn=oBtn;}
	else {	oLastBtn = 0;
	}
}

function DepressButton(){
	window.event.cancelBubble=true;
	oBtn = window.event.srcElement;
	if(oBtn.buttonType){
		oBtn.className = oBtn.buttonType + "Down";
	}
}

function HideButton(){
	if ((oLastBtn.buttonType == "LeftNavChosen") || (oLastBtn.buttonType == "LeftNavSubChosen") || (oLastBtn.buttonType == "appNavChosen") || (oLastBtn.buttonType == "appNavSubChosen")) {
		oLastBtn.className = oLastBtn.buttonType;
	}
	else {
	oLastBtn.className = oLastBtn.buttonType + "Off";
	}
}

function textRoll(strTextColor){
	window.event.srcElement.style.color = strTextColor;
	window.event.cancelBubble = true;
}

function Menubar(){
	HTML =	"<table border=0 cellpadding=0 cellspacing=0 width=166 onmousedown='DepressButton();' onmouseover='RaiseButton();' onmouseup='RaiseButton();'>" +
	"<tr><td>" +
	"<img src='Images/spacer.gif' width=150 height=1><br>" +
	"<a href='News2009.html'><b><span buttonType='LeftNav' class='LeftNavOff'>Racing News</span></b></a><br>" +
	"<img src='Images/spacer.gif' width=150 height=1><br>" +
	"<a href='Partners.html'><b><span buttonType='LeftNav' class='LeftNavOff'>Partners</span></b></a><br>" +
	"<img src='Images/spacer.gif' width=150 height=1><br>" +
	"<a href='Cars.html'><b><span buttonType='LeftNav' class='LeftNavOff'>The Cars</span></b></a><br>" +
	"<img src='Images/spacer.gif' width=150 height=1><br>" +
	"<a href='Team.html'><b><span buttonType='LeftNav' class='LeftNavOff'>The Team</span></b></a><br>" +
	"<img src='Images/spacer.gif' width=150 height=1><br>" +
	"<a href='History.html'><b><span buttonType='LeftNav' class='LeftNavOff'>Co-op History</span></b></a><br>" +
	"<img src='Images/spacer.gif' width=150 height=1><br>" + 
	"<a href='Photos/Gallery.html'><b><span buttonType='LeftNav' class='LeftNavOff'>Photo Gallery</span></b></a><br>" +
	"<img src='Images/spacer.gif' width=150 height=1><br>" +
	"<a href='Merchandise.html'><b><span buttonType='LeftNav' class='LeftNavOff'>Merchandise</span></b></a><br>" +
	"<img src='Images/spacer.gif' width=150 height=1><br>" +
	"<a href='Contact.html'><b><span buttonType='LeftNav' class='LeftNavOff'>Contact Us</span></b></a><br>" +
	"</td></tr></table>" ;
	document.write(HTML);
	}
	
function BottomMenu(){
	HTML =	"<td class=sm-link-white colspan=9 align=middle bgcolor=gray>" +
	"/ &nbsp;&nbsp;&nbsp; <a href='index.html' class=sm-link-white> Home </a>" +
	"&nbsp;&nbsp;&nbsp; / &nbsp;&nbsp;&nbsp; <a href='Partners.html' class=sm-link-white> Partners </a>" +
	"&nbsp;&nbsp;&nbsp; / &nbsp;&nbsp;&nbsp; <a href='Cars.html' class=sm-link-white> Cars </a>" +
	"&nbsp;&nbsp;&nbsp; / &nbsp;&nbsp;&nbsp; <a href='Team.html' class=sm-link-white> Team </a>" +
	"&nbsp;&nbsp;&nbsp; / &nbsp;&nbsp;&nbsp; <a href='History.html' class=sm-link-white> History </a>" +
	"&nbsp;&nbsp;&nbsp; / &nbsp;&nbsp;&nbsp; <a href='Photos/Gallery.html' class=sm-link-white> Gallery </a>" +
	"&nbsp;&nbsp;&nbsp; / &nbsp;&nbsp;&nbsp; <a href='News2009.html' class=sm-link-white> News </a>" +
	"&nbsp;&nbsp;&nbsp; / &nbsp;&nbsp;&nbsp; <a href='Merchandise.html' class=sm-link-white> Merchandise </a>" +
	"&nbsp;&nbsp;&nbsp; / &nbsp;&nbsp;&nbsp; <a href='Contact.html' class=sm-link-white> Contact Us </a>" +
	"&nbsp;&nbsp;&nbsp; / </td>" ;
	document.write(HTML);
}

var HTML;
var Menus = SubMenus = 0;
var Article = MenuDropped = false;
var NotCompatable = false;
var ObjectBase;
var MouseX;
var MouseY;
var i = 0;
var x, xW, y;
var OffLeft, OffRight, OffTop;
var optionsTB = new Array();
var TitleColor, TitleSubColor;

function OutMouse(MenuID){
	MouseX = event.clientX;

	x = event.srcElement.offsetLeft;
	xW = x + event.srcElement.offsetWidth;

	y = event.offsetY;

	OffLeft	=( MouseX-3 >= x )?	false : true;
	OffRight=( MouseX < xW )?	false : true;
	OffTop	=( y > 1 )?		false : true;

	if (OffLeft || OffRight || OffTop)
		for (i in MenuIDset)
			eval(MenuIDset[i] + ".style.display = 'none';");
	}

function OverMouse(MenuID){
	for (i in MenuIDset)
		eval(MenuIDset[i] + ".style.display = 'none';");
	ObjectBase = event.srcElement;
	x = ObjectBase.offsetLeft + ObjectBase.offsetParent.offsetLeft - 7;
	y = ObjectBase.offsetHeight + 3;
	StyleBase = MenuID.style;
	StyleBase.top = y + 4;
	StyleBase.left = x;
	StyleBase.display = 'inline';
	MenuDropped = true;		// menu currently displayed
	}

function popup(URLstr, Titlestr){
	Titlestr = Titlestr? Titlestr : "";
	window.open( URLstr, Titlestr, "dependant=yes,scrollbars=yes,height=500,width=750");
	}

function formatURL(URL){
	return ((window.location.href.indexOf("index.html") == -1)? "../" : "" ) + URL;
	}

function SetColors(TxtColor, HoverColor, DrkBgColor){
	optionsTB = Array(TxtColor, HoverColor, DrkBgColor);
	}

function ImageWindow(strURL, strTitle){
	q = window.open();
	q.document.write("<TITLE>" + strTitle + "</TITLE><IMG SRC='" + strURL + "'>");
	}
