﻿//获取ID,Name,TagName对像
function _id(ControlsID)
{
    return document.getElementById(ControlsID);
}
//读取控件 带母版
function _id_ct(ControlsID)
{
    return document.getElementById("ctl00_ContentPlaceHolder1_"+ControlsID);
}
//读取控件 用户控件
function _id_ct2(ControlsID)
{
    return document.getElementById("LoginControl1_"+ControlsID);
}
//将除头模板中的其它所有的CheckBox取反
function SelectAll(tempControl)
{
	var theBox=tempControl;
	xState=theBox.checked;
	elem=theBox.form.elements;
	for(i=0;i<elem.length;i++)
	if(elem[i].type=="checkbox" && elem[i].id!=theBox.id)
	{
		if(elem[i].checked!=xState)
		elem[i].click();
	}
}
//选中后改变背景色
function SelectColor(field)
{
	var selectcolor = field.checked;selectcolor?field.parentNode.parentNode.parentNode.style.backgroundColor="#FFFFCC":field.parentNode.parentNode.parentNode.style.backgroundColor="";
}
//添加onload事件
function addEventHandler (oTarget, sEventType, fnHandler)
{
    if (oTarget.addEventListener) {
        oTarget.addEventListener(sEventType, fnHandler, false);
    } else if (oTarget.attachEvent) {
        oTarget.attachEvent("on" + sEventType, fnHandler);
    } else {
        oTarget["on" + sEventType] = fnHandler;
    }
}
//添加到收藏夹，兼容FireFox和ie
function addBookmark(url,title) 
{
    if (window.sidebar) 
    { 
        window.sidebar.addPanel(title, url,""); 
    } 
    else if(document.all) 
    {
        window.external.AddFavorite(url, title);
    } 
    else if(window.opera && window.print) 
    {
        return true;
    }
}
function setContentNav(n,s)
{
	var a=_id(n).getElementsByTagName("a");
	for(var i=0;i<a.length;i++)
	{
		if(a[i].innerHTML==s)
		{
			a[i].className="AboutMenu_sel";
			_id("li"+i).className="AboutMenuBg";
		}
    }
}
