<!--
document.getElementsByClassName = function (needle)
{
  var         my_array = document.getElementsByTagName("td");
  var         retvalue = new Array();
  var        i;
  var        j;

  for (i = 0, j = 0; i < my_array.length; i++)
  {
    var c = " " + my_array[i].className + " ";
    if (c.indexOf(" " + needle + " ") != -1)
      retvalue[j++] = my_array[i];
  }
  return retvalue;
}

function addEvent(obj, evType, fn)
{
	if (obj.addEventListener)
	{
		obj.addEventListener(evType, fn, true);
		return true;
	}
	else if (obj.attachEvent)
	{
		var r = obj.attachEvent("on"+evType, fn);
		return r;
	}
	else
	{
		return false;
	}
}

function getObj(targetName)
{
	var target = null;
	if (document.getElementById) { // NS6+
		target = document.getElementById(targetName);
	} else if (document.all) { // IE4+
		target = document.all[targetName];
	}
	
	return target;
}

function SubmenuHover()
{
	this._mousePosX = 0;
	this._mousePosY = 0;
	this._hoverItem = null;
	this._hoverContents = null;
}

SubmenuHover.prototype.init = function()
{
	
	
	var hh = this;
	var submenuItems = document.getElementsByClassName('hasSubmenu');
	
	for (var i=0; i<submenuItems.length; i++)
	{
		
		submenuItems[i].onmousemove = function(e)
		{
			if (!e) var e = window.event;
			if (e.pageX || e.pageY)
			{
				hh.mousePosX = e.pageX;
				hh.mousePosY = e.pageY;
			}
			
			else if (e.clientX || e.clientY)
			{
				hh.mousePosX = e.clientX + document.documentElement.scrollLeft;
				hh.mousePosY = e.clientY + document.documentElement.scrollTop;
			}
			hh._hoverItem = this;
			
			hh._hoverContents = document.getElementById(this.id+'Submenu');

			
			hh.move(this.id);
		}
		submenuItems[i].onmouseout = function (e)
		{
			hh.out(this.id);
		}
	}
}

SubmenuHover.prototype.move = function(menuid) {	
	if (document.getElementById("selResults"))
	document.getElementById("selResults").style.display = "none";

	//var o2 = document.all.selResults;
	//if (o2 && o2.style) o2.style.display = "none";
	// we just moused over the link again

	
	var o, bg;
	var nIndex = -1;
	var oObj = this._hoverContents;
	// search for the subcontent id in our object array
	for (var i=0; i<aSubmenu.length; i++) {
		if (aSubmenu[i]==oObj.id) {
			// we've found our index
			nIndex = i;
			break;
		}
	}
	// if we found the object in our list, clear the timeout and splice it from the array
	if (nIndex>=0) {
		clearTimeout(aTimeout[nIndex]);
		aTimeout.splice(nIndex, 1);
		aSubmenu.splice(nIndex, 1);
	}

	

	

	// make sure we show the object, in case there was no timeout before (it wasn't already showing)
	this._hoverContents.style.display = "inline";


	
	// try to change the background color of this object
	bg = "";
	
//	if (menuid.indexOf("navLink")==0) {
//		bg = "http://test.www.flwoutdoors.com/images/topBar_nav_BG_Rollover.gif";
//		o = getObj(menuid);
//		if (o) o.style.backgroundImage = "url('"+bg+"')";
//	}
//	else if (menuid.indexOf("navSubLinkHighlight")==0) {
//		o = getObj(menuid);
//		bg = "http://test.www.flwoutdoors.com/images/topbar01ContentHighlight_bgHi.gif";
//		if (o) {
//			o.style.backgroundImage = "url('"+bg+"')";
//			o.style.backgroundColor = "#FF6600";
//		}
//	}
//	else if (menuid.indexOf("navSubLink")==0) {
//		bg = "http://test.www.flwoutdoors.com/images/topbar01Content_bgHi.gif";
//		o = getObj(menuid);
//		if (o) {
//			o.style.backgroundImage = "url('"+bg+"')";
//			o.style.backgroundRepeat= "repeat-y";
//			o.style.backgroundColor = "#FDFDFD";
//		}
//	}
//	else {
//		o = getObj(menuid);
//		if (o) o.style.backgroundImage = "url('"+bg+"')";
//	}
}

