
function top(){
document.write("<table cellpadding=0 cellspacing=0 width=97% align=center><tr><td><img src=images/T_left.gif></td><td width=100% background=images/T_bg.gif></td><td><img src=images/T_right.gif></td></tr></table>")
}

function bottom(){
document.write("<table cellpadding=0 cellspacing=0 width=97% align=center><tr><td><img src=images/B_left.gif></td><td width=100% background=images/B_bg.gif></td><td><img src=images/B_right.gif></td></tr></table>")
}
//菜单
var menuOffX=0	//菜单距连接文字最左端距离
var menuOffY=20	//菜单距连接文字顶端距离

var ie4=document.all&&navigator.userAgent.indexOf("Opera")==-1
var ns6=document.getElementById&&!document.all
function showmenu(e,vmenu,mod){
	which=vmenu
	menuobj=document.getElementById("popmenu")
	menuobj.thestyle=menuobj.style
	menuobj.innerHTML=which
	menuobj.contentwidth=menuobj.offsetWidth
	eventX=e.clientX
	eventY=e.clientY
	var rightedge=document.body.clientWidth-eventX
	var bottomedge=document.body.clientHeight-eventY

		if (rightedge<menuobj.contentwidth)
			menuobj.thestyle.left=document.body.scrollLeft+eventX-menuobj.contentwidth+menuOffX
		else
			menuobj.thestyle.left=ie4? ie_x(event.srcElement)+menuOffX : ns6? window.pageXOffset+eventX : eventX
		
		if (bottomedge<menuobj.contentheight&&mod!=0)
			menuobj.thestyle.top=document.body.scrollTop+eventY-menuobj.contentheight-event.offsetY+menuOffY-23
		else
			menuobj.thestyle.top=ie4? ie_y(event.srcElement)+menuOffY : ns6? window.pageYOffset+eventY+10 : eventY

	menuobj.thestyle.visibility="visible"
}


function ie_y(e){  
	var t=e.offsetTop;  
	while(e=e.offsetParent){  
		t+=e.offsetTop;  
	}  
	return t;  
}  
function ie_x(e){  
	var l=e.offsetLeft;  
	while(e=e.offsetParent){  
		l+=e.offsetLeft;  
	}  
	return l;  
}

function highlightmenu(e,state){
	if (document.all)
		source_el=event.srcElement
		while(source_el.id!="popmenu"){
			source_el=document.getElementById? source_el.parentNode : source_el.parentElement
			if (source_el.className=="menuitems"){
				source_el.id=(state=="on")? "mouseoverstyle" : ""
		}
	}
}


function hidemenu(){if (window.menuobj)menuobj.thestyle.visibility="hidden"}
function dynamichide(e){if ((ie4||ns6)&&!menuobj.contains(e.toElement))hidemenu()}
document.onclick=hidemenu
document.write("<div class=menuskin id=popmenu onmouseover=highlightmenu(event,'on') onmouseout=highlightmenu(event,'off');dynamichide(event)></div>")
//菜单END


// ------------------弹出window.open窗口--------------------
function openwin(fileName,type,window_width,window_height,property)
{ 
    var top = (window.screen.availHeight-window_height)/2;
    var left = (window.screen.availWidth-window_width)/2;
    if (window_width=="" && window_height=="")
    {
       if (type=="0")
       {
           newWindow=window.open(fileName,"","left="+left+",top="+top+","+property);
       }
       else
       {
           newWindow=window.open(fileName,"","left=0,top=0,"+property);
       }
    }
    else
    {
	    if (type=="0")
		{
		    newWindow=window.open(fileName,"","left=0,top=0,height="+window_height+",width="+window_width+","+property);
		}
		else
		{
			newWindow=window.open(fileName,"","left="+left+",top="+top+",height="+window_height+",width="+window_width+","+property);
		}
       
    }
    
    //newWindow=window.open(fileName,"","resizable=yes,scrollbars=yes,status=yes,toolbar=no,menubar=no,location=no");
    newWindow.focus();
}


function opendialog(fileName,str_dialogWidth,str_dialogHeight,property)
{ 
    var newwindow=window.showModalDialog(fileName,null,"dialogWidth:"+str_dialogWidth+"px;dialogHeight:"+str_dialogHeight+"px;"+property);
    return newwindow;
}


