//--- SiteMenu v3.0, Copyright (c) 2002, FieldZero Inc., All Rights Reserved.
//--- Visit www.fieldzero.com for current SiteMenu downloads and information.

/**************************************************************************

This source code may be modified for use on the internet according to
the license terms specified on the FieldZero web site.  The SiteMenu copyright
notice and url link above, must be displayed within each source code file and 
within the HTML page containing the menu.  

Portions of this code may not be extracted, duplicated, or modified for inclusion
with other software or html pages utilizing JavaScript code.  The SiteMenu
source code is the sole intellectual property of FieldZero, duplication and 
distribution of this software or source code without the express written consent
of FieldZero is strictly forbidden.

**************************************************************************/


mainCount = 0;
t_mc = new Array();
ready  = false;
subExists = null;
status_shown = false;


navape = navigator.appVersion;
navapv = navape.toLowerCase();
navapn = navigator.appName;
navapu = navigator.userAgent.toLowerCase();

ns = navapn == ("Netscape");
ns4 = (ns && (navape.indexOf("4.") != -1));
mac = (navape.indexOf("Mac") != -1);
ie = (navapn.toLowerCase().indexOf("microsoft")>-1);
ie5 = (navapv.indexOf("msie 5.") != -1);
ie6 = (navapv.indexOf("msie 6.") != -1);
ie4 = ((ie) && (!ie5) && (!ie6));
ns5 = (navigator.vendor == ("Netscape6") || navigator.product == ("Gecko"));
opera = (navapu.indexOf("opera")!=-1);
osx = (navapu.indexOf("msie 5.12")!=-1);


(ns4) ? brn = "ns" : brn = "ie";
if (ns5 || ie4) brn = "ns6";
if (opera) brn = "opera";

document.write("<script language=\"JavaScript1.2\" src=\""+SM_codebase+"sm_"+brn+".js\"></script>");
document.close();



function SM_handleOnload()
{
	
	if (ready) return;
		
	positionAll();
	if (ns4) prepareImages();	
	if (!mac || !ie4) ready = true;
	onload_finished = true;
	eval(window.SM_onload_code);
			
	if (opera) operaResizeHandler();
	
}


function undoImg(uid)
{
	

	if (rolloverExists[uid])
		(!ns4) ? eval("eval(qmim"+uid+")."+sethid) : getSub("menu"+uid).src = p_old[uid];	

	
	eval(eval("window.SM_hidemenu_code"+uid));	
}


function hlundo(menu)
{
	if (menu.lasthl!=null && menu.stickhl==null) hlundohide(menu);
}


function positionAll()
{
	
	for (i=0;i<mainCount;i++)
	{
		
		if (!ns4)
			positionMain(i);
		
		
		if (subExists[i]) 
			positionSubs(i, true);
		else if (ns4) 
			positionMain(i);
	
	}
	

	for (i=0;i<t_mc.length;i++)
		positionSubs(t_mc[i], false);

}


function goTourl(index)
{

	eval(eval("window.SM_clickitem_code"+index));

	if (!eval("window.SM_url"+index)) return;

	if (eval("window.SM_urltarget"+index))
		where = eval("SM_urltarget"+index);
	else
		where = SM_urltarget;
	

	if (where.length<1 || where.toLowerCase()=="_self")
		window.location.href = eval("SM_url"+index);	
	else
	{
		if (where.toLowerCase().indexOf("_parent")>-1)
			eval("parent.window.location = SM_url"+index);
		else if (where.toLowerCase().indexOf("_new")<0)
			eval("parent."+where+".location = SM_url"+index);
		else
			window.open(eval("SM_url"+index));	
	}

}


function getCoords(coords)
{

	var arxy = new Array(0,0);
	var txy = coords.indexOf(",");
	if (txy!=-1)
	{
		arxy[0] = parseInt(coords.substring(0,txy));
		arxy[1] = parseInt(coords.substring(txy+1));
	}			
	
	return arxy;
}


function getNumMain()
{
	realmain = 0;
	nummain1 = 0;
	nummain2 = 0;

	while (eval("window.SM_subtext"+nummain1+"_0")) 
		nummain1++;
	
	while (eval("window.SM_rollover_image"+nummain2)) 	
		nummain2++;
	
	(nummain2>nummain1) ? realmain = nummain2 : realmain  = nummain1;
	
	subExists = new Array(realmain);
	rolloverExists = new Array(realmain);
	for (e=0;e<realmain;e++)
	{
		(eval("window.SM_subtext"+e+"_0")) ? subExists[e] = true : subExists[e] = false;
		(eval("window.SM_rollover_image"+e)) ? rolloverExists[e] = true : rolloverExists[e] = false;	
	}


	return realmain;
}

function showStatusText(hide, id)
{
	
        if (!hide)
	{

		if (!(tval = eval("window.SM_status_text"+id)))
		{
			t1val = eval("window.SM_url"+id);
			if ((eval("window.SM_show_urls_statusbar")) && (t1val)) tval = t1val;
		}
		if (tval)
		{
			status = tval;
			status_shown = true;
			return;
		}
	
	}
	
	if (status_shown)
	{
		status = "";
		status_shown = false;
	}

}
