/**********************************************************************/
// PS: Ensure commonvars.js is attached before this
// Cascading Menus for Standard GE Corporate Top Navbar
// By Narasimha Murthy SS, GE Consumer & Industrial
// Oct 2006
/**********************************************************************/
//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; z-index:1;}';
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 += '</style>';
document.write(ourStyles);
//fnBuildMenu(mNum) returns the html for a single menu.
function fnBuildMenu(mNum) {
  var temp;
  mArr = dropDownLink[mNum];
  mWidth = "width:"+menuLink[mNum].width+"px;";                      // a CSS style width statement string
  mLeft = (menuLink.left)?"margin-left:"+menuLink.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
  if (mArr != null && mArr.length>0) {
    for (mItem=0; mItem<mArr.length; mItem++) {                           // loop through this sub-array
      temp = (mArr[mItem].target=='' ? '': ' target=_blank ');
      menuString += '<a href="' + mArr[mItem].url + '" class="ddcell" id="m'+mNum+'-' + mArr[mItem].name + '" ' + temp + ' style="' + mWidth + '">' + mArr[mItem].name + '</a>';
    }
    menuString += '</div>';
  }
  else {
    menuString = '';
  }
  return menuString;
}
function fnDefineMenus() {
  var tempObj = null;
  var tempStr = '';
  //a test for final Parent object that's supposed to spawn a menu
  if (cbt!=0 && !document.getElementById(menuLink[idxResources].refid)) {
    fred = setTimeout("fnDefineMenus()",500);  //if it doesn't exist yet, wait a bit longer 
  } 
  else if (cbt!=0) {
    for (men in menuLink) {
      tempObj = document.getElementById(menuLink[men].refid); //get obj ref. to this menu's Parent Object
      tempStr = fnBuildMenu(men);     //build menu HTML string and add it to Parent Object's HTML
      if (tempStr != '') {
        tempObj.innerHTML += tempStr;
        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";
  menObj.style.zIndex = "1000";
}
function fnCloseMen() {
  menObj = this.getElementsByTagName('div')[0];  // Our menu is the first div within the Parent Object (this)
  menObj.style.visibility = "hidden";
  menObj.style.zIndex = "0";
}
//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
/*********************************************/

