﻿//得到单个对象，返回单个对象的引用
function $(vObjectValue){
if(typeof(vObjectValue)=="object")
	return vObjectValue;
else
	return document.getElementById(vObjectValue);	
}
//得到多个对象，返回多个对象的引用的数组
function $ARY(vObjectValue){
	return document.getElementsByName(vObjectValue);
}
//Taber控制
function showTab(strGroupTabName,intIndex,strColor,bolBold){
	var aryTab = $ARY(strGroupTabName);
	if(aryTab.length<=intIndex){
		alert("当前索引值超出Tab控件下标，请检查！");
		return;
	}
	var o=event.srcElement;
	for(var i=0;i<aryTab.length;i++){
		if(i==intIndex){
			aryTab[i].style.display="block";
			if(strColor!=null){
				o.attachEvent("onmouseout",__TabMouseOut);
			}
			o.style.color=(strColor!=null?strColor:"");
			if(bolBold){
				o.style.fontWeight="bold";
			}
			else{
				o.isSetBold="1";
			}
		}
		else{
			aryTab[i].style.display="none";
		}
	}
}
//Taber onmouseout事件
function __TabMouseOut(){
	var o=event.srcElement;
	o.style.color="";
	if(o.isSetBold!="1")
	o.style.fontWeight="normal";
}
//显示滚动图片
function showMagic(strPics,strTexts,strLinks,intWidth,intHeight,intTextHeight,strTextAlign,lngRollTime){
	var interval_time=(lngRollTime==null?6:lngRollTime); //图片停顿时间，单位为秒，为0则停止自动切换
	var text_height=(intTextHeight==null?28:intTextHeight); //标题高度
	var text_align=(strTextAlign==null?"center":strTextAlign);//标题文字对齐方式(left、center、right)
	var swf_height=intHeight+text_height;//相加之和最好是偶数,否则数字会出现模糊失真的问题
	document.write('<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" width="'+ intWidth +'" height="'+ swf_height +'">');
	document.write('<param name="movie" value="img09/MP.swf"><param name="quality" value="high"><param name="bgcolor" value="#ffffff">');
	document.write('<param name="menu" value="false"><param name="wmode" value="opaque"><param name="allowScriptAccess" value="always">');
	document.write('<param name="FlashVars" value="pics='+strPics+'&links='+strLinks+'&texts='+strTexts+'&borderwidth='+intWidth+'&borderheight='+intHeight+'&textheight='+text_height+'&text_align='+text_align+'&interval_time='+interval_time+'">');
	document.write('<embed src="/Images/2008/MP.swf" wmode="opaque" allowScriptAccess="always" FlashVars="pics='+strPics+'&links='+strLinks+'&texts='+strTexts+'&borderwidth='+intWidth+'&borderheight='+intHeight+'&textheight='+text_height+'&text_align='+text_align+'&interval_time='+interval_time+'" menu="false" bgcolor="#ffffff" quality="high" width="'+ intWidth +'" height="'+ swf_height +'" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />');
	document.write('</object>');
}
//全局变量，用于实现一个页面内的多个菜单索引
var GLOBAL_MENUCOUNT=0;
//最后显示的MENU对象
var GLOBAL_MENULAST=null;
//* Title:菜单控制通用函数
//* Description:可控制本CMS中任何菜单
//* Copyright: Copyright 2002-2008 YesoulSoft, Co.Ltd. All Rights Reserved.
//* WebSite: http://www.772.cn  yichun@qq.com
//* @author: Yesoul 卢鲁平
//* @version: 1.00
//* @Create date: 2008-09-03 15:58:54
//菜单控制
function showMenu(objSelf,intTdHeight,bolCenter){
	var x = $X(objSelf);
	var y = $Y(objSelf);
	var oTable=objSelf.parentNode.parentNode;
	if(oTable.tagName!="TBODY"){
		alert("菜单设置错误！");
		return;
	}
	GLOBAL_MENUCOUNT++;
	var CellIndex=objSelf.cellIndex;
	var strMenuID="__MENU" + GLOBAL_MENUCOUNT + CellIndex;
	var oMenuMe = $(strMenuID);
	if(!oMenuMe){
		oMenuMe = document.createElement("DIV");
		oMenuMe.id = strMenuID;
		oMenuMe.style.position = "absolute";
		document.body.appendChild(oMenuMe);
		oMenuMe.innerHTML = oTable.rows(1).cells(CellIndex).innerHTML;
		//附加事件
		oMenuMe.onmouseover=function(){oMenuMe.style.display = "block";};
		oMenuMe.onmouseout=function(){__MenuMouseOut(oMenuMe);};
		objSelf.onmouseout=function(){__MenuMouseOut(oMenuMe);};
	}
	oMenuMe.style.top = (intTdHeight==null?y:y+intTdHeight) + "px";
	if(bolCenter){
		var root=document.documentElement;
		x=(root.clientWidth/2)-(oMenuMe.clientWidth/2);
	}
	oMenuMe.style.left = x + "px";
	oMenuMe.style.display = "block";
	GLOBAL_MENULAST=oMenuMe;
}
//增加单击隐藏菜单功能
document.attachEvent("onclick",__MenuMouseOut);
//菜单隐藏控制
function __MenuMouseOut(oMenuMe){
	if(oMenuMe==null || oMenuMe.type=="click"){
		oMenuMe=GLOBAL_MENULAST;
	}
	try{
		if(oMenuMe==null){
			return;
		}
		oMenuMe.style.display = "none";
	}
	catch(e){
		oMenuMe.style.display = "none";
	}
}
function $X(e){
	var l=e.offsetLeft;
	while(e=e.offsetParent){				
		l+=e.offsetLeft;
	}
	return l;
}
function $Y(e){
	var t=e.offsetTop;
	while(e=e.offsetParent){
		t+=e.offsetTop;
	}
	return t;
}
