var pop;
//菜单类
function popMenu(menuid,name,overcolor, outcolor, bdcolor) {
	this.id = menuid;
	this.name = name;
	this.overColor = overcolor;//鼠标over背景色
	this.outColor = outcolor;//鼠标out背景色
	this.bdColor = bdcolor;//边框色
	this.itemNames = new Array();
	this.itemUrls = new Array();
	this.addItem = f_addItem;
	this.draw = f_draw;
	return this;
}
//增加菜单项
function f_addItem(name,url) {
	this.itemNames[this.itemNames.length] = name;
	this.itemUrls[this.itemUrls.length] = url;
	return this;
}

//绘制菜单
function f_draw() {

		var temp = this;
		document.write("<DIV id=" + temp.id + " style=\"DISPLAY: none\">");
		document.write("<TABLE cellSpacing=0 cellPadding=0 width=\"100%\" align=center border=0><TBODY>");
		//document.write("<TR><TD onmouseover=\"style.borderColor ='"+this.bdColor+"';style.backgroundColor ='"+this.overColor+"';\" style=\"FONT-WEIGHT: normal; FONT-SIZE: 12px; LIST-STYLE-IMAGE:  COLOR: #084d96; LINE-HEIGHT: 24px; BACKGROUND-COLOR: #ebf3fb;\" onmouseout=\"style.borderColor='';style.backgroundColor ='"+this.outColor+"';\" vAlign=center align=middle height=24>" + temp.name + "</TD></TR>");
		for (var j = 0; j < temp.itemNames.length; j++) {
			document.write("<TR><TD background=util/images/popdiv.gif height=4></TD></TR><TR><TD onmouseover=\"style.borderColor ='#666666';style.backgroundColor ='#ffffff';\" style=\"FONT-WEIGHT: normal; FONT-SIZE: 12px; LIST-STYLE-IMAGE: url(util/images/popicon.gif); COLOR: #084d96; LINE-HEIGHT: 24px; BACKGROUND-COLOR: #ebf3fb\" onclick='parent.parent.location.href=\"" + temp.itemUrls[j] + "\"' onmouseout=\"style.borderColor='';style.backgroundColor ='#EBF3FB';\" align=left nowrap><LI>" + temp.itemNames[j] + "</LI></TD></TR>");
		}
		document.write("</TBODY></TABLE></DIV>");
	}

//显示菜单
function showMenu(id, num,width) {
    hidePop();
	var obj = event.srcElement;   //捕获触发 expand 函数的对象
	//根据对象在它所在行的 cells 的索引号捕获到相应的下拉菜单组 
	var w = width;// obj.offsetWidth + 2;   // popup 窗口的宽度，等于对象的宽度加 2
	//popup 窗口的高度
	var h = (num) * 24 + 4 * num; 
	// popup 窗口的X坐标值
	var x =  event.x - event.offsetX + obj.offsetLeft - (width-obj.offsetWidth)/2; 
	// popup 窗口的Y坐标值 
	var y =  event.y - event.offsetY+obj.offsetHeight+7;
	pop = window.createPopup();
	var ctrl = eval(id);
	pop.document.body.innerHTML = ctrl.innerHTML;
	pop.show(x, y, w, h, document.body);
	var oPopBody = pop.document.body;
	oPopBody.style.backgroundColor = "lightyellow";
	oPopBody.style.border = "solid black 1px";
	oPopBody.style.cursor = "pointer";
	event.returnValue = false;
	event.cancelBubble = true;
	return false;
}
//隐藏菜单
function hidePop() {
	if (pop != null) {
		pop.hide();
	}
}

// 刷新主框架中的页面
function refreshPage() {
	if (parent.mainFrame)
	{
		parent.mainFrame.location.reload();
		return;
	}
	parent.location.reload();
}

// 隐藏topFrame框架
function hideTopFrame() {
	var toptab = document.getElementById("toptable");
	toptab.style.display = "none";
	var header = document.getElementById("header");
	if (header)
	{
		header.style.height = "25";
	}
	var objFrame = parent.document.getElementById("frametop");
	if (objFrame)
	{
		objFrame.rows = "25,*";
	}
}
// 显示topFrame框架
function showTopFrame() {
	var toptab = document.getElementById("toptable");
	toptab.style.display = "block";
	var header = document.getElementById("header");
	if (header)
	{
		header.style.height = "100";
	}
	var objFrame = parent.document.getElementById("frametop");
	if (objFrame)
	{
		objFrame.rows = "100,*";
	}
}

// 隐藏leftFrame框架
function hideLeftFrame() {
	var objFrame = parent.document.getElementById("framecontent");
	if (objFrame)
	{
		objFrame.cols = "0,*";
	}
}
// 显示leftFrame框架
function showLeftFrame() {
	var objFrame = parent.document.getElementById("framecontent");
	if (objFrame)
	{
		objFrame.cols = "159,*";
	}
}

var PIXELGIF="util/blank.gif";// 这个是个头1*1像素的透明gif图片，请自行建立并放在你网页的相同目录下

var arVersion = navigator.appVersion.split("MSIE");
var version = parseFloat(arVersion[1]);
var pngxp=/\.png$/i;
var AlphaPNGfix= "progid:DXImageTransform.Microsoft.AlphaImageLoader";

function fixPNG(img,width,height) {
	if(!document.all) {
		return;
	}
	if (version < 5.5 || version >= 7) {
		return;
	}
	if(img && img.src && pngxp.test(img.src)) {
		var imgName = img.src;
		var imgID = (img.id) ? "id='" + img.id + "' " : "";
		var imgClass = (img.className) ? "class='" + img.className + "' " : "";
		var imgTitle = (img.title) ? "title='" + img.title + "' " : "title='" + img.alt + "' ";
		var imgStyle = "display:inline-block;" + img.style.cssText;
		if (img.align == "left") imgStyle = "float:left;" + imgStyle;
		if (img.align == "right") imgStyle = "float:right;" + imgStyle;
		if (img.parentElement.href) imgStyle = "cursor:pointer;" + imgStyle;
		var strNewHTML = "<span " + imgID + imgClass + imgTitle
			+ " style=\"" + "width:" + width + "; height:" + height + ";" + imgStyle + ";"
			+ "filter:" +AlphaPNGfix
			+ "(src='" + img.src + "',enabled='true', sizingMethod='scale');\"></span>";
		if (img.useMap) {
			strNewHTML += "<img style=\"position:relative; left:-" + width + ";"
						+ "height:" + height + ";width:" + width +"\" "
						+ "src=\"" + PIXELGIF + "\" usemap=\"" + img.useMap 
						+ "\" border=\"" + img.border + "\">";
		}
		img.outerHTML = strNewHTML;
	} 
}

window.document.attachEvent("onmouseover", hidePop);

