﻿function Ob(o){
 var o=document.getElementById(o)?document.getElementById(o):o;
 return o;
}
function Hd(o) {
 Ob(o).style.display="none";
}
function Sw(o) {
 Ob(o).style.display="";
}
function ExCls(o,a,b,n){
 var o=Ob(o);
 for(i=0;i<n;i++) {o=o.parentNode;}
 o.className=o.className==a?b:a;
}
function terrmenu(id,TagName0) {
  this.id=id;
  this.TagName0=TagName0==""?"li":TagName0;
  this.AllNodes = Ob(this.id).getElementsByTagName(TagName0);
  this.InitCss = function (ClassName0,ClassName1,ClassName2,ImgUrl) {
  this.ClassName0=ClassName0;
  this.ClassName1=ClassName1;
  this.ClassName2=ClassName2;
  this.ImgUrl=ImgUrl || "css/s.gif";
  this.ImgBlankA ="<img src=\""+this.ImgUrl+"\" class=\"s\" onclick=\"ExCls(this,'"+ClassName0+"','"+ClassName1+"',1);\" alt=\"展开/折叠\" />";
  this.ImgBlankB ="<img src=\""+this.ImgUrl+"\" class=\"s\" />";
  for (i=0;i<this.AllNodes.length;i++ ) {
   this.AllNodes[i].className==""?this.AllNodes[i].className=ClassName1:"";
   this.AllNodes[i].innerHTML=(this.AllNodes[i].className==ClassName2?this.ImgBlankB:this.ImgBlankA)+this.AllNodes[i].innerHTML;
   }
 }
 this.SetNodes = function (n) {
  var sClsName=n==0?this.ClassName0:this.ClassName1;
  for (i=0;i<this.AllNodes.length;i++ ) {
   this.AllNodes[i].className==this.ClassName2?"":this.AllNodes[i].className=sClsName;
  }
 }
}
function OPSecond()
{
//if(window.location.pathname.indexOf("index.aspx")==-1)
//{
        var linkNode=null;
        elements=Ob("terrmenu1").getElementsByTagName("a");
        for(i=0;i<elements.length;i++)
        {
            if(elements[i].href.indexOf(window.location.pathname)>0)
            {
           
                linkNode=elements[i].parentNode;
               if(linkNode.className=="Closed")
               {
                linkNode.className="Opened";
               }
                break;
            }
        }
            if(linkNode.parentNode.parentNode.className=="Closed"&&linkNode.parentNode.parentNode.className!="Child")
            {
                   linkNode.parentNode.parentNode.className="Opened";
                
            }
//}
  
}




var Spry;
if (!Spry) Spry = {};
if (!Spry.Widget) Spry.Widget = {};

Spry.Widget.TabbedPanels = function(element, opts)
{
	this.element = this.getElement(element);
	this.defaultTab = 0; // Show the first panel by default.
	this.bindings = [];
	this.tabSelectedClass = "TabbedPanelsTabSelected";
	this.tabHoverClass = "TabbedPanelsTabHover";
	this.tabFocusedClass = "TabbedPanelsTabFocused";
	this.panelVisibleClass = "TabbedPanelsContentVisible";
	this.focusElement = null;
	this.hasFocus = false;
	this.currentTabIndex = 0;
	this.enableKeyboardNavigation = true;

	Spry.Widget.TabbedPanels.setOptions(this, opts);

	// If the defaultTab is expressed as a number/index, convert
	// it to an element.

	if (typeof (this.defaultTab) == "number")
	{
		if (this.defaultTab < 0)
			this.defaultTab = 0;
		else
		{
			var count = this.getTabbedPanelCount();
			if (this.defaultTab >= count)
				this.defaultTab = (count > 1) ? (count - 1) : 0;
		}

		this.defaultTab = this.getTabs()[this.defaultTab];
	}

	if (this.defaultTab)
		this.defaultTab = this.getElement(this.defaultTab);

	this.attachBehaviors();
};

Spry.Widget.TabbedPanels.prototype.getElement = function(ele)
{
	if (ele && typeof ele == "string")
		return document.getElementById(ele);
	return ele;
}

Spry.Widget.TabbedPanels.prototype.getElementChildren = function(element)
{
	var children = [];
	var child = element.firstChild;
	while (child)
	{
		if (child.nodeType == 1 /* Node.ELEMENT_NODE */)
			children.push(child);
		child = child.nextSibling;
	}
	return children;
};

