/*****************************************/
// Cascading menus section appears last. //
/*****************************************/


//for use as copyright year
curDate = new Date();
var curYear = curDate.getFullYear();

// 2 Functions for GE Fast Search
function fnSiteSearch(fm) {
	if (fm.textToSearch.value=="") { return false; }
	return true;
}
function fnSiteSearchLink(fm) {
	if (fm.textToSearch.value != "") { fm.submit(); } 
}

// global vars
var popupWin;
var largerWin;
var largerWin2;
var largerWin3;
var glossaryWin;
var scrnwidth=screen.width;
var scrnheight=screen.height;

//NN4 window resize fix
if(!window.saveInnerWidth) {
  window.onresize = resizeIt;
  window.saveInnerWidth = window.innerWidth;
  window.saveInnerHeight = window.innerHeight;
}
function resizeIt() {
    if (saveInnerWidth < window.innerWidth || 
        saveInnerWidth > window.innerWidth || 
        saveInnerHeight > window.innerHeight || 
        saveInnerHeight < window.innerHeight ) 
    {
        window.history.go(0);
    }
}


// "only 1 open at a time" popup function //
function openPop(url,width,height,addloptions){
	var xspot=Math.round((scrnwidth/2)-(width/2));
	var yspot=Math.round((scrnheight/2)-(height/2)-30);
	features = "height="+height+",width="+width+",top="+yspot+",screenY="+yspot+",left="+xspot+",screenX="+xspot;
	if (addloptions && addloptions!="") { features += ","+addloptions; }
	if (!popupWin || popupWin.closed){
		popupWin = window.open(url, '', features);
	}
	else {
		window.popupWin.close();
		popupWin = window.open(url, '', features);
	}
}

// Function to open video gallery 
// Uses the 'openPop' function
function openVideoGalleryPopup(url) {
	openPop(url, 780, 620, 'scrollbars,resizable');
}

//	NORMAL Function to View Larger Image.
//	Opens window which contains only a 500 x 500 image
function openLarger(imgurl,imgalt) {
	var xspot=Math.round((scrnwidth/2)-(250));
	var yspot=Math.round((scrnheight/2)-(280));
	if (!largerWin || largerWin.closed) {
		largerWin = window.open("","","width=500,height=500,top="+yspot+",screenY="+yspot+",left="+xspot+",screenX="+xspot);
	}
	else {
		window.largerWin.close();
		largerWin = window.open("","","width=500,height=500,top="+yspot+",screenY="+yspot+",left="+xspot+",screenX="+xspot);
	}
	drawstr =  '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">';
	drawstr += '<html><head><title>'+imgalt+'</title></head>';
	drawstr += '<body bgcolor="white" marginheight="0" marginwidth="0" topmargin="0" leftmargin="0">';
	drawstr += '<img src="';
	drawstr += imgurl;
	drawstr += '" width="500" height="500" border="0" alt="';
	drawstr += imgalt;
	drawstr += '">';
	drawstr += '</body></html>';
	largerWin.document.open();
	largerWin.document.write(drawstr);
	largerWin.document.close();
}


//	Function to View Larger Fluorescent (HORIZONTAL) Image.
//	Opens window which contains only a ????? x 128 image
function openLarger2(imgurl,imgalt) {
	var xspot=Math.round((scrnwidth/2)-(250));
	var yspot=Math.round((scrnheight/2)-(100));
	if (!largerWin2 || largerWin2.closed) {
		largerWin2 = window.open("","","scrollbars,width=500,height=150,top="+yspot+",screenY="+yspot+",left="+xspot+",screenX="+xspot);
	}
	else {
		window.largerWin2.close();
		largerWin2 = window.open("","","scrollbars,width=500,height=150,top="+yspot+",screenY="+yspot+",left="+xspot+",screenX="+xspot);
	}
	drawstr =  '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">';
	drawstr += '<html><head><title>'+imgalt+'</title></head>';
	drawstr += '<body bgcolor="white" marginheight="0" marginwidth="0" topmargin="0" leftmargin="0">';
	drawstr += '<img src="';
	drawstr += imgurl;
	drawstr += '" height="128" border="0" alt="';
	drawstr += imgalt;
	drawstr += '">';
	drawstr += '</body></html>';
	largerWin2.document.open();
	largerWin2.document.write(drawstr);
	largerWin2.document.close();
}

