var menu1_items = [
	['主页', 'http://www.gcchina.com.cn/index.htm', ''],
	['公司', 'http://www.gcchina.com.cn/company/index.htm', '',
		['简介', 'http://www.gcchina.com.cn/company/index.htm',''],
		['历史', 'http://www.gcchina.com.cn/company/history.htm',''],
		['经营理念', 'http://www.gcchina.com.cn/company/message.htm',''],
		['客户相关', 'http://www.gcchina.com.cn/company/rwc.htm',''],
		['公司全景', 'http://www.gcchina.com.cn/company/profile.htm',''],
		['社会背景', 'http://www.gcchina.com.cn/company/rws.htm',''],
		['质量认证', 'http://www.gcchina.com.cn/company/quality.htm',''],
		['环境保护', 'http://www.gcchina.com.cn/company/cte.htm',''],
		['经营哲学', 'http://www.gcchina.com.cn/company/philosophy.htm',''],
		['全球网站', 'http://www.gcchina.com.cn/company/global.htm',''],
	],
	['新闻', 'http://www.gcchina.com.cn/news/', ''],
	['产品', 'http://www.gcchina.com.cn/products/', '',
		['临床产品', '', '',
			['MI微创概念产品', '', '',
				['MI口腔预防产品', '', '',
					['GC Tooth Mousse-GC护牙素（不含氟）', 'http://www.gcchina.com.cn/products/index.htm', ''],
					['GC Tooth Mousse Plus-GC护牙素（含氟）', '', ''],
					['GC Dry Mouse-GC干口胶', '', ''],
				],
				['MI龋病危险评估产品', '', '',
					['GC SALIVA-CHECK MUTANS-GC临床用唾液变形链球菌测试产品', '', ''],
					['GC Plaque-Check +PH-GC临床用菌斑测试产品', '', ''],
					['GC Saliva-Check BUFFER-GC临床用唾液缓冲测试产品', '', ''],
				],
				['MI口腔保护产品', '', '',
					['GC Fuji VII-富士VII型玻璃离子牙体保护剂', '', ''],
				],
			],
			['玻璃离子水门汀', '', '',
				['充填产品', '', '',
					['GC Fuji IX / Capsule-而至后牙可填压高强度玻璃离子/胶囊', '', ''],
					['GC Miracle Mix-而至银粉玻璃离子', '', ''],
					['GC Fuji II-而至通用型玻璃离子充填材料', '', ''],
					['GC Fuji II LC / Capsule-而至光固化树脂改良型玻璃离子/胶囊', '', ''],
				],
				['水门汀粘固剂', '', '',
					['GC FUJI I / Capsule-而至富士I型玻璃离子粘固剂/胶囊', '', ''],
					['GC LIVCARBO-而至聚羧酸锌水门汀', '', ''],
					['GC Fuji Plus / Capsule而至多功能树脂加强型玻璃离子水门汀粘固剂/胶囊', '', ''],
					['GC Fuji Ortho LC-而至光固化树脂改良型玻璃离子正畸粘结剂', '', ''],
					['GC Fuji Cem-而至双膏剂树脂加强型玻璃离子水门汀粘固剂', '', ''],
				],
			],
			['树脂类及相关产品', '', '',
				['Gradia Direct-混合微填料型纳米复合树脂', '', '',],
				['Gradia Direct Flo-光固化混合型纳米流动树脂', '', '',],
				['Gradia Direct LoFlo-光固化高粘度混合型纳米流动树脂', '', '',],
				['GC G-BOND - 第七代一步法自酸蚀复合树脂粘接剂', '', '',],
			],
			['印模材料', '', '',
				['硅橡胶', '', '',
					['GC EXAFINE-GC亲水性附加型硅橡胶套装（手调型）', '', ''],
					['GC EXAMIXFINE-GC亲水性附加型硅橡胶套装（自调型）', '', ''],
				],
				['检测产品', '', '',
					['GC FIT CHECKER-GC 贴合点指示剂', '', ''],
				],			],
			['临时性冠桥材料', '', '',
				['GC Unifast Trad - 快速自凝基托树脂', '', '',],
				['GC TEMPRON - 自固化临时冠桥树脂', '', '',],
],
			['其它临床产品', '', '',
				['GC CAVITON-GC暂封王', '', ''],
				['GC NEW METAL STRIPS-金属打磨条', '', ''],
				['GC SOFT-LINER - 软衬', '', ''],
			],
		],
		['技工产品', '', ''],
	],
	['MI微创专题', 'http://www.gcchina.com.cn/events/', ''],
	['下载', 'http://www.gcchina.com.cn/download/', '',
		['GC产品说明书', 'http://www.gcchina.com.cn/download/index.htm',''],
		['GC产品宣传彩页', 'http://www.gcchina.com.cn/download/index1.htm',''],
	],	
	['联系我们', 'http://www.gcchina.com.cn/contact/', ''],
];