Spry.Widget.TabbedPanels.prototype.addClassName = function(ele, className)
{
	if (!ele || !className || (ele.className && ele.className.search(new RegExp("\\b" + className + "\\b")) != -1))
		return;
	ele.className += (ele.className ? " " : "") + className;
};

Spry.Widget.TabbedPanels.prototype.removeClassName = function(ele, className)
{
	if (!ele || !className || (ele.className && ele.className.search(new RegExp("\\b" + className + "\\b")) == -1))
		return;
	ele.className = ele.className.replace(new RegExp("\\s*\\b" + className + "\\b", "g"), "");
};

Spry.Widget.TabbedPanels.setOptions = function(obj, optionsObj, ignoreUndefinedProps)
{
	if (!optionsObj)
		return;
	for (var optionName in optionsObj)
	{
		if (ignoreUndefinedProps && optionsObj[optionName] == undefined)
			continue;
		obj[optionName] = optionsObj[optionName];
	}
};

Spry.Widget.TabbedPanels.prototype.getTabGroup = function()
{
	if (this.element)
	{
		var children = this.getElementChildren(this.element);
		if (children.length)
			return children[0];
	}
	return null;
};

Spry.Widget.TabbedPanels.prototype.getTabs = function()
{
	var tabs = [];
	var tg = this.getTabGroup();
	if (tg)
		tabs = this.getElementChildren(tg);
	return tabs;
};

Spry.Widget.TabbedPanels.prototype.getContentPanelGroup = function()
{
	if (this.element)
	{
		var children = this.getElementChildren(this.element);
		if (children.length > 1)
			return children[1];
	}
	return null;
};

Spry.Widget.TabbedPanels.prototype.getContentPanels = function()
{
	var panels = [];
	var pg = this.getContentPanelGroup();
	if (pg)
		panels = this.getElementChildren(pg);
	return panels;
};

Spry.Widget.TabbedPanels.prototype.getIndex = function(ele, arr)
{
	ele = this.getElement(ele);
	if (ele && arr && arr.length)
	{
		for (var i = 0; i < arr.length; i++)
		{
			if (ele == arr[i])
				return i;
		}
	}
	return -1;
};

Spry.Widget.TabbedPanels.prototype.getTabIndex = function(ele)
{
	var i = this.getIndex(ele, this.getTabs());
	if (i < 0)
		i = this.getIndex(ele, this.getContentPanels());
	return i;
};

Spry.Widget.TabbedPanels.prototype.getCurrentTabIndex = function()
{
	return this.currentTabIndex;
};

Spry.Widget.TabbedPanels.prototype.getTabbedPanelCount = function(ele)
{
	return Math.min(this.getTabs().length, this.getContentPanels().length);
};

Spry.Widget.TabbedPanels.addEventListener = function(element, eventType, handler, capture)
{
	try
	{
		if (element.addEventListener)
			element.addEventListener(eventType, handler, capture);
		else if (element.attachEvent)
			element.attachEvent("on" + eventType, handler);
	}
	catch (e) {}
};

Spry.Widget.TabbedPanels.prototype.onTabClick = function(e, tab)
{
	this.showPanel(tab);
};

Spry.Widget.TabbedPanels.prototype.onTabMouseOver = function(e, tab)
{
	this.showPanel (tab);
};

Spry.Widget.TabbedPanels.prototype.onTabMouseOut = function(e, tab)
{
	this.removeClassName(tab, this.tabHoverClass);
};

Spry.Widget.TabbedPanels.prototype.onTabFocus = function(e, tab)
{
	this.hasFocus = true;
	this.addClassName(this.element, this.tabFocusedClass);
};

Spry.Widget.TabbedPanels.prototype.onTabBlur = function(e, tab)
{
	this.hasFocus = false;
	this.removeClassName(this.element, this.tabFocusedClass);
};

Spry.Widget.TabbedPanels.ENTER_KEY = 13;
Spry.Widget.TabbedPanels.SPACE_KEY = 32;

Spry.Widget.TabbedPanels.prototype.onTabKeyDown = function(e, tab)
{
	var key = e.keyCode;
	if (!this.hasFocus || (key != Spry.Widget.TabbedPanels.ENTER_KEY && key != Spry.Widget.TabbedPanels.SPACE_KEY))
		return true;

	this.showPanel(tab);

	if (e.stopPropagation)
		e.stopPropagation();
	if (e.preventDefault)
		e.preventDefault();

	return false;
};

