neiiMENU1 = new Array (
	65,20,
	"#FFFFFF","#1964AE","#FF9900",
	"宋体",2,
	"#000000",1,
	"公司简介", "http://www.stcic.com/jtgk.asp",
	"组织机构", "http://www.stcic.com/zzjg.htm",
	"发展历程", "http://www.stcic.com/fzlc.htm",
	"大事记", "http://www.stcic.com/dsj.htm",
	"战略规划","http://www.stcic.com/zlgh.htm"
);

neiiMENU2 = new Array (
	65,20,
	"#FFFFFF","#1964AE","#FF9900",
	"宋体",2,
	"#000000",1,
	"业务范围", "http://www.stcic.com/ywfw.htm",
	"分子公司","http://www.stcic.com/fzgs.htm",
	"企业之星","http://www.stcic.com/qyzx.htm",
	"特色品牌","http://www.stcic.com/tspp.htm",
	"新业务","http://www.stcic.com/xyw.htm"
);

neiiMENU3 = new Array (
	65,20,
	"#FFFFFF","#1964AE","#FF9900",
	"宋体",2,
	"#000000",1,
	"市场热点", "http://www.stcic.com/market.asp",
	"产品信息", "http://www.stcic.com/cpxx.asp",
	"服务信息", "http://www.stcic.com/fwxx.asp",
	"技术论坛", "http://www.stcic.com/jslt.asp",
	"投资导航", "http://www.stcic.com/tzdh.asp"
);

neiiMENU4 = new Array (
	65,20,
	"#FFFFFF","#1964AE","#FF9900",
	"宋体",2,
	"#000000",1,
	"培训园地", "http://www.stcic.com/pxyd.asp"
);

neiiMENU5 = new Array (
	65,20,
	"#FFFFFF","#1964AE","#FF9900",
	"宋体",2,
	"#000000",1,
	"法规档案", "http://www.stcic.com/zcfg.htm",
	"法规问答", "http://www.stcic.com/fgwd.htm"
);

neiiMENU6 = new Array (
	65,20,
	"#FFFFFF","#1964AE","#FF9900",
	"宋体",2,
	"#000000",1,
	"竞赛交流", "http://www.stcic.com/ygfc.htm",
	"文化活动", "http://www.stcic.com/whhd.htm",
	"优秀员工", "http://www.stcic.com/yxyg.htm",
	"专题征文", "http://www.stcic.com/ztzw.htm"
);

neiiMENU7 = new Array (
	65,20,
	"#FFFFFF","#1964AE","#FF9900",
	"宋体",2,
	"#000000",1,
	"业务联系", "http://www.stcic.com/swlx.htm",
	"休闲服务", "http://www.stcic.com/xxfw.htm"
);


var activeMenu 		= null;
var activeMenuItem 	= null;
var neiiMENUS 		= new Array(1);
var isLoaded		= 0;

function createMenusNS()
{
	var menuCount = 1;

	while(eval("window.neiiMENU"+menuCount)) {
		menuArray = eval("neiiMENU"+menuCount);
		
		menu = new Layer(menuArray[0],window);
		
		neiiMENUS[menuCount] 	= menu;
		menu.menuNdx 			= menuCount;
		menu.onmouseout 		= menu_out;
		menu.show				= menu_show;
		menu.hide				= menu_hide;
		
		style 				= menu;
		style.visibility 	= 'hide';
		style.color 		= menuArray[2];
		style.bgColor 		= menuArray[7];
		style.left 			= 0;
		style.top 			= 0;
		style.zIndex 		= 100;
				
		prevstyle = null;
		ndx = 9;
		while (menuArray[ndx]) {
			
			mitem = new Layer(menuArray[0],menu);
			mitem.document.write ('&nbsp;<font color="'+menuArray[2]+'" face="'+menuArray[5]+'" size="'+menuArray[6]+'">'+menuArray[ndx]+'</font>');
			mitem.document.close();
			mitem.captureEvents(Event.MOUSEUP);
			
			mitem.menu 			= menu;
			mitem.onmouseover 	= menuitem_over;
			mitem.onmouseup 	= menuitem_click;
			mitem.lolite 		= menuitem_lolite;
			mitem.hilite 		= menuitem_hilite;
			mitem.href 			= menuArray[ndx+1];

			menu.lastitem 		= mitem;

			style = mitem;

			style.visibility 	= 'inherit';
			style.zIndex		= 101;
			style.bgColor 		= menuArray[3];
			style.locolor 		= menuArray[3];
			style.hicolor 		= menuArray[4];

			style.left 			= menuArray[8];
			style.top 			= (prevstyle == null) ? menuArray[8] : prevstyle.top + prevstyle.clip.height;
			style.clip.right 	= menuArray[0]-menuArray[8]*2;
			style.clip.bottom 	= menuArray[1];

			prevstyle 			= style;
									
			ndx += 2;
		}	
		
		menu.clip.right = menuArray[0];
		menu.clip.bottom = menu.lastitem.top + menu.lastitem.clip.height + menuArray[8];
		
		menuCount++;			
	}
	isLoaded = 1;
}