//	Function to View Larger Fluorescent (VERTICAL) Image.
//	Opens window which contains only a 303 x ?????? image
function openLarger3(imgurl,imgalt) {
	var xspot=Math.round((scrnwidth/2)-(160));
	var yspot=Math.round((scrnheight/2)-(280));
	if (!largerWin3 || largerWin3.closed) {
		largerWin3 = window.open("","","scrollbars,width=323,height=500,top="+yspot+",screenY="+yspot+",left="+xspot+",screenX="+xspot);
	}
	else {
		window.largerWin3.close();
		largerWin3 = window.open("","","scrollbars,width=323,height=500,top="+yspot+",screenY="+yspot+",left="+xspot+",screenX="+xspot);
	}
	drawstr =  '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">';
	drawstr += '<html><head><title>'+imgalt+'</title></head>';
	drawstr += '<body bgcolor="white" marginheight="0" marginwidth="0" topmargin="0" leftmargin="0">';
	drawstr += '<img src="';
	drawstr += imgurl;
	drawstr += '" width="303" border="0" alt="';
	drawstr += imgalt;
	drawstr += '">';
	drawstr += '</body></html>';
	largerWin3.document.open();
	largerWin3.document.write(drawstr);
	largerWin3.document.close();
}


function closepopups(){
	if (popupWin && popupWin.open){
		window.popupWin.close();
	}
	if (largerWin && largerWin.open){
		window.largerWin.close();
	}
	if (largerWin2 && largerWin2.open){
		window.largerWin2.close();
	}
	if (largerWin3 && largerWin3.open){
		window.largerWin3.close();
	}
	if (glossaryWin && glossaryWin.open){
		window.glossaryWin.close();
	}
}

// function linktoOpener(url) is called from popups. Places url in opener, and closes popup. 
function linktoOpener(url) {
	if(self.opener) {
		self.opener.top.document.location=url;
		self.opener.focus();
		self.close();
	} else {
		self.top.document.location=url;
		self.focus();
	}
}

// turnonTab() sniffs the document location and turns on the appropriate tab in the navbar.
// Used on HOME LIGHTING site
function turnonTab () {
	var currurl = document.location.href + "";
	var tabid = null;
	if (currurl.indexOf("/products/") != -1) {
		tabid = "gelheader_link_1";
	}
	if (currurl.indexOf("/LightProducts/") != -1) {
		tabid = "gelheader_link_1";
	}
	if (currurl.indexOf("/design_with_light/") != -1) {
		tabid = "gelheader_link_2";
	}
	if (currurl.indexOf("coupons") != -1) {
		tabid = "gelheader_link_3";
	}
	if (tabid != null && document.getElementById) {
		var el = document.getElementById(tabid);
		if (el) {
			el.className = "gelheader_selected";
		}
	}
}

// turnonTab2() sniffs the document location and turns on the appropriate tab in the navbar.
// Used on COMMERCIAL LIGHTING site -- all except its home page where navbar is hard coded to have "home" selected.
function turnonTab2() {
	var currurl=document.location+"";
	var locindex="0";
	if(currurl.indexOf("/products/") != -1) { locindex="1"; }
	if(currurl.indexOf("/education_resources/") != -1) { locindex="2"; }
	if(currurl.indexOf("/lighting_applications/") != -1) { locindex="3"; }
	if(locindex!="0" && document.getElementById) {
		document.getElementById("navbarCell_"+locindex).className="selected";
		document.getElementById("navbarImg_"+locindex).src="/na/business_lighting/imgs/nav1Link_selected.gif";
	}
}