Spry.Widget.TabbedPanels.prototype.preorderTraversal = function(root, func)
{
	var stopTraversal = false;
	if (root)
	{
		stopTraversal = func(root);
		if (root.hasChildNodes())
		{
			var child = root.firstChild;
			while (!stopTraversal && child)
			{
				stopTraversal = this.preorderTraversal(child, func);
				try { child = child.nextSibling; } catch (e) { child = null; }
			}
		}
	}
	return stopTraversal;
};

Spry.Widget.TabbedPanels.prototype.addPanelEventListeners = function(tab, panel)
{
	var self = this;
	Spry.Widget.TabbedPanels.addEventListener(tab, "click", function(e) { return self.onTabClick(e, tab); }, false);
	Spry.Widget.TabbedPanels.addEventListener(tab, "mouseover", function(e) { return self.onTabMouseOver(e, tab); }, false);
	Spry.Widget.TabbedPanels.addEventListener(tab, "mouseout", function(e) { return self.onTabMouseOut(e, tab); }, false);

	if (this.enableKeyboardNavigation)
	{
		// XXX: IE doesn't allow the setting of tabindex dynamically. This means we can't
		// rely on adding the tabindex attribute if it is missing to enable keyboard navigation
		// by default.

		// Find the first element within the tab container that has a tabindex or the first
		// anchor tag.
		
		var tabIndexEle = null;
		var tabAnchorEle = null;

		this.preorderTraversal(tab, function(node) {
			if (node.nodeType == 1 /* NODE.ELEMENT_NODE */)
			{
				var tabIndexAttr = tab.attributes.getNamedItem("tabindex");
				if (tabIndexAttr)
				{
					tabIndexEle = node;
					return true;
				}
				if (!tabAnchorEle && node.nodeName.toLowerCase() == "a")
					tabAnchorEle = node;
			}
			return false;
		});

		if (tabIndexEle)
			this.focusElement = tabIndexEle;
		else if (tabAnchorEle)
			this.focusElement = tabAnchorEle;

		if (this.focusElement)
		{
			Spry.Widget.TabbedPanels.addEventListener(this.focusElement, "focus", function(e) { return self.onTabFocus(e, tab); }, false);
			Spry.Widget.TabbedPanels.addEventListener(this.focusElement, "blur", function(e) { return self.onTabBlur(e, tab); }, false);
			Spry.Widget.TabbedPanels.addEventListener(this.focusElement, "keydown", function(e) { return self.onTabKeyDown(e, tab); }, false);
		}
	}
};

Spry.Widget.TabbedPanels.prototype.showPanel = function(elementOrIndex)
{
	var tpIndex = -1;
	
	if (typeof elementOrIndex == "number")
		tpIndex = elementOrIndex;
	else // Must be the element for the tab or content panel.
		tpIndex = this.getTabIndex(elementOrIndex);
	
	if (!tpIndex < 0 || tpIndex >= this.getTabbedPanelCount())
		return;

	var tabs = this.getTabs();
	var panels = this.getContentPanels();

	var numTabbedPanels = Math.max(tabs.length, panels.length);

	for (var i = 0; i < numTabbedPanels; i++)
	{
		if (i != tpIndex)
		{
			if (tabs[i])
				this.removeClassName(tabs[i], this.tabSelectedClass);
			if (panels[i])
			{
				this.removeClassName(panels[i], this.panelVisibleClass);
				panels[i].style.display = "none";
			}
		}
	}

	this.addClassName(tabs[tpIndex], this.tabSelectedClass);
	this.addClassName(panels[tpIndex], this.panelVisibleClass);
	panels[tpIndex].style.display = "block";

	this.currentTabIndex = tpIndex;
};

Spry.Widget.TabbedPanels.prototype.attachBehaviors = function(element)
{
	var tabs = this.getTabs();
	var panels = this.getContentPanels();
	var panelCount = this.getTabbedPanelCount();

	for (var i = 0; i < panelCount; i++)
		this.addPanelEventListeners(tabs[i], panels[i]);

	this.showPanel(this.defaultTab);
};


<!-- from index.asp
function setTab(name,cursel,n){
for(i=1;i<=n;i++){
var menu=document.getElementById(name+i);
var con=document.getElementById("con_"+name+"_"+i);
menu.className=i==cursel?"hover":"";
con.style.display=i==cursel?"block":"none";
}
}

