/*
####################################################################
# SystematicMenu - Standards compliant popup menu script 
#
# Copyright (C) 2002 by Paul Smith (Paul@Systematic-NI.com) 
#
# This program is free software; you can redistribute it and/or 
# modify it under the terms of the GNU General Public License 
# as published by the Free Software Foundation; either version 2 
# of the License, or (at your option) any later version. 
# This program is distributed in the hope that it will be useful, 
# but WITHOUT ANY WARRANTY; without even the implied warranty of 
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
# GNU General Public License for more details. 
# You should have received a copy of the GNU General Public License 
# along with this program; if not, write to the 
# Free Software Foundation, Inc.,
# 59 Temple Place - Suite 330, 
# Boston, MA  02111-1307, USA. 
# $Id: SystematicMenu,v 1.0 2002/10/13 11:00:00
####################################################################

# Orginial code edited
# Chad Joubert
# University of Wisconsin-Green Bay Learning Technology Center
# Date: 7/23/03


This script is compliant with HTML4.01 Transitional and CSS2.
Gecko based browsers (eg Netscape 6 and Mozilla) use CSS for ALL of the menu manipulation;
IE4+ uses script to manipulate MS proprietary BOM objects, as they do not recognise some CSS2;
other browsers ignore the script block as only IE recognises script type "text/Jscript";
Browsers capable of rendering CSS but prior to Gecko eg NS4 ignore CSS code after a / * / * / line
so they leave all menu items on screen;
Browsers which do not recognise CSS or script also leave all menu items on screen;
so the menus degrade properly for older or security constrained browsers.
Nested menuitems are handled by dropping a <div class="menu"> into the list of menu items
*/

//Detect IE5.5+
var blnShow
blnShow = true;
version=0
if (navigator.appVersion.indexOf("MSIE")!=-1){
	temp=navigator.appVersion.split("MSIE")
	version=parseFloat(temp[1])
	}

if (version < 5.5){ //NON IE browser will return 0
	var agent = navigator.userAgent.toLowerCase();
	var isWindows = agent.indexOf("win") != -1;
	if (isWindows) 
		blnShow = false;
}

var inDivision;
inDivision = false;

// IE4&5 do not support hover on objects other than anchors
//the following script does for IE4&5 what the advanced css does for Gecko!
function openmenu(menutoshow){
		
	if(menutoshow.children.tags("DIV").length>0){
  		menu=menutoshow.children.tags("DIV").item(0);
  		menu.style.left=0;
  		if (blnShow)		
			menu.style.visibility="visible";
  		}
}

function leavemenu(menutohide){
  if (!inDivision){		//change from original
	if(menutohide.children.tags("DIV").length>0){
 		var newelement=event.toElement;
 		if (newelement != menutohide.children.tags("DIV").item(0)){
   			menutohide.children.tags("DIV").item(0).style.visibility="hidden";
   			inDivision = false;  //change added
		}
	}
  }
}

//changes added
function inDiv(){ inDivision = true;}

function hideThis(submenu){	inDivision = false; }