// needforSubmit() builds INFM URL from two select elements and redirects user to INFM page
function needforSubmit() {
	var infm_url = "/na/home_lighting/infm/";
	var form = document.needforForm;
	var Ineed = form.needSel.options[form.needSel.selectedIndex].value;
	var ForMy = form.forSel.options[form.forSel.selectedIndex].value;
	infm_url = infm_url + Ineed + "_" + ForMy + ".htm";
	document.location = infm_url;
}

// setINFMform() reads URL and sets select elements of INFM form to reflect the current page
function setINFMform() {
	var curl = unescape(document.location);
	if (curl.indexOf("/infm/")!=-1) {
		var infm = curl.slice((curl.indexOf('/infm/')+6),curl.indexOf('.htm'));
		var infm_arr = infm.split("_");
		var form = document.needforForm;
		form.needSel.selectedIndex = (infm_arr[0]=="light")?0:(infm_arr[0]=="life")?1:2;
		for(i=0;i<6;i++) {
			if (form.forSel.options[i].value == infm_arr[1]) {
				form.forSel.selectedIndex = i;
			}
		}
	}
}

/* SELECT ELEMENT NAVIGATION */
/* selectNav function -- a select (dropdown) element navigation function
   called from onChange event of select element,
   i.e. onChange="selectNav('formName','archive');"
   where 'formName' is the id/name of the containing form, and
   where 'archive' is the id/name of the specific select element to be tested.
   the value of the option elements should be the target URLs.
*/
function selectNav(form,fName) {
  fRef = eval('top.document.'+form);
  var selIdx = fRef[fName].selectedIndex 
  var selURL = fRef[fName].options[selIdx].value 
  document.location = selURL;
}

/* setSelected function -- sets select element navigation dropdown to reflect the current page
   called inline after the code for the select element navigation,
   i.e. within a javascript code block
      setSelected(top.document.formName,'archive');
   where 'archive' is the name of the specific select element to be effected
   the value of the option elements will be compared to the current URL and, if an option matches, it will be set as selected.
*/
function setSelected(form,fName) {
  fRef = eval('top.document.'+form);
	var curl = unescape(document.location);
  i = curl.indexOf('/na/');
  curl = curl.slice(i);
  for(i=0;i<fRef[fName].options.length;i++) {
    if (fRef[fName].options[i].value.indexOf(curl)>=0) {
      fRef[fName].options[i].selected = true;
      break;
    }
  }
}
/* END SELECT ELEMENT NAVIGATION */


/*  Edison Awards openPop wrapper function */
  function eaPop(url) {
    openPop("/na/business_lighting/edison_award/" + url,"710","550","resizable,scrollbars");
  }
/*/Edison Awards openPop wrapper function */


/* Learn About Light's Distribution Curves openPop wrapper function */
function openCurve(idx) {
	openPop("/na/business_lighting/education_resources/learn_about_light/pop_curves.htm?"+idx,"710","520","resizable,scrollbars");
}
/*/Learn About Light Distribution Curves openPop wrapper function */


/* COMMERCIAL Glossary opener function */
/* Calls absolutely so it can be used within ecatalog also */
/* Cannot use generic openPop because of feature override behavior */
function openGlossary(anchr) {
	if (!glossaryWin || glossaryWin.closed){
		glossaryWin = window.open("http://www.gelighting.com/na/business_lighting/education_resources/glossary.htm#"+anchr,"","width=770,height=300,resizable,scrollbars,toolbar,location,status,top=1,screenY=1,left=1,screenX=1");
	}
	else {
		glossaryWin.focus();
		glossaryWin.document.location = "http://www.gelighting.com/na/business_lighting/education_resources/glossary.htm#"+anchr;
	}
}
/*/Glossary opener function */