function search () { 
        var q=document.getElementsByName("q")[0].value; 
        
        var link="http://www.google.com/custom?domains=" + website + "&sa=Search&sitesearch=" + website + "&ie=UTF-8&oe=UTF-8&hl=zh-CN" + "&q=" + EncodeUtf8(q) ; 
        
        //website + "&q=" + to_search[0].value; 
        
        window.open(link); 
        } 
        function EncodeUtf8(s1) 
        { 
        var s = escape(s1); 
        var sa = s.split("%"); 
        var retV =""; 
        if(sa[0] != "") 
        { 
        retV = sa[0]; 
        } 
        for(var i = 1; i < sa.length; i ++) 
        { 
        if(sa[i].substring(0,1) == "u") 
        { 
        retV += Hex2Utf8(Str2Hex(sa[i].substring(1,5))); 
        } 
        else retV += "%" + sa[i]; 
        } 
        return retV; 
        } 
        function Str2Hex(s) 
        { 
        var c = ""; 
        var n; 
        var ss = "0123456789ABCDEF"; 
        var digS = ""; 
        for(var i = 0; i < s.length; i ++) 
        { 
        c = s.charAt(i); 
        n = ss.indexOf(c); 
        digS += Dec2Dig(eval(n)); 
        } 
        //return value; 
        return digS; 
        } 
        function Dec2Dig(n1) 
        { 
        var s = ""; 
        var n2 = 0; 
        for(var i = 0; i < 4; i++) 
        { 
        n2 = Math.pow(2,3 - i); 
        if(n1 >= n2) 
        { 
        s += '1'; 
        n1 = n1 - n2; 
        } 
        else 
        s += '0'; 
        } 
        return s; 
        } 
        function Dig2Dec(s) 
        { 
        var retV = 0; 
        if(s.length == 4) 
        { 
        for(var i = 0; i < 4; i ++) 
        { 
        retV += eval(s.charAt(i)) * Math.pow(2, 3 - i); 
        } 
        return retV; 
        } 
        return -1; 
        } 
        function Hex2Utf8(s) 
        { 
        var retS = ""; 
        var tempS = ""; 
        var ss = ""; 
        if(s.length == 16) 
        { 
        tempS = "1110" + s.substring(0, 4); 
        tempS += "10" + s.substring(4, 10); 
        tempS += "10" + s.substring(10,16); 
        var sss = "0123456789ABCDEF"; 
        for(var i = 0; i < 3; i ++) 
        { 
        retS += "%"; 
        ss = tempS.substring(i * 8, (eval(i)+1)*8); 
        retS += sss.charAt(Dig2Dec(ss.substring(0,4))); 
        retS += sss.charAt(Dig2Dec(ss.substring(4,8))); 
        } 
        return retS; 
        } 
        return ""; 
        } 
//-->


<!-- from CommonFun.asp -->
<!--
function mOverMenu(menuItem){
//	menuItem.style.borderColor = "#5C7FBB";
//	menuItem.style.color="#ffffff";
}
function mOutMenu(menuItem){
//	menuItem.style.borderColor = "#5C7FBB";//#95b4ea
//	menuItem.style.color="#EEEEEE";
}
function mDown(url) {
	window.location = url;
}
function Login(frm)
{
   if(frm.username.value=="")
   {
      alert("请输入用户名!");
      return false;
    }
    if(frm.userpwd.value=="")
    {
     alert("密码不能为空!");
     return false;
     }

     frm.method ="post";
	 frm.action ="login.asp";
	 frm.submit();
	 return true;
}
function NewLogin(frm)
{	
	 frm.method ="post";
	 frm.action ="Register.asp";
	 frm.submit();
	 return true;
}



var redx="&nbsp;<font color=#FF0000>*</font>&nbsp;"
function frm_submitonce(theform)
{
  if (document.all||document.getElementById)
  {
    for (i=0;i<theform.length;i++)
    {
      var tempobj=theform.elements[i]
      if(tempobj.type.toLowerCase()=="submit"||tempobj.type.toLowerCase()=="reset") { tempobj.disabled=true; }
    }
  }
}

function frm_quicksubmit(eventobject) { if (event.keyCode==13 && event.ctrlKey) write_frm.submit(); }

function jk_icon(inum)
{
  var temp1="";
  for(var i=0; i<10; i++)
  {
    temp1+="<img border=0 src='"+web_dir+"images/icon/"+i+".gif'>&nbsp;<input class=bg_td type=radio value='"+i+"' name=icon";
    if (inum==i) { temp1+=" checked"; }
    temp1+=">&nbsp;";
  }
  return temp1;
}

