function ShowPannel(btn){
	var idname = new String(btn.id);
	var s = idname.indexOf("_");
	var e = idname.lastIndexOf("_")+1;
	var tabName = idname.substr(0, s);
	var id = parseInt(idname.substr(e, 1));
	var tabNumber = btn.parentNode.childNodes.length;
	for(i=0;i<tabNumber;i++){
		document.getElementById(tabName+"_tab_"+i).style.display = "none";
		document.getElementById(tabName+"_btn_"+i).className = "";
	};
	document.getElementById(tabName+"_tab_"+id).style.display = "block";
	btn.className = "NowTag";
}

function AjaxShowPannel(btn){
	var idname = new String(btn.id);
	var s = idname.indexOf("_");
	var e = idname.lastIndexOf("_")+1;
	var tabName = idname.substr(0, s);
	var id = idname.substr(s, e-s);
	var tabNumber = btn.parentNode.childNodes.length;
	var menu =  new String(btn.getAttributeNode("menu").nodeValue);	//getAttributeNode("menu").nodeValue 兼容FF3。0
	var ajaxurl = new String(btn.parentNode.getAttributeNode("ajaxurl").nodeValue) + '&' + menu;
	for(i=0;i<tabNumber;i++){
		document.getElementById(tabName+id+i).className = "";
	};
	btn.className = "NowTag";
	$(tabName).innerHTML = '<table cellspacing=0 cellpadding=0 width="100%" class="PannelBody"><tr><td><img src="images/loading.gif" border=0 /></td></tr></table>';
	Ajax_CallBack(false,tabName,ajaxurl);
}


function iboxActive(id, key, num, max) {
var menu = document.getElementById(id + "menu");
(menu.getElementsByTagName("INPUT")[0]||{}).value = key;
var main = menu.parentNode;
var applyfilter;
var menudivs = menu.getElementsByTagName("DIV");
for (var i = 0; i < menudivs.length; i ++) {
menudivs[i].className = id+"menuoff";
(menudivs[i].getElementsByTagName("A")[0]||{}).className = "";
}
menudivs[num].className = id+"menuon"+(num % max);
(menudivs[num].getElementsByTagName("A")[0]||{}).className = "active";
try {
applyfilter = main.filters && main.filters[0];
if (applyfilter) {
   main.filters[0].apply();
}
} catch(e) {}
var parent = menu.parentNode;
var childs = parent.childNodes;
var divs = [];
for (var i = 0, c = childs.length; i < c; i ++) {
if (childs[i].tagName == 'DIV') {
   if (divs.length) childs[i].style.display = 'none';
   divs[divs.length] = childs[i];
}
}
divs[num+1].style.display = 'block';
try {
if (applyfilter) {
   main.filters[0].play();
}
} catch(e) {}
}


/*显示验证码*/
function getVerifyCode() {
	if(document.getElementById("VerifyCodeImgID"))
		document.getElementById("VerifyCodeImgID").innerHTML = '<img src="VerifyCode.asp?t='+Math.random()+'" alt="点击刷新验证码" style="cursor:pointer;border:0;vertical-align:middle;" onclick="this.src=\'VerifyCode.asp?t=\'+Math.random()" />'
}
function CheckVerifyCode(VerifyCode) {
	var patrn=/^\d+$/;		//纯数字
	if(!patrn.exec(VerifyCode)) {
		ShowCheckResult("CheckVerifyCode", "您没有输入验证码或输入有误。","error");
		return;
	}
	Ajax_CallBack(false,"CheckVerifyCode","Loading.asp?menu=CheckVerifyCode&VerifyCode=" + VerifyCode);
}



/*首页滚动代码*/