/* image switcher function for Edison Awards Winners pop-up pages */
/* does show/hide on divs rather than a src swap, because images can be different sizes */
/* assumes first image is visible by default */
visible="1";
function switchImage(num) {
  if (num!=visible) {
    document.getElementById('switchBox'+visible).style.display = 'none';
    document.getElementById('switchBox'+num).style.display = 'block';
    visible = num;
  }
}
/* image switcher */



// Function to get a value from URL
function getValueFromURL(paramName) {
  var regexS = "[\\?&'&amp;']"+ paramName +"=([^&#]*)";
  var regex = new RegExp( regexS );
  var tmpURL = window.location.href;
  var results = regex.exec( tmpURL );

  if( results == null )
    return "";
  else
    return results[1];
}


/******************************************************************************
FOR CLIENTSIDE INCLUDE -- Code ALSO in /na/scripts/client_side_include.js

	This code based on example code found at
	http://www.boutell.com/newfaq/creating/include.html, with some
	modifications.  It works with Firefox, Safari, and IE 5+.  So
	saith a notice at the bottom of that page:

		Legal Note: yes, you may use sample HTML, Javascript, PHP and
		other code presented above in your own projects. You may not
		reproduce large portions of the text of the article without
		our express permission.

	Modification: Boutell's code requires a div to be inserted before
	calling this function.  This one doesn't.

	Caveat: <style> elements within the include files won't work.

******************************************************************************/

function clientSideInclude(url) {
	var req = false;
	if (window.XMLHttpRequest) {
		// For Safari, Firefox, and other non-MS browsers
		try {
			req = new XMLHttpRequest();
		} catch (e) {
			req = false;
		}
	} else if (window.ActiveXObject) {
		// For Internet Explorer on Windows
		try {
			req = new ActiveXObject("Msxml2.XMLHTTP");
		} catch (e) {
			try {
				req = new ActiveXObject("Microsoft.XMLHTTP");
			} catch (e) {
				req = false;
			}
		}
	}
	if (req) {
		// Synchronous request, wait till we have it all
		req.open('GET', url, false);
		var failure = false;
		try {
			req.send(null);
		} catch (e) {
			failure = true;
		}
		if (!failure) {
			document.write("<div class='includedViaClientSideInclude'>");
			document.write(req.responseText);
			document.write("</div>");
		}
	} else {
		/* compatibility warning */
		//	element.innerHTML =
		//		"Sorry, your browser does not support " +
		//		"XMLHTTPRequest objects. This page requires " +
		//		"Internet Explorer 5 or better for Windows, " +
		//		"or Firefox for any system, or Safari. Other " +
		//		"compatible browsers may also exist.";
	}
}

/******************************************************************************

	The following code is more tru to the original function found at
	http://www.boutell.com/newfaq/creating/include.html. We have chosen to
	include this function as well because it allows for the ability to 
	'hot swap' include files, in a very AJAX-esque way.	It works with Firefox, 
	Safari, and IE 5+.  So saith a notice at the bottom of that page:

		Legal Note: yes, you may use sample HTML, Javascript, PHP and
		other code presented above in your own projects. You may not
		reproduce large portions of the text of the article without
		our express permission.

	Boutell's code requires an IDed div to be inserted before
	calling this function. 
	
	Modification: Implemented better error checking, such as that included
	in the modified function above.

	Caveat: <style> elements within the include files won't work.

******************************************************************************/

function clientSideIncludeInto(id, url) {
  var req = false;
  // For Safari, Firefox, and other non-MS browsers
  if (window.XMLHttpRequest) {
    try {
      req = new XMLHttpRequest();
    } catch (e) {
      req = false;
    }
  } else if (window.ActiveXObject) {
    // For Internet Explorer on Windows
    try {
      req = new ActiveXObject("Msxml2.XMLHTTP");
    } catch (e) {
      try {
        req = new ActiveXObject("Microsoft.XMLHTTP");
      } catch (e) {
        req = false;
      }
    }
  }
 var element = document.getElementById(id);
 if (!element) {
  //alert("Bad id " + id +
  // "passed to clientSideInclude." +
  // "You need a div or span element " +
  // "with this id in your page.");
  return;
 }
  if (req) {
    // Synchronous request, wait till we have it all
    req.open('GET', url, false);
    var failure = false;
	try {
		req.send(null);
	} catch (e) {
		failure = true;
	}
	if (!failure) {
	    element.innerHTML = req.responseText;
	}
  } else {
    //element.innerHTML =
    //  "Sorry, your browser does not support " +
    //  "XMLHTTPRequest objects. This page requires " +
    //  "Internet Explorer 5 or better for Windows, " +
    //  "or Firefox for any system, or Safari. Other " +
    //  "compatible browsers may also exist.";
  }
}