function createMenusIE()
{	
	menuCount = 1;
	menuStr = "";
	while(eval("window.neiiMENU"+menuCount)) {
		menuArray = eval("neiiMENU"+menuCount);
		menuStr += '<span id="rMENU'+menuCount+'" style="position:absolute">';
		ndx = 9;
		while (menuArray[ndx]) {
			menuStr += 	'<span id="rMENU'+menuCount+'ITEM'+((ndx-9)/2+1)+'" style="position:absolute">'+'<font color="'+menuArray[2]+'" face="'+menuArray[5]+'" size="'+menuArray[6]+'">&nbsp;'+menuArray[ndx]+'</font>'+'</span>';							  
			ndx += 2;
		}
		menuStr += '</span>';
		menuCount++;
	}
	
	window.document.body.insertAdjacentHTML('BeforeEnd',menuStr);
	
	menuCount = 1;
		
	while(eval("window.neiiMENU"+menuCount)) {
		menuArray = eval("neiiMENU"+menuCount);
				
		menu = document.all["rMENU"+menuCount];
		
		neiiMENUS[menuCount] = menu;
		menu.menuNdx = menuCount;
		menu.onmouseout = menu_out;
		menu.show = menu_show;
		menu.hide = menu_hide;
		menu.timerid = null;
		
		style = menu.style;
		style.visibility = 'hidden';
		style.color = menuArray[2];
		style.backgroundColor = menuArray[7];
		style.left = 0;
		style.top = 0;
		style.zIndex = 100;
		style.pixelWidth = menuArray[0];
		
		prevstyle = null;
		ndx = 9;
		while (menuArray[ndx]) {
			mitem = document.all["rMENU"+menuCount+"ITEM"+((ndx-9)/2+1)];

			mitem.menu = menu;
			mitem.onmouseover = menuitem_over;
			mitem.onmouseup = menuitem_click;
			mitem.lolite = menuitem_lolite;
			mitem.hilite = menuitem_hilite;
			mitem.href = menuArray[ndx+1];

			menu.lastitem = mitem;

			style = mitem.style;
			style.visibility = 'inherit';
			style.zIndex = 101;
			style.backgroundColor = menuArray[3];
			style.locolor = menuArray[3];
			style.hicolor = menuArray[4];
			style.cursor = "hand";

			style.pixelLeft = menuArray[8];
			style.pixelTop = (prevstyle == null) ? menuArray[8] : prevstyle.pixelTop + prevstyle.pixelHeight;
			style.pixelWidth = menuArray[0]-menuArray[8]*2;
			style.pixelHeight = menuArray[1];

			prevstyle = style;
									
			ndx += 2;
		}
		
		menu.style.pixelHeight = menu.lastitem.style.pixelTop + menu.lastitem.style.pixelHeight + menuArray[8];
		
		menuCount++;			
	}
	isLoaded = 1;
}

function resize()
{
	if (document.layers) {
		if (saveInnerWidth < window.innerWidth || saveInnerWidth > window.innerWidth || saveInnerHeight > window.innerHeight || saveInnerHeight < window.innerHeight ) 
    	window.location.reload();
	}
}

function startup()
{
	if (document.layers) createMenusNS();
	    else createMenusIE();
	
	window.onresize=resize;
	window.saveInnerWidth = window.innerWidth;
	window.saveInnerHeight = window.innerHeight;
}

