/*======================================================================*\
|| #################################################################### ||
|| # vBulletin 4.0.1
|| # ---------------------------------------------------------------- # ||
|| # Copyright ©2000-2010 vBulletin Solutions Inc. All Rights Reserved. ||
|| # This file may not be redistributed in whole or significant part. # ||
|| # ---------------- VBULLETIN IS NOT FREE SOFTWARE ---------------- # ||
|| # http://www.vbulletin.com | http://www.vbulletin.com/license.html # ||
|| #################################################################### ||
\*======================================================================*/
var vB_ThreadTitle_Editor=null;if(AJAX_Compatible&&(typeof vb_disable_ajax=="undefined"||vb_disable_ajax<2)){vB_XHTML_Ready.subscribe(function(){vB_AJAX_Threadlist_Init("threadlist")})}function vB_AJAX_Threadlist_Init(C){var B=YAHOO.util.Dom.getElementsByClassName("threadstatus","a",C);for(var A=0;A<B.length;A++){B[A].style.cursor=pointer_cursor;YAHOO.util.Event.on(B[A],"dblclick",vB_AJAX_ThreadList_Events.prototype.threadicon_doubleclick)}var D=YAHOO.util.Dom.getElementsByClassName("threadbit","li",C);for(var A=0;A<D.length;A++){YAHOO.util.Event.on(D[A],"dblclick",vB_AJAX_ThreadList_Events.prototype.threadtitle_doubleclick)}}function vB_AJAX_OpenClose(A){this.statuslink=A;this.threadbit=false;if(!this.threadbit){this.threadbit=YAHOO.util.Dom.getAncestorByClassName(this.statuslink,"threadbit");this.threadid=this.threadbit.id.substr(this.threadbit.id.lastIndexOf("_")+1)}this.closed=YAHOO.util.Dom.hasClass(this.threadbit,"lock");this.toggle=function(){YAHOO.util.Connect.asyncRequest("POST","ajax.php?do=updatethreadopen&t="+this.threadid,{success:this.handle_ajax_response,failure:vBulletin_AJAX_Error_Handler,timeout:vB_Default_Timeout,scope:this},SESSIONURL+"securitytoken="+SECURITYTOKEN+"&do=updatethreadopen&t="+this.threadid+"&open="+this.closed)};this.handle_ajax_response=function(C){if(C.responseXML){var B=C.responseXML.getElementsByTagName("status")[0].firstChild.nodeValue;if("closed"==B){YAHOO.util.Dom.addClass(this.threadbit,"lock");this.closed=true}else{if("open"==B){YAHOO.util.Dom.removeClass(this.threadbit,"lock");this.closed=false}}}};this.toggle()}function vB_AJAX_TitleEdit(A){this.obj=A;this.threadid=this.obj.id.substr(this.obj.id.lastIndexOf("_")+1);this.linkobj=fetch_object("thread_title_"+this.threadid);this.container=this.linkobj.parentNode;this.editobj=null;this.xml_sender=null;this.origtitle="";this.editstate=false;this.progress_image=new Image();this.progress_image.src=IMGDIR_MISC+"/11x11progress.gif";this.edit=function(){if(this.editstate==false){this.inputobj=document.createElement("input");this.inputobj.type="text";this.inputobj.size=50;this.inputobj.maxLength=((typeof (titlemaxchars)=="number"&&titlemaxchars>0)?titlemaxchars:85);this.inputobj.style.width=Math.max(this.linkobj.offsetWidth,250)+"px";this.inputobj.className="textbox";this.inputobj.value=PHP.unhtmlspecialchars(this.linkobj.innerHTML);this.inputobj.title=this.inputobj.value;this.inputobj.onblur=vB_AJAX_ThreadList_Events.prototype.titleinput_onblur;this.inputobj.onkeypress=vB_AJAX_ThreadList_Events.prototype.titleinput_onkeypress;this.editobj=this.container.insertBefore(this.inputobj,this.linkobj);this.editobj.select();this.origtitle=this.linkobj.innerHTML;this.linkobj.style.display="none";this.editstate=true}};this.restore=function(){if(this.editstate==true){if(this.editobj.value!=this.origtitle){this.container.appendChild(this.progress_image);this.save(this.editobj.value)}else{this.linkobj.innerHTML=this.editobj.value}this.container.removeChild(this.editobj);this.linkobj.style.display="";this.editstate=false;this.obj=null}};this.save=function(B){YAHOO.util.Connect.asyncRequest("POST","ajax.php?do=updatethreadtitle&t="+this.threadid,{success:this.handle_ajax_response,timeout:vB_Default_Timeout,scope:this},SESSIONURL+"securitytoken="+SECURITYTOKEN+"&do=updatethreadtitle&t="+this.threadid+"&title="+PHP.urlencode(B))};this.handle_ajax_response=function(B){if(B.responseXML){this.linkobj.innerHTML=B.responseXML.getElementsByTagName("linkhtml")[0].firstChild.nodeValue;this.linkobj.href=B.responseXML.getElementsByTagName("linkhref")[0].firstChild.nodeValue}this.container.removeChild(this.progress_image);vB_ThreadTitle_Editor.obj=null};this.edit()}function vB_AJAX_ThreadList_Events(){}vB_AJAX_ThreadList_Events.prototype.threadtitle_doubleclick=function(A){if(vB_ThreadTitle_Editor&&vB_ThreadTitle_Editor.obj==this){return false}else{try{vB_ThreadTitle_Editor.restore()}catch(A){}vB_ThreadTitle_Editor=new vB_AJAX_TitleEdit(this)}};vB_AJAX_ThreadList_Events.prototype.threadicon_doubleclick=function(A){YAHOO.util.Event.stopPropagation(A);openclose=new vB_AJAX_OpenClose(this)};vB_AJAX_ThreadList_Events.prototype.titleinput_onblur=function(A){vB_ThreadTitle_Editor.restore()};vB_AJAX_ThreadList_Events.prototype.titleinput_onkeypress=function(A){A=A?A:window.event;switch(A.keyCode){case 13:vB_ThreadTitle_Editor.inputobj.blur();return false;case 27:vB_ThreadTitle_Editor.inputobj.value=vB_ThreadTitle_Editor.origtitle;vB_ThreadTitle_Editor.inputobj.blur();return true}};