/* This function can be run at any point after the left nav is dropped into the page.
   It will compare the left nav HREFs to the page URL and assign a class of selected
   to the appropriate left nav list item. To force a left nav item to be selected,
   first give it a unique id and then pass that ID into the function.
*/
function leftNavSelector(optionalID) {
// page URL after '.com' directory (for URL matching purposes)
var pageSubURL = document.location.href.split("/na/")[1];
var pageSubURL = pageSubURL.split("?")[0];
var pageSubURL = pageSubURL.split("#")[0];

try {
	if(!optionalID) {
		leftNavDiv = document.getElementById("nav2");
		aArray = leftNavDiv.getElementsByTagName("a");
		for(var i = 0; i < aArray.length; ++i) {
			var testHref = aArray[i].href.split("/na/")[1];
			if(pageSubURL == testHref) {
				// set as selected
				aArray[i].parentNode.className += " selected";
				break;
			} // if(pageSubURL ==...
		}// for i
	} else {
		document.getElementById(optionalID).className += " selected";
	}// else
} catch(err) {}
}



/**********************************************************************/
// Cascading Menus for Standard GE Corporate Top Navbar
// By Matthew Rasnake and Scott Henderson, GE Consumer & Industrial
// March 2005
/**********************************************************************/

var menuBaseHref = "";

//if NOT teamsite AND NOT www.gelighting, make menuBaseHref absolute
hoststring=window.location.host.toLowerCase();
if(hoststring.indexOf('teamsite') == -1 && hoststring.indexOf('www.gelighting') == -1) {
	menuBaseHref = "http://www.gelighting.com";
}

//Create the only array we'll need.
geMenuArray = new Array();

/* All calls are absolute b/c it must be used within ecatalog & search results also */
/* The first menu */
geMenuArray[0] = [
				"Incandescent||http://genet.gelighting.com/LightProducts/Dispatcher?REQUEST=CATEGORYPAGE&PRODUCTLINE=Lamps_Incandescent&CHANNEL=Commercial",
				"Halogen||http://genet.gelighting.com/LightProducts/Dispatcher?REQUEST=CATEGORYPAGE&PRODUCTLINE=Lamps_Halogen&CHANNEL=Commercial",
				"High Intensity Discharge||http://genet.gelighting.com/LightProducts/Dispatcher?REQUEST=CATEGORYPAGE&PRODUCTLINE=Lamps_High%20Intensity%20Discharge&CHANNEL=Commercial",
				"Linear Fluorescent||http://genet.gelighting.com/LightProducts/Dispatcher?REQUEST=CATEGORYPAGE&PRODUCTLINE=Lamps_Linear%20Fluorescent&CHANNEL=Commercial",
				"Compact Fluorescent||http://genet.gelighting.com/LightProducts/Dispatcher?REQUEST=CATEGORYPAGE&PRODUCTLINE=Lamps_Compact%20Fluorescent&CHANNEL=Commercial",
				"LED||"+menuBaseHref+"/na/business_lighting/products/led/",
				"Miniature||http://genet.gelighting.com/LightProducts/Dispatcher?REQUEST=CATEGORYPAGE&PRODUCTLINE=Lamps_Miniature&CHANNEL=Commercial",
				"Sealed Beam||http://genet.gelighting.com/LightProducts/Dispatcher?REQUEST=CATEGORYPAGE&PRODUCTLINE=Lamps_Sealed%20Beam&CHANNEL=Commercial",
				"Automotive||http://genet.gelighting.com/LightProducts/Dispatcher?REQUEST=AUTOMOTIVE&PRODUCTLINE=Automotive&CHANNEL=Commercial",
				"Specialty||http://genet.gelighting.com/LightProducts/Dispatcher?REQUEST=SPECIALTY&PRODUCTLINE=Specialty&CHANNEL=Commercial",
				"Ballasts||http://genet.gelighting.com/LightProducts/Dispatcher?REQUEST=BALLASTLANDINGPAGE&PRODUCTLINE=Ballasts&CHANNEL=Commercial"
             ];