function addLoadEvent(func) {		// menu uses onLoad event - to have another onLoad event, add it right after BODY tag (eg <SCRIPT>addLoadEvent(function() { javascript:alert('yebagogo'); });</SCRIPT> or <SCRIPT>addLoadEvent(init);</SCRIPT>)
	var oldonload = window.onload;
	if (typeof window.onload != 'function') {
		window.onload = func;
	} else {
		window.onload = function() {
			if (oldonload) {
				oldonload();
			}
		func();
		}
	}
}

var menu_layers = new Array(); var ol = ''; var or = ''; renderMenu('1');
function renderMenu(mnr) {
	window['menu' + mnr + '_old_main_pos'] = 0; window['menu' + mnr + '_new_main_pos'] = 0; window['menu' + mnr + '_to']; window['menu' + mnr + '_opened'];
	menu_start(mnr);		// make position relative
	menu_read(mnr, '', '');		// read menu and build layers
	menu_resize(mnr, '');		// give all relevant layers equal width
	menu_resize(mnr, 'andPosition');	// twice since layers prior to widest may not have been resized yet + place layers at the right position
	menu_end();		// close menu container layer
	ol += "document.getElementById('menu" + mnr + "_container').style.left = document.getElementById('menu" + mnr + "_ref').offsetLeft; document.getElementById('menu" + mnr + "_container').style.top = document.getElementById('menu" + mnr + "_ref').offsetTop; ";
	or += "document.getElementById('menu" + mnr + "_container').style.left = document.getElementById('menu" + mnr + "_ref').offsetLeft; document.getElementById('menu" + mnr + "_container').style.top = document.getElementById('menu" + mnr + "_ref').offsetTop; ";
	if (typeof(menu2_items) != 'undefined' && typeof(menu2_new_main_pos) == 'undefined') renderMenu('2');
}
addLoadEvent(function() { eval(ol); }); 	// if the menu will be placed inside a table, it must be created outside the table
window.onresize= function() { eval(or); }	// if not, all menu layers will have a width of 0px (layer.offsetWidth)

function menu_start(mnr) {
	document.write('<DIV ID="menu' + mnr + '_container" STYLE="position:relative; top:-40px; width:0px; height:0px; z-index:1">');
}

function menu_read(mnr, level, rm_main) {
	if (!level) { level = 'menu' + mnr + '_items'; menu_layers[mnr] = new Array(); }
	var i = 0; var rm_sub = 0;
	while (i < eval(level).length) {
		if (typeof(eval(level)[i]) == 'object') {
			rm_sub++; rm_pos = (rm_main)?(rm_main + '_' + rm_sub):(rm_sub + '');
			document.write('<DIV ID="menu' + mnr + '_' + rm_pos + '" STYLE="position:absolute; padding:3px 2px; border-left:1px solid #FFFFFF; ' + ((rm_main)?('background-color:#139C83; '):(''))  + 'cursor:' + ((eval(level)[i][1] != '')?('pointer'):('default')) + '" onMouseOver="menu_open(\'' + mnr + '\', \'' + rm_pos + '\', \'1\'); menu_highlight(\'' + mnr + '\', \'on\', \'' + rm_pos + '\')" onMouseOut="menu_close(\'' + mnr + '\', \'' + rm_pos + '\', \'delayed\'); menu_highlight(\'' + mnr + '\', \'off\', \'' + rm_pos + '\')"' + ((eval(level)[i][1] != '')?(' onClick="menu_open_link(\'' + eval(level)[i][1] + '\', \'' + eval(level)[i][2] + '\')"'):('')) + '><NOBR STYLE="font-size:15px; font-family:微软雅黑; color:#FFFFFF">&nbsp;' + eval(level)[i][0] + '&nbsp;</NOBR></DIV>');
			var mll = menu_layers[mnr].length; menu_layers[mnr][mll] = new Array(); 	menu_layers[mnr][mll]['pos'] = rm_pos; menu_layers[mnr][mll]['width'] = document.getElementById('menu' + mnr + '_' + rm_pos).offsetWidth;
			if (eval(level)[i].length != 3) menu_read(mnr, level + '[' + i + ']', rm_pos);
		}
	i++;
	}
}