function Marquee()
{
	this.ID = document.getElementById(arguments[0]);
	this.Direction = arguments[1];
	this.Step = arguments[2];
	this.Width = arguments[3];
	this.Height = arguments[4];
	this.Timer = arguments[5];
	this.WaitTime = arguments[6];
	this.StopTime = arguments[7];
	if(arguments[8])
		this.ScrollStep = arguments[8]
	else
		this.ScrollStep = this.Direction>1 ? this.Width : this.Height;
	this.CTL = this.StartID = this.Stop = this.MouseOver = 0;
	this.ID.style.overflowX = this.ID.style.overflowY = "hidden";
	this.ID.noWrap = true;
	this.ID.style.width = this.Width;
	this.ID.style.height = this.Height;
	this.ClientScroll = this.Direction>1 ? this.ID.scrollWidth : this.ID.scrollHeight;
	this.ID.innerHTML += this.ID.innerHTML;
	this.Start(this,this.Timer,this.WaitTime,this.StopTime);
}
Marquee.prototype.Start = function(msobj,timer,waittime,stoptime)
{
	msobj.StartID = function(){msobj.Scroll()}
	msobj.Continue = function()
				{
					if(msobj.MouseOver == 1)
					{
						setTimeout(msobj.Continue,waittime);
					}
					else
					{	clearInterval(msobj.TimerID);
						msobj.CTL = msobj.Stop = 0;
						msobj.TimerID = setInterval(msobj.StartID,timer);
					}
				}
	msobj.Pause = function()
			{
				msobj.Stop = 1;
				clearInterval(msobj.TimerID);
				setTimeout(msobj.Continue,waittime);
			}
	msobj.Begin = function()
	{
		msobj.TimerID = setInterval(msobj.StartID,timer);
		msobj.ID.onmouseover = function()
					{
						msobj.MouseOver = 1;
						clearInterval(msobj.TimerID);
					}
		msobj.ID.onmouseout = function()
					{
						msobj.MouseOver = 0;
						if(msobj.Stop == 0)
						{
							clearInterval(msobj.TimerID);
							msobj.TimerID = setInterval(msobj.StartID,timer);
						}
					}
	}
	setTimeout(msobj.Begin,stoptime);
}
Marquee.prototype.Scroll = function()
{
	switch(this.Direction)
	{
		case 0:
			this.CTL += this.Step;
			if(this.CTL >= this.ScrollStep && this.WaitTime > 0)
			{
				this.ID.scrollTop += this.ScrollStep + this.Step - this.CTL;
				this.Pause();
				return;
			}
			else
			{   
				if(this.ID.scrollTop >= this.ClientScroll)
				{
					this.ID.scrollTop -= this.ClientScroll;
				}
				this.ID.scrollTop += this.Step;
			}
		break;
		case 1:
			this.CTL += this.Step;
			if(this.CTL >= this.ScrollStep && this.WaitTime > 0)
			{
				this.ID.scrollTop -= this.ScrollStep + this.Step - this.CTL;
				this.Pause();
				return;
			}
			else
			{
				if(this.ID.scrollTop <= 0)
				{
					this.ID.scrollTop += this.ClientScroll;
				}
				this.ID.scrollTop -= this.Step;
			}
		break;
		case 2:
			this.CTL += this.Step;
			if(this.CTL >= this.ScrollStep && this.WaitTime > 0)
			{
				this.ID.scrollLeft += this.ScrollStep + this.Step - this.CTL;
				this.Pause();
				return;
			}
			else
			{
				if(this.ID.scrollLeft >= this.ClientScroll)
				{
					this.ID.scrollLeft -= this.ClientScroll;
				}
				this.ID.scrollLeft += this.Step;
			}
		break;
		case 3:
			this.CTL += this.Step;
			if(this.CTL >= this.ScrollStep && this.WaitTime > 0)
			{
				this.ID.scrollLeft -= this.ScrollStep + this.Step - this.CTL;
				this.Pause();
				return;
			}
			else
			{
				if(this.ID.scrollLeft <= 0)
				{
					this.ID.scrollLeft += this.ClientScroll;
				}
				this.ID.scrollLeft -= this.Step;
			}
		break;
	}
}