﻿var isIE=window.navigator.appName.indexOf("Internet Explorer")>-1;var isIE7=isIE&&(window.navigator.userAgent.indexOf("MSIE 7.0")>-1);var isOpera=window.navigator.appName.indexOf("Opera")>-1;var isGecko=window.navigator.appName.indexOf("Netscape")>-1;function $(id){return document.getElementById(id);}
function $C(tag,ps){var c=document.createElement(tag);if(ps)
for(var i in ps)
if(ps[i]==null||ps[i].constructor!=Function)
c[i]=ps[i];return c;}
function $CT(txt){return document.createTextNode(txt);}
function $E(e){return isIE?event:e;}
function $E_C(e){if(isGecko)
{e.preventDefault();e.stopPropagation();}
else
{e.cancelBubble=true;e.returnValue=false;}}
function $E_T(e){return isIE?event.srcElement:e.target;}
function $X(s){var x=0;while(s.offsetLeft||s.offsetParent){x+=s.offsetLeft;if(!s.offsetParent)break;s=s.offsetParent;}
return x;}
function $Y(s){var y=0;while(s.offsetTop||s.offsetParent){y+=s.offsetTop;if(!s.offsetParent)break;s=s.offsetParent;}
return y;}
function $XY(t,s,xx,yy){t.style.left=($X(s)+(xx?xx:0))+"px";t.style.top=($Y(s)+(yy?yy:0))+"px";}
function $DOM_CDP(a,b){return a.compareDocumentPosition?a.compareDocumentPosition(b):a.contains?(a!=b&&a.contains(b)&&16)+
(a!=b&&b.contains(a)&&8)+
(a.sourceIndex>=0&&b.sourceIndex>=0?(a.sourceIndex<b.sourceIndex&&4)+
(a.sourceIndex>b.sourceIndex&&2):1):0;}
function $DOM_CONTAINS(a,b){if(a.compareDocumentPosition)
{var z=a.compareDocumentPosition(b);if((z&16)==16)
return 1;else if((z&8)==8)
return-1;else
return 0;}
if(a==document||a.contains(b))
return 1;else if(b==document||b.contains(a))
return-1;else
return 0;}
var $ID_Counter=0;function $ID(t){if(t.id)
return t.id;if(isIE)
t.id=t.uniqueID;else
t.id="__"+(t.tagName?t.tagName:"DOM")+"_"+new Date().valueOf()+"_"+(++$ID_Counter);return t.id;}
Array.prototype.IndexOf=function(ele){for(var i=0,il=this.length;i<il;i++)
if(this[i]==ele)
return i;return-1;}
Array.prototype.Distinct=function(){var a=this.concat().sort();var b=new Array();if(a.length>0)
b[0]=a[0];for(var i=1,il=a.length;i<il;i++)
if(a[i]!=a[i-1])
b[b.length]=a[i];a=null;return b;}
Array.prototype.Append=function(a){if(a.constructor==Array)
Array.prototype.push.apply(this,a);else
this.push(a);}
Array.prototype.AppendHTMLElementArray=function(a){for(var i=0,z=a.length;i<z;i++)
this.push(a[i]);}
Array.prototype.Remove=function(z){if(z>this.length-1)
throw"索引超过边界";for(var i=z,il=this.length-1;i<il;i++)
this[i]=this[i+1];--this.length;}
Array.prototype.RemoveNode=function(node,isglobal){for(var i=0,il=this.length;i<il;i++)
if(this[i]==node){for(var j=i,k=this.length-1;j<k;j++)
this[j]=this[j+1];--this.length;if(!isglobal)
return;--i;}}
String.prototype.TrimEnd=function(ch){if(ch&&ch.constructor==String&&ch.length>1)
throw"参数应为字符";var p=this.length-1;while(p>-1)
{if(ch?(this.charAt(p)!=ch):!this.charAt(p).IsBlank())
break;--p;}
return this.substring(0,p+1);}
String.prototype.Trim=function(ch){if(ch&&ch.constructor==String&&ch.length>1)
throw"参数应为字符";var p0=0,p1=this.length-1;for(var i=0,il=this.length;i<il;i++)
{if(ch?(this.charAt(i)!=ch):!this.charAt(i).IsBlank())
{p0=i;break;}}
for(var i=this.length-1,il=Math.max(p0,0);i>=il;i--)
{if(ch?(this.charAt(i)!=ch):!this.charAt(i).IsBlank())
{p1=i;break;}}
return this.substring(p0,p1+1);}
String.prototype.GetUrlParameter=function(p){var t=this.replace(new RegExp("(^[^?]*([?&][^&$]*)*[?&]"+p+"=)([^&]+)((&.*$)|$)","i"),"$3");return(t==this)?null:t;}
String.prototype.IsNumeric=function(ignoreempty){if(ignoreempty&&this.IsNullOrEmpty())
return true;return!isNaN(parseFloat(this))&&/^\s*\-?\d+(\.\d+)?\s*$/.test(this);}
String.prototype.IsBlank=function(){if(this.length==0)
return true;for(var i=0,il=this.length;i<il;i++)
{var c=this.charCodeAt(i);if(c!=9&&c!=32&&c!=0x3000)
return false;}
return true;}
String.prototype.IsNullOrEmpty=function(){if(this.length==0)
return true;return/^[\s\u3000]+$/.test(this);}
String.prototype.IsDate=function(){return/^\s*(\d{2,4})([\-\.\/])(\d{1,2})\2(\d{1,2})\s*$/.test(this);}
String.prototype.ToDate=function(){var m=this.match(/^\s*(\d{2,4})([\-\.\/])(\d{1,2})\2(\d{1,2})\s*$/);if(!m)
return null;var yy=parseInt(m[1]),mm=parseInt(m[3]),dd=parseInt(m[4]);if(mm>12)
return null;if(yy<10)
yy+=2000;else if
(yy<100)yy+=1900;return new Date(mm+"/"+dd+"/"+yy);}
Object.prototype.IsChildOf=function(a){for(var i=0,z=a.length;i<z;i++)
if(this==a[i])
return true;return false;}
var LMGR={CLICK:"onclick",DOUBLECLICK:"ondblclick",CONTEXTMENU:"oncontextmenu",MOUSEOVER:"onmouseover",MOUSEOUT:"onmouseout",MOUSEMOVE:"onmousemove",MOUSEDOWN:"onmousedown",MOUSEUP:"onmouseup",KEYPRESS:"onkeypress",KEYDOWN:"onkeydown",KEYUP:"onkeyup",FOCUS:"onfocus",BLUR:"onblur",_d:{},Reg:function(t,et,lis,lsna,ios,mios)
{var ls=this._gLsnL(t,true);if(!ls.HasLsns(et))
eval("t."+et+" = function(e) { LMGR._hE(\""+et+"\", $E(e)); }");ls.AddLis(et,lis,lsna,ios,mios);},Unreg:function(t,et,lis,lsna,ios)
{var ls=this._gLsnL(t,false);if(ls)
ls.RmvLsns(et,lis,lsna,ios);},_gLsnL:function(t,n)
{var o=this._d[$ID(t)];if(!o&&n)
o=this._d[$ID(t)]=new LMLL();return o;},_gLsns:function(t,et)
{var o=this._d[$ID(t)];return o?o.GetLsns(et,false):null;},_hE:function(et,e)
{with(LMGR)
{var t=$E_T(e);var iT=t;while(t)
{var ls=this._gLsns(t,et);if(ls)
for(var i=0;i<ls.length;i++)
{if(ls[i].CIO(iT))
continue;if(ls[i].LsnA)
ls[i].Lis($E(e),ls[i].LsnA);else
ls[i].Lis($E(e));}
t=t.parentNode;}}},Inspect:function()
{}}
function LMLL()
{this.LsnD={};this.RmvLsns=function(et,lis,lsna,ios)
{if(et)
{var ls=this.GetLsns(et,false);if(lis!=null)
{for(var i=0;i<ls.length;i++)
if(ls[i].Lis==lis&&(lsna==null?true:(ls[i].LsnA==lsna)))
{if(ios)
{ls[i].RmvIOs(ios);}
else
{for(var j=i;j<ls.length-1;j++)
{ls[j]=ls[j+1];}
ls.length--;}
return;}}
else
{ls.length=0;}}
else
{this.LsnD={};}}
this.HasLsns=function(et)
{if(this.LsnD[et.toUpperCase()])
return true;return false;}
this.GetLsns=function(et,bn)
{var c;et=et.toUpperCase();c=this.LsnD[et];if(!c&&bn)
c=this.LsnD[et]=[];return c?c:null;}
this.AddLis=function(et,lis,lsna,ios,mios)
{var ls=this.GetLsns(et,true);for(var i=0;i<ls.length;i++)
if(ls[i].Lis==lis&&ls[i].LsnA==lsna)
{ls[i].AddIOs(ios,mios);return;}
ls.push(new LML(lis,lsna,ios));}}
function LML(lis,lsna,ios)
{this.Lis=lis;this.LsnA=lsna;this.IOs=ios?((ios.constructor==Array)?ios:[ios]):[];this.AddIOs=function(ios,mios)
{if(ios)
{mios=mios||(mios==null);if(ios.constructor!=Array)
ios=[ios];var es;for(var i=0;i<ios.length;i++)
{es=false;for(var j=0;j<this.IOs.length;j++)
{if(mios)
{var z=$DOM_CONTAINS(ios[i],this.IOs[j]);if(z<0||ios[i]==this.IOs[j])
{es=true;break;}
else if(z>0)
{this.IOs[j]=ios[i];es=true;break;}}
else if(this.IOs[j]==ios[i])
{es=true;break;}}
if(!es)
this.IOs.push(ios[i]);}}}
this.CIO=function(t)
{while(t)
{for(var i=0,il=this.IOs.length;i<il;i++)
if(t==this.IOs[i])
return true;t=t.parentNode;}
return false;}}
var AJAX={Req:null,H:null,EH:null,HPs:null,URL:"",Load:function(url,t,ps,h,eh,hps){with(this){Reset();H=h;EH=eh;HPs=hps;URL=url;Req=CreateReq();if(t==null||(t.toUpperCase()!="GET"&&t.toUpperCase()!="POST"))
t="GET";if(!Req)
return alert("不能创建XMLHttpRequest对象实例.");Req.onreadystatechange=function(){with(AJAX.Req){if(readyState==4){if(status==200)
AJAX.H(responseText,AJAX.HPs);else if(status==0)
return;else if(AJAX.EH!=null)
AJAX.EH("Page Error : "+status,AJAX.HPs);else
alert("您所请求的页面有异常。");}}
return;}
URL+=((URL.indexOf("?")>-1)?"&":"?")+Math.random(5).toString().replace(".","");var data="";if(ps&&ps.constructor==Array)
for(var i=0;i<ps.length;i++)
data+=(i>0?"&":"")+ps[i][0]+"="+encodeURIComponent(ps[i][1]);if(t.toUpperCase()=="GET"&&data!="")
{URL+="&"+data;data=null;}
Req.open(t,URL,true);if(t.toUpperCase()=="POST")
Req.setRequestHeader("Content-Type","application/x-www-form-urlencoded");Req.send(data);}},Reset:function(){with(this){if(Req){Req.abort();}
Req=null;H=null;URL=null;}},CreateReq:function(){var req;if(window.XMLHttpRequest){req=new XMLHttpRequest();if(req.overrideMimeType)
req.overrideMimeType("text/xml");}else if(window.ActiveXObject){try{req=new ActiveXObject("Msxml2.XMLHTTP");}catch(e){try{req=new ActiveXObject("Microsoft.XMLHTTP");}catch(e){}}}
return req;}}
function ValidateKeyword(k,req)
{if(req&&k.IsBlank())
return false;if(/(^|\s)\S(\s|$)/.test(k))
{alert("任一关键词长度不能短于两个字");return false;}
return true;}