var Zhishi={loginStateUrl:"",loginStateBarUrl:"",popLoginUrl:"",loginOutUrl:"",Browser:{isIE:!!(window.attachEvent&&!window.opera),isFirefox:navigator.userAgent.indexOf("Gecko")>-1&&navigator.userAgent.indexOf("KHTML")==-1,isOpera:!!window.opera,isSafari:navigator.userAgent.indexOf("AppleWebKit/")>-1}};function $($){return document.getElementById($)}function trim($){if(typeof $=="string")return $.replace(/(^\s*)|(\s*$)/g,"")}function request(B){var $=new Array(),C=document.location.href;C=C.indexOf("#")==-1?C:C.substr(0,C.indexOf("#"));if(C.indexOf("?")!=-1){C=C.substr(C.indexOf("?")+1);if(C.indexOf("&")==-1){if(C.indexOf("=")!=-1)$[C.split("=")[0]]=C.split("=")[1]}else{var _=C.split("&");for(var A=0;A<_.length;A++)if(_[A].indexOf("=")!=-1)$[_[A].split("=")[0]]=_[A].split("=")[1]}}return $[B]}var LabelList=["qId","qTitle","cId","cTitle","qTotalNum"];Zhishi.Ajax={_transaction_id:0,_poll:{},_timeOut:{},createXhrObject:function(){if(Zhishi.Browser.isIE){var $=["MSXML2.XMLHTTP.5.0","MSXML2.XMLHTTP.4.0","MSXML2.XMLHTTP.3.0","MSXML2.XMLHTTP","Microsoft.XMLHTTP"];for(var A=$.length-1;A>=0;A--){try{return new ActiveXObject($[A])}catch(_){}}}else return new XMLHttpRequest()},getConnectionObj:function(){var $=this.createXhrObject(),_={"conn":$,"tId":this._transaction_id};if($)this._transaction_id++;return _},sendRequest:function(C,D,A){var B=this.getConnectionObj();B.onSuccess=A.onSuccess;B.onLoading=A.onLoading?A.onLoading:"";B.onErr=A.onErr?A.onErr:this.onErr;B.cacheTime=A.cacheTime?A.cacheTime:0;B.postdata=A.postdata?A.postdata:"";B.timeOut=A.timeOut?A.timeOut:30000;B.para=A.para?A.para:"";B.isClearCache=A.isClearCache?A.isClearCache:false;var $=new Date();if(B.isClearCache||B.cacheTime==0)var _=$.valueOf().toString();else{_=$.getDate()*24*3600+$.getHours()*3600+$.getMinutes()*60+$.getSeconds();if(_%B.cacheTime!=0)_-=_%B.cacheTime}if(C.toUpperCase()=="GET")D+=((D.indexOf("?")==-1)?"?":"&")+"rnd="+_;B.conn.open(C,D,true);B.conn.setRequestHeader("Content-Type","application/x-www-form-urlencoded; charset=UTF-8");this.handleReadyState(B);B.conn.send((B.postdata!="")?this.toQueryString(B.postdata):null)},handleReadyState:function($){var _=this;this._timeOut[$.tId]=window.setTimeout(function(){$.conn.abort();$.onErr()},$.timeOut);this._poll[$.tId]=window.setInterval(function(){if($.conn&&$.conn.readyState===4&&$.conn.status==200){window.clearInterval(_._poll[$.tId]);delete _._poll[$.tId];window.clearTimeout(_._timeOut[$.tId]);delete _._timeOut[$.tId];$.onSuccess($.conn.responseText,$.para)}else if($.onLoading)$.onLoading()},20)},onErr:function(){},toQueryString:function(_){var $="";if(_.indexOf("&")==-1)return _.split("=")[0]+"="+encodeURIComponent(_.split("=")[1]);else{var A=_.split("&");for(var B=0;B<A.length;B++)$+=A[B].split("=")[0]+"="+encodeURIComponent(A[B].split("=")[1])+"&";return $.substring(0,$.length-1)}},evalJSON:function(json){return eval("("+json+")")},paseJSON:function(I,D,_,L,G,K){var A="";if(!L){for(var H=0;H<LabelList.length;H++){var E=LabelList[H];if(_.indexOf("%"+E+"%")>-1)_=_.replace("%"+E+"%",B[E])}$(I).innerHTML=_}else{var B=D[G],C=B.length;if(!(K==null||K==""))C=K>B.length?B.length:K;for(var F=0;F<C;F++){var J=_;for(H=0;H<LabelList.length;H++){E=LabelList[H];if(J.indexOf("%"+E+"%")>-1)J=J.replace("%"+E+"%",B[F][E])}A+=J;$(I).innerHTML=A}}}};Zhishi.Cookie={setCookie:function(A,B,_){var $="";if(_!=null){$=new Date((new Date()).getTime()+_*3600000);$="; expires="+$.toGMTString()}document.cookie=A+"="+escape(B)+$},getCookie:function($){var A="",_=$+"=";if(document.cookie.length>0){offset=document.cookie.indexOf(_);if(offset!=-1){offset+=_.length;end=document.cookie.indexOf(";",offset);if(end==-1)end=document.cookie.length;A=unescape(document.cookie.substring(offset,end))}}return A},delCookie:function(_){var $="; expires=Mon, 26 Jul 1997 05:00:00 GMT";document.cookie=_+"="+$}};Zhishi.Event={attachEventListener:function(_,B,A,$){if(_.addEventListener)_.addEventListener(B,A,$);else if(_.attachEvent)_.attachEvent("on"+B,A);return true},removeEventListener:function(_,B,A,$){if(_.removeEventListener)_.removeEventListener(B,A,$);else if(_.detachEvent)_.detachEvent("on"+B,A);return true}};Zhishi.Dom={getByClass:function($,B){var _=document.getElementsByTagName($),A=new Array();for(var C=0;C<_.length;C++)if((" "+_[C].className+" ").indexOf(" "+B+" ")!=-1)A.push(_[C]);return A},getSize:function(_){var $=_.offsetWidth,A=_.offsetHeight;return[$,A]},setSize:function(A,B,_){var $=(!B||B<0)?"auto":parseInt(B)+"px",C=(!_||_<0)?"auto":parseInt(_)+"px";A.width=$;A.height=C},getXY:function(_){var $=0,C=0;if(document.documentElement.getBoundingClientRect){var B=_.getBoundingClientRect(),A=_.ownerDocument;$=B.top-2+this.getScrollSize(A)[1];C=B.left-2+this.getScrollSize(A)[0]}else while(_.offsetParent){$+=_.offsetTop;C+=_.offsetLeft;_=_.offsetParent}return[C,$]},setXY:function($,C,B){var A=$.style.marginLeft?$.style.marginLeft:0,_=$.style.marginTop?$.style.marginTop:0;$.style.left=parseInt(C)-A+"px";$.style.top=parseInt(B)-_+"px"},getScrollSize:function(A){A=A?A:document;var B=Math.max(A.documentElement.scrollLeft,A.body.scrollLeft),_=Math.max(A.documentElement.scrollTop,A.body.scrollTop),C=Math.max(A.documentElement.scrollHeight,A.body.scrollHeight),$=Math.max(A.documentElement.scrollWidth,A.body.scrollWidth);return[B,_,$,C]},getClientSize:function(_){_=_?_:document;var A=_.compatMode=="CSS1Compat"?_.documentElement.clientHeight:_.body.clientHeight,$=_.compatMode=="CSS1Compat"?_.documentElement.clientWidth:_.body.clientWidth;return[$,A]},getScrollingPosition:function(){var $=[document.body.scrollLeft,document.body.scrollTop];return $},convertHexColor:function(B){B=/^#/.test(B)?B.substr(1):B;var C=new RegExp("\\w{2}","ig");B=B.match(C);if(!B||B.length<3)return[0,0,0];var A=parseInt(B[0],16),$=parseInt(B[1],16),_=parseInt(B[2],16);return[A,$,_]},setStyle:function(_,A,$){if(!_)return false;switch(A){case"opacity":if(Zhishi.Browser.isIE){_.style.filter="alpha(opacity="+parseInt($)+")";return true}else _.style[A]=parseFloat($)/100;default:if(typeof _.style[A]=="undefined")return false;_.style[A]=$;return true}},getStyle:function(C,D){var E=document.defaultView&&document.defaultView.getComputedStyle,B="";switch(D){case"float":D=E?"cssFloat":"styleFloat";break;case"opacity":if(!E){var $=100;try{$=C.filters["DXImageTransform.Microsoft.Alpha"].opacity}catch(_){try{$=C.filters("alpha").opacity}catch(_){}}return $/100}}if(E){var A=document.defaultView.getComputedStyle(C,"");if(A)B=A[D];return(B||C.style[D])}else return(C.currentStyle[D]||C.style[D])}};Zhishi.Panel={_para:"",_keyCode:"",_scrolls:"",createDialog:function(G,H,D,E){var L=G?G:"",O=H?H:100,I=D?D:100,U=E&&E.hasBorder!=null&&E.hasBorder==false?E.hasBorder:true,R=E&&E.hasTitle!=null&&E.hasTitle==false?E.hasTitle:true,T=E&&E.title?E.title:"",P=E&&E.canDrag!=null&&E.canDrag==false?E.canDrag:true,Q=E&&E.maskColor?E.maskColor:"#fff",F=E&&E.maskOpacity?E.maskOpacity:0.6,J=E&&E.isFrame!=null&&E.isFrame?E.isFrame:false,M=E&&E.url?E.url:"";this._para=E&&E.para?E.para:"";this._keyCode=E&&E.keyCode?E.keyCode:27;var $=document.getElementsByTagName("body")[0],B=Zhishi.Dom.getScrollSize(),N=Zhishi.Dom.getClientSize();if(N[1]>B[2])B[2]=N[1];var C=document.createElement("div");C.setAttribute("id","WenwenLogDropSheet");C.style.position="absolute";C.style.left="0";C.style.top="0";C.style.width=B[2]+"px";C.style.height=B[3]+"px";C.style.background=Q;C.style.opacity=F;C.style.filter="alpha(opacity="+F*100+")";$.appendChild(C);if(J)L="<iframe src=\""+M+"\" height=\""+I+"px\" width=\""+O+"px\" scrolling=\"no\" frameborder=\"0\"></iframe>";try{var S=document.createElement("div");S.style.height=I+"px";S.style.width=O+"px";S.style.visibility="hidden";S.style.position="absolute";S.style.background="#FFFFFF";S.id="WenwenLogDialogId";if(U)S.style.border="1px solid #B2D0EA";if(R){var A="<div id=\"WenwenLogDialogTitleId\" style=\"background:url(http://cache.soso.com/wenwen/i/dialogTitle_bg.gif) repeat-x;padding:0;margin:0;width:"+O+"px;height:22px;font-weight:bold;font-size:12px;padding-top:7px;border-bottom:1px solid #B2D0EA;\"><span style=\"float:left; padding-left:7px;\">"+T+"</span><span style=\"float:right;padding-right:5px;cursor:pointer;\"><a href=\"javascript:Zhishi.Login.closeLoginDialog();\"><img src=\"http://mat1.qq.com/news/ptlogin2/style/0/images/login_close.gif\" name=\"close\"  align=\"top\" border=\"0\" id=\"close\"/></a></span></div>";S.innerHTML=A+L}else S.innerHTML=L;$.appendChild(S);var K=Zhishi.Dom.getScrollSize();S.style.left=K[0]+parseInt(N[0]/2)-parseInt(S.offsetWidth/2)+"px";S.style.top=K[1]+parseInt(N[1]/2)-parseInt(S.offsetHeight*1/2)+"px";S.style.visibility="visible";Zhishi.Event.attachEventListener(document,"keydown",Zhishi.Panel.listenerKey,false);Zhishi.Event.attachEventListener(window,"scroll",Zhishi.Panel.onScrolls,false);Zhishi.Event.attachEventListener(window,"resize",Zhishi.Panel.onResize,false);if(P)Zhishi.Drag.startDrag("WenwenLogDialogId","WenwenLogDialogTitleId",false)}catch(_){C.parentNode.removeChild(C);return true}return false},onScrolls:function(){window.clearTimeout(this._scrolls);this._scrolls=window.setTimeout(Zhishi.Panel.onResize,100)},onResize:function(){var _=Zhishi.Dom.getScrollSize(),A=Zhishi.Dom.getClientSize(),C=$("WenwenLogDialogId"),B=$("WenwenLogDropSheet");B.style.width=_[2]+"px";B.style.height=_[3]+"px";C.style.top=_[1]+parseInt(A[1]/2)-parseInt(C.offsetHeight*1/2)+"px";C.style.left=_[0]+parseInt(A[0]/2)-parseInt(C.offsetWidth/2)+"px"},afterCloseDialog:function(){},closeDialog:function(_){var B=$("WenwenLogDialogId");if(B){Zhishi.Event.removeEventListener(document,"keydown",Zhishi.Panel.listenerKey,false);Zhishi.Event.removeEventListener(window,"scroll",Zhishi.Panel.onScrolls,false);Zhishi.Event.removeEventListener(window,"resize",Zhishi.Panel.onResize,false);B.parentNode.removeChild(B);if(this._canDrag)Zhishi.Drag.mouseUpCancel()}var A=$("WenwenLogDropSheet");if(A)A.parentNode.removeChild(A);if(!_)Zhishi.Panel.afterCloseDialog()},listenerKey:function($){if($.keyCode==Zhishi.Panel._keyCode)Zhishi.Panel.closeDialog()}};Zhishi.Drag={_dragObj:"",_dragHandler:"",_isBack:false,startDrag:function(C,A,B){this._dragObj=C;this._dragHandler=A?A:"";this._isBack=B?B:false;var _=A?$(Zhishi.Drag._dragHandler):$(Zhishi.Drag._dragObj);$(Zhishi.Drag._dragObj).style.position="absolute";Zhishi.Event.attachEventListener(_,"mousedown",Zhishi.Drag.mouseDownDrag,false)},mouseDownDrag:function(_){var _=_?_:window.event,A=$(Zhishi.Drag._dragObj);A.oldX=_.clientX;A.oldY=_.clientY;var B=A.style.left?parseInt(A.style.left):0,C=A.style.top?parseInt(A.style.top):0;A.differenceX=B-_.clientX;A.differenceY=C-_.clientY;Zhishi.Event.attachEventListener(document,"mousemove",Zhishi.Drag.mouseMoveCheck,false);Zhishi.Event.attachEventListener(document,"mouseup",Zhishi.Drag.mouseUpCancel,false);Zhishi.Drag.stopDefaultAction(_);return false},mouseMoveCheck:function(_){var _=_?_:window.event,A=$(Zhishi.Drag._dragObj);Zhishi.Event.removeEventListener(document,"mousemove",Zhishi.Drag.mouseMoveCheck,false);Zhishi.Event.removeEventListener(document,"mouseup",Zhishi.Drag.mouseUpCancel,false);Zhishi.Event.attachEventListener(document,"mousemove",Zhishi.Drag.mouseMoveDrag,false);Zhishi.Event.attachEventListener(document,"mouseup",Zhishi.Drag.mouseUpDrag,false);Zhishi.Event.attachEventListener(document,"click",Zhishi.Drag.clickDrag,false);Zhishi.Drag.stopDefaultAction(_);return true},mouseUpCancel:function(){Zhishi.Event.removeEventListener(document,"mousemove",Zhishi.Drag.mouseMoveCheck,false);Zhishi.Event.removeEventListener(document,"mouseup",Zhishi.Drag.mouseUpCancel,false);return true},clickDrag:function($){Zhishi.Event.removeEventListener(document,"click",Zhishi.Drag.clickDrag,false);Zhishi.Drag.stopDefaultAction($);return true},mouseMoveDrag:function(_){var _=_?_:window.event,A=$(Zhishi.Drag._dragObj);A.style.left=_.clientX+A.differenceX+"px";A.style.top=_.clientY+A.differenceY+"px";Zhishi.Drag.stopDefaultAction(_);return true},mouseUpDrag:function(_){var _=_?_:window.event;if(Zhishi.Drag._isBack){var A=$(Zhishi.Drag._dragObj);A.style.left=A.oldX+A.differenceX+"px";A.style.top=A.oldY+A.differenceY+"px"}Zhishi.Event.removeEventListener(document,"mousemove",Zhishi.Drag.mouseMoveDrag,false);Zhishi.Event.removeEventListener(document,"mouseup",Zhishi.Drag.mouseUpDrag,false);return true},stopDefaultAction:function($){$.returnValue=false;if($.preventDefault)$.preventDefault();return true}};Zhishi.Login={loginList:[],callBackObj:"",getElements:function(){var $=[];Zhishi.Login.pushElements("input",$);Zhishi.Login.pushElements("button",$);Zhishi.Login.pushElements("a",$);return $},pushElements:function($,A){var _=document.getElementsByTagName($);for(var B=0;B<_.length;B++)if((" "+_[B].className+" ").indexOf(" login_require ")!=-1)A.push(_[B])},init:function(){var _=Zhishi.Login.getElements();for(var A=0;A<_.length;A++){var $=_[A];if($.onclick)Zhishi.Login.loginList[A]=$.onclick;else if($.tagName.toLowerCase()=="a"){Zhishi.Login.loginList[A]=$.href;$.href="#"}$.setAttribute("wenwenid",A);$.onclick=Zhishi.Login.newMethod;$.style.cursor="pointer"}},changeLoginStateBar:function(_){$("TW").innerHTML=_},newMethod:function(){var _=Zhishi.Browser.isIE?event.srcElement:arguments[0].target,$={onSuccess:Zhishi.Login.checkLogin,para:_};Zhishi.Ajax.sendRequest("GET",Zhishi.loginStateUrl,$)},execOldMethod:function(_){var $=Zhishi.Login.loginList[_.getAttribute("wenwenid")];if(_.tagName.toLowerCase()=="input"||typeof $=="function")$();else document.location=$},checkLogin:function(_,$){if(_=="1")Zhishi.Login.execOldMethod($);else if(_=="0")Zhishi.Login.loginDialog($)},loginDialog:function(A){this.callBackObj=A?A:this.callBackObj;var _=260,$=Zhishi.Browser.isIE?373:371;if(Zhishi.Browser.isFirefox)_=250;else if(Zhishi.Browser.isOpera)_=245;Zhishi.Panel.createDialog("<div id=\"WenwenLogDialogTitleId\" style=\"background:url(http://mat1.qq.com/news/ptlogin2/style/0/images/login_bg.gif) no-repeat left;padding:0;margin:0;width:"+$+"px;height:22px;font-weight:bold;font-size:12px;padding-top:7px;border-top:1px solid #99c2ee;border-left:1px solid #99c2ee;border-right:1px solid #99c2ee;\"><span style=\"float:left; padding-left:30px;\">\u7528\u6237\u767b\u5f55</span><span style=\"float:right;padding-right:5px;cursor:pointer;\"><a href=\"javascript:Zhishi.Login.closeLoginDialog('auto');\"><img src=\"http://mat1.qq.com/news/ptlogin2/style/0/images/login_close.gif\" name=\"close\"  align=\"top\" border=\"0\" id=\"close\"/></a></span></div><iframe src=\""+Zhishi.popLoginUrl+"\" height=\""+_+"px\" width=\"373px\" scrolling=\"no\" frameborder=\"0\"></iframe>",373,_,{"hasBorder":false,"hasTitle":false,"canDrag":false})},loginLink:function(){Zhishi.Ajax.sendRequest("GET",Zhishi.loginStateUrl,{onSuccess:Zhishi.Login.doLogin})},doLogin:function($){if($=="1")document.location.reload();else if($=="0")Zhishi.Login.loginDialog()},closeLoginDialog:function($){Zhishi.Drag.mouseUpCancel();Zhishi.Panel.closeDialog($)},autoCloseLoginDialog:function(){Zhishi.Login.closeLoginDialog("auto");var A=Zhishi.Login.callBackObj;if(A){var _=Zhishi.Login.loginList[A.getAttribute("wenwenid")];if(typeof _!="function")document.location=_;else if((" "+Zhishi.Login.callBackObj.className+" ").indexOf(" login_norefresh ")==-1&&(" "+$("TW").className+" ").indexOf(" reload ")!=-1)document.location.reload();else{Zhishi.Ajax.sendRequest("GET",Zhishi.loginStateBarUrl,{onSuccess:Zhishi.Login.changeLoginStateBar});if(Zhishi.Login.callBackObj)Zhishi.Login.execOldMethod(Zhishi.Login.callBackObj)}}else document.location.reload()}};Zhishi.Tool={};Zhishi.Tool.InputHelp={_inputId:"",_message:"",_messageClassName:"",startT:function(B,_,A){this._inputId=B?B:this._inputId;this._message=_?_:"";this._messageClassName=A?A:"WenwenInputHelpClass";if($(Zhishi.Tool.InputHelp._inputId).value==""){Zhishi.Tool.InputHelp.createT();Zhishi.Tool.InputHelp.setT();Zhishi.Event.attachEventListener(window,"resize",Zhishi.Tool.InputHelp.setT,false)}},createT:function(){var $=document.createElement("div");$.id="WenwenTipId";$.innerHTML=Zhishi.Tool.InputHelp._message;document.body.appendChild($)},setT:function(){var _=$(Zhishi.Tool.InputHelp._inputId),G=$("WenwenTipId");G.style.position="absolute";G.className=Zhishi.Tool.InputHelp._messageClassName;var F=_.style.padding?parseInt(_.style.padding):0,E=_.style.margin?parseInt(_.style.margin):0;if(Zhishi.Browser.isIE){var C=0,B=0,A=_;while(A!=null&&A!=document.body){C+=A.offsetLeft;B+=A.offsetTop;parseInt(A.currentStyle.borderLeftWidth)>0?C+=parseInt(A.currentStyle.borderLeftWidth):"";parseInt(A.currentStyle.borderTopWidth)>0?B+=parseInt(A.currentStyle.borderTopWidth):"";A=A.offsetParent}var D=C+F+4,H=B+F}else D=_.offsetLeft+F+4,H=_.offsetTop+F;if(_.tagName.toLowerCase()=="textarea"){D+=4;H+=4}if(_.tagName.toLowerCase()=="input")H+=(_.offsetHeight-E-F-G.scrollHeight)/2;G.style.left=D+"px";G.style.top=H+"px";G.onclick=Zhishi.Tool.InputHelp.stopT;_.onblur=Zhishi.Tool.InputHelp.startT;_.onfocus=Zhishi.Tool.InputHelp.stopT},stopT:function(){try{document.body.removeChild($("WenwenTipId"));$(Zhishi.Tool.InputHelp._inputId).focus()}catch(_){}}};Zhishi.Animation={startValue:"",finishValue:"",startColor:"",finishColor:"",duration:"",changeValue:"",currentValue:"",isPlayed:false,simpleFun:function(A,$,B,_){return B*A/_+$},getColor:function(B,A,$){var _=[];if($>100)$=100;if($<0)$=0;for(var C=0;C<3;C++){_[C]=Math.floor(B[C]*1+($/100)*(A[C]-B[C])).toString(16);if(_[C].length<2)_[C]="0"+_[C]}return"#"+_.join("")},start:function(C,E,_,B,A){if(this.isPlayed)window.setTimeout(function(){if(!this.isPlayed)Zhishi.Animation.start(C,E,_,B,A)},500);else{var D=/^#/.test(_),F=/\d+([a-z%]+)/i.exec(_),G=F?F[1]:"";this.startValue=D?0:parseFloat(_);this.finishValue=D?100:parseFloat(B);if(D){this.startColor=Zhishi.Dom.convertHexColor(_);this.finishColor=Zhishi.Dom.convertHexColor(B)}this.changeValue=this.finishValue-this.startValue;this.currentValue=0;this.duration=A?A:10;var $=new Date().getTime();this.isPlayed=true;this.runTime([C,E,$,D,G])}},runTime:function(C){if(this.isPlayed){var _=(new Date().getTime()-C[2])/1000,A=false;if(_>this.duration){_=this.duration;A=true}var $=Zhishi.Animation.simpleFun(_,this.startValue,this.changeValue,this.duration);this.currentValue=/(opacity)/i.test(C[1])?$:Math.round($);if(C[3])this.currentValue=Zhishi.Animation.getColor(this.startColor,this.finishColor,$);var B=Zhishi.Dom.setStyle(C[0],C[1],this.currentValue+C[4]);if(!B)C[0][C[1]]=this.currentValue+C[4];if(A){this.isPlayed=false;if(window.CollectGarbage)CollectGarbage()}var D=this;setTimeout(function(){D.runTime.apply(D,[C])},0)}}}