geMenuArray[0]['id']    = "navbarCell_1"; // id of Parent object for this menu
geMenuArray[0]['width'] = "125";          // width of this menu
geMenuArray[0]['left']  = "";             // left offset (positive or negative)

/* The second menu */
geMenuArray[1] = [
				"Conferences||"+menuBaseHref+"/na/business_lighting/education_resources/conferences/",				
				"GE Edison Awards||"+menuBaseHref+"/na/business_lighting/edison_award/",
				"Learn About Light||"+menuBaseHref+"/na/business_lighting/education_resources/learn_about_light/",
				"Lighting Glossary||"+menuBaseHref+"/na/business_lighting/education_resources/glossary.htm",
				"Lighting Specifiers||"+menuBaseHref+"/na/business_lighting/education_resources/lighting_specifiers/",
				"Literature Library||"+menuBaseHref+"/na/business_lighting/education_resources/literature_library/",
				"Product Warranties||http://genet.gelighting.com/LightProducts/html/warranties.htm",
				"Tools / Software||"+menuBaseHref+"/na/business_lighting/education_resources/tools_software/",
				"Video Gallery||javascript:openVideoGalleryPopup('"+menuBaseHref+"/na/videos/');"
             ];
geMenuArray[1]['id']    = "navbarCell_2";
geMenuArray[1]['width'] = "115";
geMenuArray[1]['left']  = "";

/* The third menu */
geMenuArray[2] = [
				"Hospitality||"+menuBaseHref+"/na/business_lighting/lighting_applications/hospitality/",
				"Restaurant||"+menuBaseHref+"/na/business_lighting/lighting_applications/restaurant/",
				"Healthcare||"+menuBaseHref+"/na/business_lighting/lighting_applications/healthcare/",
				"Retail||"+menuBaseHref+"/na/business_lighting/lighting_applications/retail/",
				"Facility Management||"+menuBaseHref+"/na/business_lighting/lighting_applications/property_management/",
				"Warehouse / Industrial||"+menuBaseHref+"/na/business_lighting/lighting_applications/warehouse/",
				"Government||http://www.geconsumerandindustrial.com/environmentalinfo/regulations_resources/government_information_center.htm"
             ];
geMenuArray[2]['id']    = "navbarCell_3";
geMenuArray[2]['width'] = "115";
geMenuArray[2]['left']  = "";


//Write additional styles required for menus.
ourStyles = '<style type="text/css">';
ourStyles += 'div.ddmenu {position:absolute; margin-top:7px; visibility:hidden; text-transform:none; border-top:1px solid #CCCCCC;}';
ourStyles += 'a.ddcell       {background-color:#F7F7F7; border:1px solid #CCCCCC; border-top:0px; padding: 6px 7px 6px 8px; text-transform:none; display:block;}';
ourStyles += 'a.ddcell:hover {background-color: #FFFFFF;}';
ourStyles += 'div.ddmenu { z-index: 10001; }'; /* fixes an iframe obscuring the menus in firefox. */
ourStyles += '</style>';
document.write(ourStyles);


