/////////////////////////////////////////////////////////////////////////////
// Function : menu (constructor)
// Author   : Jake Gordon
// Comments : 
/////////////////////////////////////////////////////////////////////////////
function menu(m_href, m_id, m_name)
{
	this.m_href = m_href;
	this.m_id = m_id;
	this.m_name = m_name;
	this.m_menus = new Array();

	menu.prototype.add_menu = add_menu;
	menu.prototype.reset = reset_menu;

	this.reset();
}

/////////////////////////////////////////////////////////////////////////////
// Function : add_menu
// Author   : Jake Gordon
// Comments : 
/////////////////////////////////////////////////////////////////////////////
function add_menu(m_href, m_id, m_name)
{
	var nNewIndex = this.m_menus.length;
	this.m_menus[nNewIndex] = new menu(m_href, m_id, m_name);
	return this.m_menus[nNewIndex];
}

/////////////////////////////////////////////////////////////////////////////
// Function : reset_menu
// Author   : Jake Gordon
// Comments : 
/////////////////////////////////////////////////////////////////////////////
function reset_menu()
{
	this.m_strContainerStyle = "";
	this.m_strItemStyle = "";
	this.m_strLinkStyle = "";
	this.m_strSelectedItemStyle = "";
	this.m_strSelectedLinkStyle = "";
	this.m_strPrependPath = "";
	this.m_strTarget = "_self";
	this.m_bShowDocumentsOnly = false;
	this.m_bShowNoDocuments = false;
	this.m_bShowNoDocumentsInRoot = false;
}

/////////////////////////////////////////////////////////////////////////////
// Function : is_currentdoc_me
// Author   : Jake Gordon
// Comments : 
/////////////////////////////////////////////////////////////////////////////
function is_currentdoc_me(myname)
{
   var pos = window.location.href.lastIndexOf("/");
   var docname = window.location.href.substring(pos+1, window.location.href.length);
  
   pos = myname.lastIndexOf("/");
   myname = myname.substring(pos+1, myname.length);

   if (docname == myname)
      return true;
   else
      return false;
}

/////////////////////////////////////////////////////////////////////////////
// Function : BrowserDetectionObject
// Author   : Jake Gordon
// Comments : 
/////////////////////////////////////////////////////////////////////////////
function BrowserDetectionObject()
{
	this.agt = navigator.userAgent.toLowerCase();
	this.appVersion = navigator.appVersion;
	this.majorVersion = parseInt(navigator.appVersion);
	this.minorVersion = parseFloat(navigator.appVersion) - this.majorVersion;

	this.is_ie = (this.agt.indexOf("msie") != -1);
	this.is_ns = ((this.agt.indexOf("mozilla")!=-1) &&
	              (this.agt.indexOf("spoofer")==-1) &&
	              (this.agt.indexOf("compatible") == -1) &&
	              (this.agt.indexOf("opera")==-1) &&
	              (this.agt.indexOf("webtv")==-1));

	if (this.is_ie)
	{
		this.majorVersion = parseInt(this.agt.substring(this.agt.indexOf("msie ")+5));
		this.minorVersion = parseFloat(this.agt.substring(this.agt.indexOf("msie ")+5)) - this.majorVersion;
	}
	else if (this.is_ns && (this.agt.indexOf("netscape6/") != -1))
	{
		this.majorVersion = parseInt(this.agt.substring(this.agt.indexOf("netscape6/")+10));
		this.minorVersion = parseInt(this.agt.substring(this.agt.indexOf("netscape6/")+10)) - this.majorVersion;
	}

	this.is_ns3   = (this.is_ns && (this.majorVersion == 3));
	this.is_ns4   = (this.is_ns && (this.majorVersion == 4));
	this.is_ns6   = (this.is_ns && (this.majorVersion == 6));
	this.is_ns4up = (this.is_ns && (this.majorVersion >= 4));
	this.is_ns6up = (this.is_ns && (this.majorVersion >= 6));
	this.is_ie3   = (this.is_ie && (this.majorVersion == 3));
	this.is_ie4   = (this.is_ie && (this.majorVersion == 4));
	this.is_ie5   = (this.is_ie && (this.majorVersion == 5));
	this.is_ie6   = (this.is_ie && (this.majorVersion == 6));
	this.is_ie4up = (this.is_ie && (this.majorVersion >= 4));
	this.is_ie5up = (this.is_ie && (this.majorVersion >= 5));
	this.is_ie6up = (this.is_ie && (this.majorVersion >= 6));
}

//----------------------------------------------------
// Declare a global browser detection object for use
// throughout the menu display functions
//----------------------------------------------------
var g_objBrowserDetection = new BrowserDetectionObject();
