function Change()
{
	// 根据事事件变单 TR 背景色
	this.Color = function (evt, hightlightColor)
	{
		var evt = (evt ? evt :(window.event ? window.event :null));

		var obj = evt.target ? evt.target : evt.srcElement;

		TRElement = this.getObjTR(obj);

		if (TRElement.tagName == "TR")
		{
			TRElement.style.backgroundColor = hightlightColor;
		}
	}

	// 查找  TR
	this.getObjTR = function(obj)
	{
		if (obj && obj.tagName != "TD")
		{
			obj = obj.parentNode ? obj.parentNode : obj.parentElement;
			obj = this.getObjTR(obj);
		}
		else
		{
			obj = obj.parentNode ? obj.parentNode : obj.parentElement;
		}

		return obj;
	}

	// 查找 TD
	this.getObjTD = function(obj)
	{
		if (obj && obj.tagName != "TD")
		{
			obj = obj.parentNode ? obj.parentNode : obj.parentElement;
			obj = this.getObjTD(obj);
		}

		return obj;
	}

	// 交换图片 如果 a-1.gif, a-2.gif是一组
	this.Image = function (evt , ImageName, suffix)
	{
		var evt = (evt ? evt : (window.event ? window.event : null));

		var obj = evt.target ? evt.target : evt.srcElement;

		var suffix = suffix ? suffix : "gif";

		if (obj.nodeName == "IMG")
		{
			if (obj.src.indexOf(ImageName + "-1" + suffix) > -1 )
			{
				obj.src = ImageName + "-2" + suffix;
			}
			else
			{
				obj.src = ImageName + "-1" + suffix;
			}
		}
	}

	// 全选/全不选
	this.CheckBox = function (evt, FormName, Check)
	{
		var evt = (evt ? evt : (window.event ? window.event : null));
		var obj = evt.target ? evt.target : evt.srcElement;

		if (obj.nodeName == "INPUT")
		{
			var ELength = window.document.forms[FormName].elements.length;
			if (!Check) var Check = "Del_index";

			var Is_Checked = obj.checked;

			for(var i=0; i<ELength;i++)
			{
				e = window.document.forms[FormName].elements[i];
				if (e.name && e.name.indexOf(Check) != -1)
				{
					e.checked = Is_Checked;
				}
			}
		}
	}

	// 翻页跳转
	this.gotoTurn = function (evt, More)
	{
		var Reg = /[^0-9]/;
		var evt = evt ? evt : (window.event ? window.event :null);
		var selfP = window.location.href;


		// 最后出现 "/" 的位置
		LastSplash = selfP.lastIndexOf("/");
		// 最后出现 "?" 的位置
		LastQ = selfP.lastIndexOf("?");
		if (LastQ == -1)
		{
			selfPage = selfP.substr(LastSplash+1);
		}
		else
		{
			selfPage = selfP.substring((LastSplash+1), LastQ);
		}

		if (evt.keyCode == 13)
		{
			// 按下回车
			var PageNum = window.document.getElementById('JumpPage');
			if (PageNum.value)
			{
				if (Reg.test(PageNum.value))
				{
					alert("请正确填写数字！");
					try
					{
						PageNum.focus();
					}
					catch(e)
					{
						return false;
					}
					return false;
				}
				else
				{
					window.location=selfPage+"?P="+PageNum.value+More;
				}
			}
			else
			{
				alert("请填写你要跳转的页面！");
					try
					{
						PageNum.focus();
					}
					catch(e)
					{
						return false;
					}
					return false;
			}
		}
	}
}

function behavior(obj)
{

	obj.onmousedown = function()
	{
		obj.className="ButtonDown";
	}
	obj.onmouseup = function()
	{
		obj.className="ButtonUp";
	}

	obj.onmouseover = function()
	{
		obj.className="ButtonUp";
	}

	obj.onmouseout = function()
	{
		obj.className="ButtonNone";
	}
}

function Show(Div)
{
	var sDiv = document.getElementById(Div);
	sDiv.style.visibility = "visible";
}

function Hide(Div)
{
	var sDiv = document.getElementById(Div);
	sDiv.style.visibility = "hidden";
}