SubmenuHover.prototype.out = function(menuid) {
	// we went off of the link, get the submenu contenst object
	var oObj = this._hoverContents;
	// create a new timeout to hide this object

	var command = "hidesubmenu('" + menuid + "', '" + oObj.id + "')";
	var iTimeout = setTimeout(command, 200);
	//var iTimeout = setTimeout(function () {hidesubmenu(menuid, oObj.id);}, 500);
	// add this timeout and object id to our arrays
	aTimeout[aTimeout.length] = iTimeout;
	aSubmenu[aSubmenu.length] = oObj.id;
	
	// cleanup
	this._hoverItem = null;
	this._hoverContents = null;
	
	
	if (document.getElementById("selResults"))
	document.getElementById("selResults").style.display = "inline";
	//var o = document.all.selResults;
	//if (o && o.style) o.style.display = "inline";
	
}

function hidesubmenu(menuid, submenuid) {
	// try to hide the submenu
	var o, bg;
	o = getObj(submenuid);
	if (o) o.style.display = "none";
	
	
	// try to change the background color of the menu item itself
//	bg = "";
//	if (menuid.indexOf("navLink")==0) {
//		bg = "http://test.www.flwoutdoors.com/images/topBar_nav_BG_Flat.gif";
//		o = getObj(menuid);
//		if (o) o.style.backgroundImage = "url('"+bg+"')";
//	}
	
//	else if (menuid.indexOf("navSubLinkHighlight")==0) {
//		o = getObj(menuid);
//		bg = "http://test.www.flwoutdoors.com/images/topbar01ContentHighlight_bgHi.gif";
//		if (o) {
//			o.style.backgroundImage = "url('"+bg+"')";
//			o.style.backgroundColor = "#FF6600";
//		}
//	}
//	else if (menuid.indexOf("navSubLink")==0) {
//		bg = "http://test.www.flwoutdoors.com/images/topbar01_bgFlat.gif";
//		o = getObj(menuid);
//		if (o) {
//			o.style.backgroundImage = "url('"+bg+"')";
//			o.style.backgroundRepeat= "repeat-x";
//		}
//	}
//	else {
//		o = getObj(menuid);
//		if (o) o.style.backgroundImage = "url('"+bg+"')";
//	}
}

function mouseoversubmenu(submenuid) {
	if (document.getElementById("selResults"))
	document.getElementById("selResults").style.display = "none";
	
	//var o = document.all.selResults;
	//if (o && o.style) o.style.display = "none";


	// we just moused over the submenu itself, if it's in the timeout queue to be hidden, remove it
	var nIndex = -1;
	// search for the subcontent id in our object array
	for (var i=0; i<aSubmenu.length; i++) {
		if (aSubmenu[i]==submenuid) {
			// we've found our index
			nIndex = i;
			break;
		}
	}
	// if we found the object in our list, clear the timeout and splice it from the array
	if (nIndex>=0) {
		clearTimeout(aTimeout[nIndex]);
		aTimeout.splice(nIndex, 1);
		aSubmenu.splice(nIndex, 1);
	}
}

function mouseoutsubmenu(menuid, submenuid) {
	
	if (document.getElementById("selResults"))
	document.getElementById("selResults").style.display = "inline";

	//var o = document.all.selResults;
	//if (o && o.style) o.style.display = "inline";

	
	// we just moused off the submenu, add it to the timeout queue to hide
	// create a new timeout to hide this object
	var command = "hidesubmenu('" + menuid + "', '" + submenuid + "')";
	var iTimeout = setTimeout(command, 200);
	//var iTimeout = setTimeout(function () {hidesubmenu(menuid, submenuid);}, 500);
	// add this timeout and object id to our arrays
	aTimeout[aTimeout.length] = iTimeout;
	aSubmenu[aSubmenu.length] = submenuid;
}

//var iTimeout;
//var oObj;

var aTimeout = Array();
var aSubmenu = Array();





addEvent(window, 'load', function()
{
	var hh = new SubmenuHover();
	hh.init();
});

// -->