function menu_resize(mnr, position) {
	for (i=0; i<menu_layers[mnr].length; i++) {
		var mparent = menu_layers[mnr][i]['pos'].substring(0, menu_layers[mnr][i]['pos'].lastIndexOf('_'));
		if (mparent != '') {
			if (window['m' + mnr + '_' + mparent] >= menu_layers[mnr][i]['width']) {
				menu_layers[mnr][i]['width'] = window['m' + mnr + '_' + mparent];
				document.getElementById('menu' + mnr + '_' + menu_layers[mnr][i]['pos']).style.width = menu_layers[mnr][i]['width'] + 'px';
			}
			window['m' + mnr + '_' + mparent] = menu_layers[mnr][i]['width'];
		} else {
			if (menu_layers[mnr][i]['width'] > window['m' + mnr + '_' + menu_layers[mnr][i]['pos']]) window['m' + mnr + '_' + menu_layers[mnr][i]['pos']]  = menu_layers[mnr][i]['width'];
		}
		if (position) menu_position(mnr, menu_layers[mnr][i]['pos']);
	}
}

function menu_position(mnr, position) {
	var pos_split = position.split('_');
	if (pos_split.length == 1) {
		document.getElementById('menu' + mnr + '_' + position).style.left = window['menu' + mnr + '_new_main_pos'];
		document.getElementById('menu' + mnr + '_' + position).style.top = '0';
		window['menu' + mnr + '_old_main_pos'] = window['menu' + mnr + '_new_main_pos'];
		window['menu' + mnr + '_new_main_pos'] += document.getElementById('menu' + mnr + '_' + position).offsetWidth;
	} else {
		document.getElementById('menu' + mnr + '_' + position).style.visibility = 'hidden';
		if (pos_split.length ==2) {
			document.getElementById('menu' + mnr + '_' + position).style.left = window['menu' + mnr + '_old_main_pos'];
		} else {
			var one_up = position.substring(0, position.lastIndexOf('_'));
			document.getElementById('menu' + mnr + '_' + position).style.left = document.getElementById('menu' + mnr + '_' + one_up).offsetLeft + document.getElementById('menu' + mnr + '_' + one_up).offsetWidth;
		}
		var sumt = 0; for (j=1; j<pos_split.length; j++) { sumt += (pos_split[j]*1); }
		document.getElementById('menu' + mnr + '_' + position).style.top = document.getElementById('menu' + mnr + '_' + position).offsetHeight * (sumt-(pos_split.length-2));
	}
}

function menu_end() {
	document.write('</DIV>');
}

function menu_open(mnr, position, cnt) {
	if (window['menu' + mnr + '_to']) clearTimeout(window['menu' + mnr + '_to']);
	if (document.getElementById('menu' + mnr + '_' + position + '_' + cnt)) {
		document.getElementById('menu' + mnr + '_' + position + '_' + cnt).style.visibility = 'visible';
		cnt++; menu_open(mnr, position, cnt);
	} else menu_close(mnr, position, 'direct');
}

function menu_close(mnr, position, timing) {
	if (timing == 'delayed') { if (window['menu' + mnr + '_to']) clearTimeout(window['menu' + mnr + '_to']); window['menu' + mnr + '_to'] = setTimeout('menu_close(\'' + mnr + '\', \'0\', \'direct\')', 2000); }
	else {
		for (i=0; i<menu_layers[mnr].length; i++) {
			if (menu_layers[mnr][i]['pos'].indexOf('_') != '-1') {
				if (position == '0') document.getElementById('menu' + mnr + '_' + menu_layers[mnr][i]['pos']).style.visibility = 'hidden';
				else {
					if (position.indexOf('_') != -1) { if ((menu_layers[mnr][i]['pos'].split('_').length > position.split('_').length) && (menu_layers[mnr][i]['pos'].indexOf(position) != 0)) document.getElementById('menu' + mnr + '_' + menu_layers[mnr][i]['pos']).style.visibility = 'hidden'; }
					else { if (menu_layers[mnr][i]['pos'].substring(0, menu_layers[mnr][i]['pos'].indexOf('_')) != position) document.getElementById('menu' + mnr + '_' + menu_layers[mnr][i]['pos']).style.visibility = 'hidden'; }
				}
			}
		}
	}
}

function menu_open_link(link, target) {
	link = this.location.href.substring(0, this.location.href.indexOf('')) + '' + link;

	if (!target || target == '_self') document.location.href = link;
	else {
		if (window.parent.frames[target]) window.parent.frames[target].location.href = link;
		else if (target == '_top') top.location.href = link;
		else if (target == '_parent') parent.location.href = link;
		else window.open (link);
	}
}

function menu_highlight(mnr, status, position) {
	var menu_bgc = (position.indexOf('_') != '-1')?('#139C83'):('');
	document.getElementById('menu' + mnr + '_' + position).style.backgroundColor = (status == 'on')?('#6BBBA9'):(menu_bgc);
}