// variables
var	gMode = '';

// err handlers
//onerror = ErrWindow;



//----------------------------------------
// image routines
//----------------------------------------
function ChangeImage(inMode,inImageName)
{
	if (document.images){
		if (inMode == gMode)
			document[inMode].src = GetImage(inMode,"On");
		else
			document[inMode].src = GetImage(inMode,inImageName);
	}
}


//----------------------------------------
function GetImage(inMode,inImageState)
{
	srcStr = "Images/" + inMode + inImageState + ".gif";
	return(srcStr);
}


//----------------------------------------
// mode routines
//----------------------------------------
function SetCurMode(inMode)
{

}


//----------------------------------------
function SetCurPage(inMode)
{
	if (document.images){
		// clear the old mode image
		if (gMode != '')
			document[gMode].src = GetImage(gMode,"Off");
		else{
			// clear all the images
			document['home'].src = GetImage('home',"Off");
			document['products'].src = GetImage('products',"Off");
			document['downloads'].src = GetImage('downloads',"Off");
			document['support'].src = GetImage('support',"Off");
			document['purchase'].src = GetImage('purchase',"Off");
		}
	
		// set the new mode
		gMode = inMode;
	
		// set the new mode image
		if (gMode != '')
			document[gMode].src = GetImage(gMode,"On");
	}
}


//----------------------------------------
// misc routines
//----------------------------------------
function ForceIntoFrame(inURL)
{
	if (top.location == self.location)
		top.location.href = "framer.html?" + inURL;
	else
		parent.menu.SetCurPage(inURL);
}


//----------------------------------------
function FrameBuilder(inURL)
{
var	linkURL = inURL;
var	callingURL;

	if (parent.document.URL){
		callingURL = parent.document.URL;
	
		// if the calling URL has a question mark then set the linkURL
		// to the appended link, otherwise we will use what was passed in
		if (callingURL.indexOf('?') != -1)
			linkURL = callingURL.substring(callingURL.indexOf('?') + 1,callingURL.length);

		// write the doc
		document.writeln('<frameset rows="140,*" framespacing="0" border="0" frameborder="NO">');
		document.writeln('	<frame src="top.html" name="top" noresize scrolling="NO">');
		document.writeln('	<frameset cols="140,*" framespacing="0" border="0" frameborder="NO">');
		document.writeln('		<frame src="menu.html" name="menu" noresize scrolling="NO">');
		document.writeln('		<frame src="' + linkURL + '.html" name="body" noresize>');
		document.writeln('	</frameset>');
		document.writeln('</frameset>');
	}
}


//----------------------------------------
// Debugging
//----------------------------------------
function DebugMsg(inMsg)
{
//var runningNetscape = (navigator.appName == "Netscape");
	
//	if (runningNetscape)
//		java.lang.System.out.println(inMsg);
//	else
		alert(inMsg);
}


//----------------------------------------
function MessageWin(inMsg)
{
	debugWin = window.open("","debugWin","height=200,width=200 resize=yes");

	debugWin.document.write(inMsg);

	// closing the doc forces the write but leaves the window open
	debugWin.document.close();
}


//----------------------------------------
function StatusMsg(inMsg)
{
	window.status = inMsg;
}


//----------------------------------------
function ErrWindow(inErrMsg,inLocation,inLineNum)
{
	debugWin = window.open("","debugWin","height=200,width=200 resize=yes");

	debugWin.document.write("Error");
	debugWin.document.write("<br>Line: " + inLineNum);
	debugWin.document.write("<br>Msg: " + inErrMsg);

	// closing the doc forces the write but leaves the window open
	debugWin.document.close();
}