//fnBuildMenu(mNum) returns the html for a single menu.
function fnBuildMenu(mNum) {
	mArr = geMenuArray[mNum];
	mWidth = "width:"+mArr.width+"px;";                      // a CSS style width statement string
	mLeft = (mArr.left)?"margin-left:"+mArr.left+"px;":"";   // a CSS style left-margin statement string
	menuString =  '<br><div id="menudiv'+mNum+'" class="ddmenu" style="'+mWidth+mLeft+'">'; // start menuString with opening DIV
	for (mItem in mArr) {                           // loop through this sub-array
		if (parseInt(mItem)||(parseInt(mItem)==0)) {  // if array item name is a number (i.e. it's not "id" or "width")
			linky = mArr[mItem].split('||');            // split the contents of this array item to get Link Text and Link URL
			menuString += '<a href="'+linky[1]+'" class="ddcell" id="m'+mNum+'-'+mItem+'" style="'+mWidth+'">'+linky[0]+'</a>'; // add this menu item to HTML DIV string
		}
	}
	menuString += '</div>';                         // close HTML DIV string
	return menuString;                              // return the constructed Menu HTML 
}

//fnDefineMenus() uses fnBuildMenu to create the HTML, insert it into the page, and attach event listeners to the Parent Objects  
function fnDefineMenus() {
	if(!document.getElementById(geMenuArray[geMenuArray.length-1].id)) { //a test for final Parent object that's supposed to spawn a menu
		fred = setTimeout("fnDefineMenus()",500);  //if it doesn't exist yet, wait a bit longer
	} else {
		for (men in geMenuArray) {                      // loop through main menu Array
	  		tempObj = document.getElementById(geMenuArray[men].id); //get obj ref. to this menu's Parent Object
	  		tempObj.innerHTML  += fnBuildMenu(men);     //build menu HTML string and add it to Parent Object's HTML
	  		tempObj.onmouseover = fnOpenMen;          //define Parent Object's mouseover event to call fnOpenMen
	  		tempObj.onmouseout  = fnCloseMen;         //define Parent Object's mouseout event to call fnCloseMen
    		}
	}
}

function fnOpenMen() {
	menObj = this.getElementsByTagName('div')[0];  // Our menu is the first div within the Parent Object (this)
	menObj.style.visibility = "visible";

	/* in IE, select boxes overlap everything, no matter what you set
	their z-index to, so we create iframes, which somehow *do* overlap
	select boxes, under the menus. */

	var iframeIsNew = !menObj.iframe;
	if (iframeIsNew) {
		menObj.iframe = document.createElement("iframe");
	}

	var iframe = menObj.iframe;
	iframe.style.position = "absolute";

	/* It turns out that in some cases, the iframe's containing block for
	positioning purposes ends up being the <body> due to lack of a
	position attribute on any of its ancestors, so we recompute the
	position each time we display the menu, incase the browser is resized
	horizontally. */
	var x = menObj.offsetLeft;
	var y = menObj.offsetTop;
	var w = menObj.offsetWidth;
	var h = menObj.offsetHeight;
	iframe.style.top    = y + "px";
	iframe.style.left   = x + "px";
	iframe.style.width  = w + "px";
	iframe.style.height = h + "px";
	
	if (iframeIsNew) {
		menObj.parentNode.insertBefore(iframe, menObj);
	}

	menObj.iframe.style.visibility = "visible";
}

function fnCloseMen() {
	menObj = this.getElementsByTagName('div')[0];  // Our menu is the first div within the Parent Object (this)
	menObj.style.visibility = "hidden";
	if (menObj.iframe) {
		menObj.iframe.style.visibility = "hidden";
	}
}

//Let's get things started!!
//We're NOT using document.onload -- It could conflict with an onload already in the BODY tag.
if (document.getElementsByTagName) { // if we're DOM capable
	fnDefineMenus();  //start _trying_ to define menus
}

/*********************************************/
// Cascading Menus Section Ended
/*********************************************/

/**********************************************************/
// This should be the end.
// Place any/all new stuff ABOVE the menus section please.
/**********************************************************/
