/**********************************************************************/
// Cascading Menus for Standard GE Corporate Top Navbar
// By Matthew Rasnake and Scott Henderson, GE Consumer & Industrial
// Revision and Adaption by Khamla Saenglongma, GE Inspection Technologies
// January 2006
/**********************************************************************/


//Create the only array we'll need.
geMenuArray = new Array();

/* The first menu */
geMenuArray[0] = [
			"超声检测||http://www.geinspectiontechnologies.cn/productscn/ut/index.html",
			"工业内窥镜||http://www.geinspectiontechnologies.cn/productscn/rvi/index.html",
			"X射线产品||http://www.geinspectiontechnologies.cn/productscn/xr/index.html",
			"涡流产品||http://www.geinspectiontechnologies.cn/productscn/ec/index.html",
			"硬度计||http://www.geinspectiontechnologies.cn/productscn/ht/index.html",
			"光学系统||http://www.geinspectiontechnologies.cn/productscn/metrolody/index.html",
             ];
geMenuArray[0]['id']    = "menuProducts"; // 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] = [
			"航空航天||http://www.geinspectiontechnologies.cn/applicationsCn/aerospace/index.html",
			"汽车||http://www.geinspectiontechnologies.cn/applicationsCn/automotive/index.html",
			"石油天然气||http://www.geinspectiontechnologies.cn/applicationsCn/oilgas/index.html",
			"电力||http://www.geinspectiontechnologies.cn/applicationsCn/powergen/index.html",
             ];
geMenuArray[1]['id']    = "menuIndustry";
geMenuArray[1]['width'] = "125";
geMenuArray[1]['left']  = "";




/* The fourth menu */
geMenuArray[3] = [
"公司介绍||http://www.geinspectiontechnologies.cn/aboutusCn/company/index.html",
"领导层（英文）||http://www.geinspectiontechnologies.com/en/aboutus/company/executive_bios.html",
"新闻中心||http://www.geinspectiontechnologies.cn/aboutuscn/press/index.html",
"质量（英文）||http://www.geinspectiontechnologies.com/en/aboutus/company/quality.html",
"环境,健康,安全（EHS）||http://www.geinspectiontechnologies.cn/aboutuscn/ehs/index.html",
"联系我们||http://www.geinspectiontechnologies.cn/aboutuscn/contact/contactus.html",
"展会信息||http://www.geinspectiontechnologies.cn/aboutuscn/tradeshow.html",
"人员招聘||http://www.geinspectiontechnologies.cn/aboutuscn/career/careers.html", 
"公司期刊||http://www.geinspectiontechnologies.cn/clarity/menu.htm",
"下载中心||http://www.geinspectiontechnologies.cn/aboutuscn/download/index.html",

             ];
geMenuArray[3]['id']    = "menuAboutUs";
geMenuArray[3]['width'] = "140";
geMenuArray[3]['left']  = "";

/* You should not have to edit below this line */
/***********************************************/


//Write additional styles required for menus.
ourStyles = '<style type="text/css">';
ourStyles += 'div.ddmenu {position:absolute; margin-top:4px; visibility:hidden; text-transform:none; border-top:1px solid #CCCCCC;}';
ourStyles += 'a.ddcell {background-color:#F7F7F7; border:1px solid #CCCCCC; border-top:0px; padding: 7px 7px 6px 8px; text-transform:none; display:block; color: #666666; text-decoration: none;}';
ourStyles += 'a.ddcell:hover {background-color: #FFFFFF; color: #A9B8DF; text-decoration: underline;}';
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";           
}
function fnCloseMen() {
  menObj = this.getElementsByTagName('div')[0];  // Our menu is the first div within the Parent Object (this)
  menObj.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
}
