//下拉菜单相关代码
 var h;
 var w;
 var tw;
 var l;
 var tl;
 var t;
 var t_width = 0;
 var topMar = 1;
 var leftMar = -2;
 var space = 1;
 var isvisible;
 var tbgcolor='#000';//定义下拉菜单背景色
 var MENU_SHADOW_COLOR='#999';//定义下拉菜单阴影色
 var global = window.document
 global.fo_currentMenu = null
 global.fo_shadows = new Array

function HideMenu() 
{
 var mX;
 var mY;
 var vDiv;
 var mDiv;
	if (isvisible == true)
{
		vDiv = document.all("menuDiv");
		mX = window.event.clientX + document.body.scrollLeft;
		mY = window.event.clientY + document.body.scrollTop;
		if ((mX < parseInt(vDiv.style.left)) || (mX > parseInt(vDiv.style.left)+vDiv.offsetWidth) || (mY < parseInt(vDiv.style.top)-h) || (mY > parseInt(vDiv.style.top)+vDiv.offsetHeight)){
			vDiv.style.visibility = "hidden";
			isvisible = false;
		}
		if (((mX < tl)||(mX> tl+w))&&((mY < parseInt(vDiv.style.top)) || (mY > parseInt(vDiv.style.top)+vDiv.offsetHeight))){
			vDiv.style.visibility = "hidden";
			isvisible = false;
			}
}
}

function ShowMenu(vMnuCode,tWidth) {
	if (vMnuCode != false){
	vSrc = window.event.srcElement;
	vMnuCode = "<table id='submenu' cellspacing=0 cellpadding=0 style='width:"+tWidth+";background:"+tbgcolor+"' class=tableborder1 onmouseout='HideMenu()'><tr height=23><td  nowrap align=left class=tablebody1>" + vMnuCode + "</td></tr></table>";

	h = vSrc.offsetHeight;
	w = vSrc.offsetWidth;
	tl = vSrc.offsetLeft; //+ leftMar+4;
	l = vSrc.offsetLeft; //+ leftMar+4;
	t = vSrc.offsetTop + topMar + h + space-2;
	vParent = vSrc.offsetParent;
	while (vParent.tagName.toUpperCase() != "BODY")
	{
		l += vParent.offsetLeft;
		t += vParent.offsetTop;
		vParent = vParent.offsetParent;
	}

	menuDiv.innerHTML = vMnuCode;
	menuDiv.style.top = t;
	menuDiv.style.left = l;
	menuDiv.style.visibility = "visible";
	isvisible = true;
    makeRectangularDropShadow(submenu, MENU_SHADOW_COLOR, 4)
}
}

function ShowMenuA(vMnuCode,tWidth) {
	menuDivb.style.display = "none";
	menuDiv.style.visibility = "hidden";
	if (vMnuCode != false){
	vSrc = window.event.srcElement;
	vMnuCode = "<table id='submenu' width="+tWidth+" ><tr><td align=left height=30>" + vMnuCode + "</td></tr></table>";

	h = vSrc.offsetHeight;
	w = vSrc.offsetWidth;
	tl = vSrc.offsetLeft; //+ leftMar+4;
	l = vSrc.offsetLeft; //+ leftMar+4;
	t = vSrc.offsetTop + topMar + h + space-2;
	vParent = vSrc.offsetParent;
	while (vParent.tagName.toUpperCase() != "BODY")
	{
		l += vParent.offsetLeft;
		t += vParent.offsetTop;
		vParent = vParent.offsetParent;
	}

	menuDiv.innerHTML = vMnuCode;
	menuDiv.style.top = t;
	menuDiv.style.left = l;
	menuDiv.style.visibility = "visible";
	menuDivb.style.display = "block";
	isvisible = true;
}
}

function ShowMenuB(vMnuCode,tWidth) {
	menuDiv.style.display = "none";
	if (vMnuCode != false){
	vSrc = window.event.srcElement;
	vMnuCode = "<table id='submenu' ><tr><td align=left height=30>" + vMnuCode + "</td></tr></table>";

	h = vSrc.offsetHeight;
	w = vSrc.offsetWidth;
	tl = vSrc.offsetLeft; //+ leftMar+4;
	l = vSrc.offsetLeft;//+ leftMar+4;
	t = vSrc.offsetTop + topMar + h + space;
	vParent = vSrc.offsetParent;
	while (vParent.tagName.toUpperCase() != "BODY")
	{
		l += vParent.offsetLeft;
		t += vParent.offsetTop;
		vParent = vParent.offsetParent;
	}
	menuDiv.innerHTML = vMnuCode;
	tw = menuDiv.offsetWidth;
	menuDiv.style.top = 0;
	if (tWidth>0){
	menuDiv.style.left = l +'px';
	}else
	{
	menuDiv.style.left = l-(tw/2) +'px';
		}
	menuDiv.style.display = "block";
	isvisible = true;
}
}