window.onload = startup;

function clearTimer(menuNdx) {
	if (neiiMENUS[menuNdx].timerid) {
		clearTimeout(neiiMENUS[menuNdx].timerid);
		neiiMENUS[menuNdx].timerid = null;
	}
}

function getRealLeft(el) {
	if (document.layers) return el.x;
	
    xPos = el.offsetLeft;
    tempEl = el.parentElement;
	while (tempEl != null)
     {  
        xPos += tempEl.offsetLeft;
		tempEl = tempEl.parentElement;
           }
	
	return xPos;
}

function getRealTop(el) {
	if (document.layers) return el.y;
	
    yPos = el.offsetTop;
    tempEl = el.offsetParent;
	
    while (tempEl != null) {
        yPos += tempEl.offsetTop;
        tempEl = tempEl.offsetParent;
    }
	
    return yPos;
}

function fixLeftBounds(menuNdx,tryLeft)
{
	visibleWidth = document.layers ? window.innerWidth : document.body.clientWidth;
	visibleLeft = document.layers ? window.pageXOffset : document.body.scrollLeft;
	visibleRight = visibleLeft + visibleWidth;
	
	menuWidth = document.layers ? neiiMENUS[menuNdx].width : neiiMENUS[menuNdx].style.pixelWidth;
	
	if ((tryLeft + menuWidth) > visibleRight) tryLeft = visibleRight - menuWidth;
	
	if (tryLeft < visibleLeft) tryLeft = visibleLeft;

	return tryLeft;	
}

function fixTopBounds(menuNdx,tryTop)
{
	visibleHeight = document.layers ? window.innerHeight : document.body.clientHeight;
	visibleTop		= document.layers ? window.pageYOffset : document.body.scrollTop;
	visibleBottom   = visibleTop + visibleHeight;
	
	menuHeight = document.layers ? neiiMENUS[menuNdx].height : neiiMENUS[menuNdx].style.pixelHeight;
	
	if ((tryTop + menuHeight) > visibleBottom) tryTop = visibleBottom - menuHeight;
	
	if (tryTop < visibleTop) tryTop = visibleTop;
	
	return tryTop;
}
	

function menu_popup(menuNdx,linkobj,xoff,yoff) {
	if (isLoaded == 1) {
		if (activeMenu != null) 	activeMenu.hide();
		if (activeMenuItem != null) activeMenuItem.lolite();
	
		clearTimer(menuNdx);
		
		neiiMENUS[menuNdx].show(
			fixLeftBounds(menuNdx,getRealLeft(linkobj)+(xoff | 0)),
			fixTopBounds(menuNdx,getRealTop(linkobj)+(yoff | 0))
		);
	}
}

function menu_popdown(menuNdx) {
	if (isLoaded == 1) {
		clearTimer(menuNdx);
		neiiMENUS[menuNdx].timerid = setTimeout("neiiMENUS["+menuNdx+"].hide()",700);
	}
}

function menu_hide()
{
	if (document.layers)	this.visibility = "hide";
	else					this.style.visibility = "hidden";	
	if (this == activeMenu) activeMenu = null;
}

function menu_show(x,y)
{
	if (document.layers) {this.left = x; this.top = y;}
	else				 {this.style.left = x; this.style.top = y;}	

	if (document.layers) 	this.visibility = "show";
	else					this.style.visibility = "visible";
	activeMenu = this;
}

function menu_out() 
{
	clearTimer(this.menuNdx);
	this.timerid = setTimeout("neiiMENUS["+this.menuNdx+"].hide()",100);
}

function menuitem_over()
{
	if (activeMenuItem != null) activeMenuItem.lolite();
	this.hilite();
	
	activeMenuItem = this;
	clearTimer(this.menu.menuNdx);
}

function menuitem_click()
{
	document.location.href = this.href;
}

function menuitem_lolite()
{
	if (document.layers)	this.bgColor = this.locolor;
	else					this.style.backgroundColor = this.style.locolor;
}

function menuitem_hilite()
{
	if (document.layers)	this.bgColor = this.hicolor;
	else					this.style.backgroundColor = this.style.hicolor;
}

function callpage(htmlurl) {
  var newwin=window.open(htmlurl,"newwin","toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=no,width=450,height=400");
}