function isCharsInBag(inputchar, bagchar)
{ 
  var ii,cc;
  for (ii = 0; ii < inputchar.length; ii++)
  { 
    cc = inputchar.charAt(ii);
    if (bagchar.indexOf(cc) > -1) { return "no"; }
    else { return "yes"; }
  }
}
function check(write_frm)
{
  var errorcharname="><,[>{}?/+=|\\'\":;~!#$%()`@";
  var errorcharqq="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz><,[>{}?/+=|\\'\":;~!#$%()`";
  var wr_name=write_frm.wrname.value;
  if(wr_name=="" || wr_name==null)
  {
    alert("你还没完全留下所需信息！\r\n你的 名字 是必须要的。");
    document.write_frm.wrname.focus();
    return false;
  }
  var errorname=isCharsInBag(wr_name,errorcharname);
  if ( errorname=="no" )
  {
    alert("你的 名字 不得含有以下字符！\r\n  ><,[{}?/+=|\\'\":;~!#$%()`");
    document.write_frm.wrname.focus();
    return false;
  }
  var wr_email=write_frm.wremail.value;
  if(wr_email!=="")
  {
    var AtSym = wr_email.indexOf('@');
    var Period = wr_email.lastIndexOf('.');
    var Space = wr_email.indexOf(' ');
    var Length = wr_email.length - 1;
    if ((AtSym < 1) || (Period <= AtSym+1) || (Period == Length ) || (Space != -1))
    { 
      alert('你的 eMail地址 格式不对！\r\n请重新输入。');
      document.write_frm.wremail.focus();
      return false;
    } 
  }
  var wr_whe=write_frm.wrwhe.value;
  if(wr_whe!=="")
  {
    var errorwhe=isCharsInBag(wr_whe,errorcharname);
    if ( errorwhe=="no" )
    {
      alert("你的 来自 不得含有以下字符！\r\n  ><,[{}?/+=|\\'\":;~!#$%()`");
      document.write_frm.wrwhe.focus();
      return false;
    }
  }
  var wr_topic=write_frm.wrtopic.value;
  if(wr_topic=="")
  {
    alert("你还没完全留下所需信息！\r\n你的 主题 是必须要的。");
    document.write_frm.wrtopic.focus();
    return false;
  }
  var wr_word=write_frm.wrword.value;
  if(wr_word=="")
  {
    alert("你还没完全留下所需信息！\r\n你的 留言内容 是必须要的。");
    document.write_frm.wrword.focus();
    return false;
  }
}
function reset(write_frm)
{
  if (confirm("该项操作要清除全部的内容，你确定要清除吗?")) { return true; }
  return false;
}
function showimage() { document.images.wrimg.src = "images/face/"+document.write_frm.wrface.options[document.write_frm.wrface.selectedIndex].value+".gif"; }

function FloatDiv(id)
{
	this.ID = id;
	this.ObjMove = document.getElementById(id);
	this.LastScrollY = 0; // 已经移动
	FloatDiv.prototype.Move = function(obj)
	{
		var scrollTop;
		if (document.documentElement && document.documentElement.scrollTop)
			scrollTop = document.documentElement.scrollTop;
		else if (document.body)
			scrollTop = document.body.scrollTop;
		var percent; // 本次移动像素
		percent = (scrollTop - obj.LastScrollY) * 0.1; // 每次移动10%
		if(percent > 0) percent = Math.ceil(percent); // 截掉小数，数字会变大
		else percent = Math.floor(percent); // 截掉小数，数字会变小
		obj.ObjMove.style.top = parseInt(obj.ObjMove.style.top) + percent + 'px';
		obj.LastScrollY = obj.LastScrollY + percent;
	};
	FloatDiv.prototype.Init = function(obj)
	{
		if (!obj.ObjMove)
		{
			alert('对象不存在');
			return;
		}
		window.setInterval(this.BindInterval(this.Move, obj), 10);
	};
	 // 绑定参数，window.setInterval，不能指定参数，需要绑定
	FloatDiv.prototype.BindInterval = function(funcName)
	{
		var args = [];
		for(var i = 1; i < arguments.length; i++)
		{
			args.push(arguments[i]);
		}
		return function() { funcName.apply(this, args); }
	};
}