function ShowMenuD(vMnuCode,tleft,tWidth) {
	if (vMnuCode != false){
	vSrc = window.event.srcElement;
	vMnuCode = "<table id='submenu' cellspacing=0 cellpadding=0 style='width:"+tWidth+";background:"+tbgcolor+"' class=tableborder1 onmouseout='HideMenu()'><tr height=23><td  nowrap align=left class=tablebody1>" + vMnuCode + "</td></tr></table>";

	h = vSrc.offsetHeight;
	w = vSrc.offsetWidth;
	tl = vSrc.offsetLeft; //+ leftMar+4;
	l = vSrc.offsetLeft; //+ leftMar+4;
	t = vSrc.offsetTop + topMar + h + space-2;
	vParent = vSrc.offsetParent;
	while (vParent.tagName.toUpperCase() != "BODY")
	{
		tl = vParent.offsetLeft;
		l += vParent.offsetLeft;
		t += vParent.offsetTop;
		vParent = vParent.offsetParent;
	}
	if (tleft>0) {l=tl+tleft;}
	menuDiv.innerHTML = vMnuCode;
	menuDiv.style.top = t;
	menuDiv.style.left = l;
	menuDiv.style.visibility = "visible";
	isvisible = true;
 
}
}

function makeRectangularDropShadow(el, color, size) 
{
	var i;   
	for (i=size; i>0; i--)
	{
		var rect = document.createElement('div');    //下拉菜单中框框的设定 makeRectangularDropShadow默认有框;
		var rs = rect.style
		rs.position = 'absolute';
		rs.left = (el.style.posLeft + i) + 'px';
		rs.top = (el.style.posTop + i) + 'px';
		rs.width = el.offsetWidth + 'px';
		rs.height = el.offsetHeight + 'px';
		rs.zIndex = el.style.zIndex - i;   
		rs.backgroundColor = color;
		var opacity = 1 - i / (i + 1);
		rs.filter = 'alpha(opacity=' + (100 * opacity) + ')';
		el.insertAdjacentElement('afterEnd', rect);
		global.fo_shadows[global.fo_shadows.length] = rect;
	}
}

function getMenuItem(el) {
	temp = el;
	while ((temp!=null) && (temp.tagName!="TABLE") && (temp.id!="menubar") && (temp.id!="menu") && (temp.id!="handle")) {
		if ((temp.tagName=="TR") || (temp.className=="root"))
			el = temp;
		temp = temp.parentElement;
	}
	return el;
}

function menuItemHighlight(el) {
	el.style.background = "#EFEFEF";
	el.style.color = "#000";
}

function menuItemNormal(el) {
	el.style.background = "#FFF";
	el.style.color = "#000";
}

function menuOver()
{
	var fromEl = getMenuItem(event.fromElement);
	var toEl = getMenuItem(event.toElement);
	if ((fromEl != toEl) && (toEl.tagName != "TABLE"))
    menuItemHighlight(toEl);
}

function menuOut() 
{
	var fromEl = getMenuItem(event.fromElement);
	var toEl = getMenuItem(event.toElement);
    if ((fromEl != toEl) && (fromEl.tagName != "TABLE"))
				menuItemNormal(fromEl);
}

function menuClick() {
	if (event.srcElement == null)
		return;
	var el=getMenuItem(event.srcElement);
	if (el.href) {
		window.location = el.href;
	}
}

function diva_show(div_id,img_b,img_n)
{
if (document.all)
{
	if (document.all.item("a"+div_id).style.display=="block")
	{
		document.all.item("a"+div_id).style.display="none";
		document.all.item("i"+div_id).src=img_b;
	}
	else
	{
		document.all.item("a"+div_id).style.display="block";
		document.all.item("i"+div_id).src=img_n;
	}
}
}

function diva_block(div_id,img_b,img_n)
{
if (document.all)
{
		document.all.item("a"+div_id).style.display="block";
		document.all.item("i"+div_id).src=img_n;
}
}

function changeTab(obj,tab){
	var tabs=document.getElementById(tab).getElementsByTagName("li");
	for(i=0;i<tabs.length;i++){
		var id=i+1;
		if(tabs[i]==obj){
			tabs[i].className="current";
			document.getElementById(tab+"_con"+id).className="dis";
			document.getElementById(tab+"_more"+id).className="dis";
		}else{
			tabs[i].className="nor";
			document.getElementById(tab+"_con"+id).className="undis";
			document.getElementById(tab+"_more"+id).className="undis";
		}
	}
}

//菜单内容设置范例
var manage= '<table background=\"images/bg_03.gif\" onclick=menuClick() onmouseout=menuOut() onmouseover=menuOver() border=\"0\" cellpadding=\"0\" style=\"border-collapse: collapse;cursor:hand\" width=100%><tr href=\"index.asp\"><td><img src=\"images/Folder.gif\"></td><td>发短信</td></tr><tr><td><img src=\"images/Folder.gif\"></td><td>客户留言板</td></tr></table>'
//<a href="usermanager.asp" onMouseOver='ShowMenu(manage,100)'>用户控制面板</a>

