/*newzgc.com 1998-2006*/
addEvent(window, 'load', load);
var popID;
var tID;
var inputbox;
function load()
{
	inMenu = false;
	//inputbox = getNode( "jumpbbs" );
	body = document.getElementsByTagName("body")[0];
	last = null;

	if(getNode("hangyedongtai") == null) return;
	var hangyedongtai = new MenuP(getNode("hangyedongtai"), 100);
	hangyedongtai.add(new Menu("动态新闻", "/news/list.jsp?cid=2"));
	hangyedongtai.add(new Menu("图片新闻", "/news/piclist.jsp?cid=3"));
	hangyedongtai.create();

/*	if(getNode("zuzhijigou") == null) return;
	var zuzhijigou = new MenuP(getNode("zuzhijigou"), 100);
	zuzhijigou.add(new Menu("主管部门", "#"));
	zuzhijigou.add(new Menu("标 委 会", "#"));
	zuzhijigou.add(new Menu("职责章程", "#"));
	zuzhijigou.create();
*/
	if(getNode("zhengcefagui") == null) return;
	var zhengcefagui = new MenuP(getNode("zhengcefagui"), 100);
	zhengcefagui.add(new Menu("国家法规", "/policy/list.jsp?cid=5"));
	zhengcefagui.add(new Menu("行业规章", "/policy/list.jsp?cid=6"));
	zhengcefagui.create();

	if(getNode("biaozhunguifan") == null) return;
	var biaozhunguifan = new MenuP(getNode("biaozhunguifan"), 100);
	biaozhunguifan.add(new Menu("标准体系表", "/standard/list.jsp?cid=8"));
	biaozhunguifan.add(new Menu("现行标准", "/standard/list.jsp?cid=9"));
	biaozhunguifan.add(new Menu("标准项目库", "/standard/list.jsp?cid=10"));
	biaozhunguifan.add(new Menu("标准编写模版", "/standard/list.jsp?cid=11"));
	biaozhunguifan.add(new Menu("标准知识", "/standard/list.jsp?cid=12"));
	biaozhunguifan.add(new Menu("标准动态", "/standard/list.jsp?cid=13"));
	biaozhunguifan.create();

	if(getNode("jishuchuangxin") == null) return;
	var jishuchuangxin = new MenuP(getNode("jishuchuangxin"), 145);
	jishuchuangxin.add(new Menu("国内外新技术介绍", "/technology/list.jsp?cid=15"));
	jishuchuangxin.add(new Menu("经验交流", "/technology/list.jsp?cid=16"));
	jishuchuangxin.add(new Menu("企业之窗", "/technology/list.jsp?cid=17"));
	jishuchuangxin.add(new Menu("四新成果推广应用情况", "/technology/list.jsp?cid=18"));
	jishuchuangxin.create();

	if(getNode("peixunjiaoliu") == null) return;
	var peixunjiaoliu = new MenuP(getNode("peixunjiaoliu"), 100);
	peixunjiaoliu.add(new Menu("技术交流", "/training/list.jsp?cid=20"));
	peixunjiaoliu.add(new Menu("培训", "/training/list.jsp?cid=21"));
	peixunjiaoliu.create();

	if(getNode("guangrongbang") == null) return;
	var guangrongbang = new MenuP(getNode("guangrongbang"), 158);
	guangrongbang.add(new Menu("水运工程建设突出贡献奖", "/expert/list.jsp?cid=23"));
	guangrongbang.add(new Menu("水运工程标准编制工作者", "/expert/list.jsp?cid=24"));
	guangrongbang.add(new Menu("水运工程建设优秀奖", "/expert/list.jsp?cid=25"));
	guangrongbang.create();

	if(getNode("shuiyungongchengruanjian") == null) return;
	var shuiyungongchengruanjian = new MenuP(getNode("shuiyungongchengruanjian"), 110);
	shuiyungongchengruanjian.add(new Menu("行业软件", "/software/list.jsp?cid=27"));
	//shuiyungongchengruanjian.add(new Menu("新软件信息", "/software/list.jsp?cid=27"));
	shuiyungongchengruanjian.add(new Menu("新软件试用", "/software/list.jsp?cid=28"));
	shuiyungongchengruanjian.add(new Menu("应用情况公示", "/software/list.jsp?cid=29"));
	shuiyungongchengruanjian.create();
}
function MenuP ( node, menu_width ) {
this.node = node;
this.width = menu_width;
this.menuItems = new Array();
MenuP.prototype.add = function( menuItem ) {
this.menuItems[ this.menuItems.length ] = menuItem;	
}
MenuP.prototype.create = function( ) {
var dNode = document.createElement( "div" );
dNode.className = "jsMenu";
var str = "_" + this.node.id;
dNode.setAttribute( "id", str );
var w = this.node.offsetWidth;
dNode.style.width = this.width;//w > 110 ? w+"px" : "110px";
dNode.style.top = ( this.node.offsetTop + this.node.offsetHeight ) + "px";
dNode.style.left = this.node.offsetLeft + "px";
addEvent( this.node, "mouseover", function() { showMenuInTime(str, 150) } );
addEvent( this.node, "mouseout", function() { setInMenu(false) } );
dNode.setAttribute( "pItemID", this.node.id );
addEvent( dNode, "mouseover", function() { setInMenu(true) } );
addEvent( dNode, "mouseout", function() { setInMenu(false) } );
var html = "<ul>";
for( var i=0; i<this.menuItems.length; i++ ) {
	html += this.menuItems[i].getLinkHTML();
}
body.appendChild( dNode );
dNode.innerHTML = html + "</ul>";
}
}
function Menu( value, href, on_click ) {
this.value = ( value == null ) ? "" : value;
this.href = ( href == null ) ? "" : href;
if( this.href != "" && typeof useAbsPath != "undefined" )
	if( useAbsPath && this.href.indexOf( "http://" ) == -1 && this.href.indexOf( "https://" ) == -1 )
		this.href = "http://www.newzgc.com" + this.href;
Menu.prototype.getLinkHTML = function () {
	if( this.value != "" && this.href != "" )
		return "<li><a onclick=\"setInMenu(false); hideMenu(); return true;\" href=\"" + this.href + "\">" + this.value + "</a></li>";
	else if( this.value != "" && this.href == "" )
		return "<li class='heading'>" + this.value + "</li>";
	else
		return "<li class='separator'>&nbsp;</li>";
}
}
function showMenuInTime( node, time ) {
popID = setTimeout( "showMenu('" + node + "')", time );
}
function showMenu( node ) {
clearTimeout( popID );
if( typeof node == "string" )
	node = getNode( node );
if( last != null && last != node )
	hideMenu( last );
else if( last == node ) {
	setInMenu( true );
	return;
}
var pItem = getNode( node.getAttribute( "pItemID" ) );
var menuLeft = 0;
var menuTop = pItem.offsetHeight;
var tmp = pItem;
while(tmp!=null && tmp.tagName!="BODY") {
	if( tmp.tagName == "html:body" ) break;
	
	menuLeft += tmp.offsetLeft;
	//menuTop  += tmp.offsetTop;
	tmp = tmp.offsetParent;
}
node.style.left = menuLeft + "px";
node.style.top = 88 + "px";
var w = pItem.offsetWidth;
//node.style.width = w > 110 ? w+"px" : "110px";
node.style.display = "block";
setInMenu( true );
last = node;
if( inputbox != null )	inputbox.style.visibility = "hidden";
tID = setTimeout( "hideMenu( last )", 600 );
}
function hideMenu( node ) {
if( node == null ) {
	setInMenu( false );
	hideMenu( last );
	return;
}
if( typeof node == "string" )
	node = getNode( node );
if( !inMenu ) {
	node.style.display = "none";
	var pItem = getNode( node.getAttribute( "pItemID" ) );
	last = null;
	clearTimeout( tID );
	if( inputbox != null )	inputbox.style.visibility = "visible";
} else
	tID = setTimeout( "hideMenu( last )", 500 );	
}
function setInMenu( value ) {
inMenu = value;	
if( !value ) clearTimeout( popID );
}
function addEvent( node, evtType, func ) {
if( node.addEventListener ) {
	node.addEventListener( evtType, func, false );
	return true;
} else if( node.attachEvent )
	return node.attachEvent( "on" + evtType, func );
else
	return false;
}
function getNode( nodeId ) {
if( document.getElementById )
	return document.getElementById( nodeId );
else if( document.all && document.all( nodeId ) )
	return document.all( nodeId );
else if( document.layers && document.layers[ nodeId ] )
	return document.layers[ nodeId ];
else
	return false;
}