function YearStat()
		{
		    var win=opendialog('Sel.aspx?type=year','400','150','center:1;scroll:0;help:0;status:0');
		    if (win=="" || win==undefined)
		    {
		        return;
		    }
		    var a=win.split('@');
		    document.forms(0).txt_Year.value=a[0];
		    document.forms(0).txt_Month.value="";
		    document.forms(0).btn_Stat.click();
		}
		function MonthStat()
		{
		   var win=opendialog('Sel.aspx?type=month','500','150','center:1;scroll:0;help:0;status:0');
		    if (win=="" || win==undefined)
		    {
		        return;
		    }
		    var a=win.split('@');
		    document.forms(0).txt_Year.value=a[0];
		    document.forms(0).txt_Month.value=a[1];
		    document.forms(0).btn_Stat.click();
		}function CCA(CB,CBID)
{
	objTR=CB.parentNode.parentNode.parentNode;
	if (CB.checked)
	{
		for(var i=0;i<objTR.childNodes.length;i++)
		{
			objTR.childNodes[i].style.backgroundColor="#A4B6D7";
		}
    }
    else
    {
		for(var i=0;i<objTR.childNodes.length;i++)
		{
			objTR.childNodes[i].style.removeAttribute("backgroundColor");
		}
    }
	var oNum = 0;
	var cNum = 0;
	var boxArr=document.getElementsByTagName("input");
	for(var i=0; i<boxArr.length; i++)
	{
		 if(boxArr[i].type=="checkbox")
		 {
			if (boxArr[i].id!=CBID)
			{
				cNum ++;
				if (boxArr[i].checked) oNum ++
			}
		 }
	}
	document.getElementById(CBID).checked = (oNum==cNum);
}
function CA(CBID)
{
   var value = document.getElementById(CBID).checked?true:false;
   var checks = document.getElementsByTagName("input");
   if (value)
   {
		for(var i=0;i<checks.length;i++)
		{
			if(checks[i].type=="checkbox")
			{
				checks[i].checked=true;
				if (checks[i].id=="cb_SelectCancel")
				{}
				else
				{
					objTR=checks[i].parentNode.parentNode.parentNode;
					for(var j=0;j<objTR.childNodes.length;j++)
					{
						objTR.childNodes[j].style.backgroundColor="#A4B6D7";
					}
				}
				
			}
		}
   }
   else
   {
		for(var i=0;i<checks.length;i++)
		{
			if(checks[i].type=="checkbox")
			{
				checks[i].checked=false;
				objTR=checks[i].parentNode.parentNode.parentNode;
				for(var j=0;j<objTR.childNodes.length;j++)
				{
					objTR.childNodes[j].style.removeAttribute("backgroundColor");
				}
			}
		}
   }
}

function cclick(msg,address)
{
	if(confirm(msg))
	{
		window.open(""+address+"","","height=100,width=100","toolbar=no, menubar=no, scrollbars=no,resizable=no,location=no, status=no");
	}
	else
	{
		event.returnValue=false;
	}
}

function HighLightOver()
{
	HighLightList("#E0E6F7");
}
function HighLightOut()
{
	HighLightList("");
}

// 高亮显示当前行
function HighLightList(color)
{
	// 找对象
	var el=event.srcElement;
	var b=false;
	var tabElement=null;
	while (!b)
	{
		el=GetParentElement(el, "TR")
		if (el)
		{
			tabElement=GetParentElement(el, "TABLE");
			if (tabElement!=null && tabElement.className.toUpperCase()=="LIST")
			{
				break;
			}
			el=tabElement;
		}
		else
		{
			return;
		}
	}
	
	// 行下的单元格对象进行高亮处理
	for (var i=0;i<el.children.length;i++)
	{
	    if(el.children[0].children[0].children[0].checked==false){
			if (el.children[i].tagName=="TD")
			{
				el.children[i].style.backgroundColor=color;
			}
		}
	}
}
// 取标签名相同的父对象
function GetParentElement(obj, tag)
{
	while(obj!=null && obj.tagName!=tag)
		obj=obj.parentElement;
	return obj;
}
//document.onmouseover=HighLightOver
//document.onmouseout=HighLightOut