var cur_topic_id,cur_msg_id,buff_subject,cur_subject_div,in_edit_mode=0,hide_prefixes=Array();
function modify_topic(a,c){if("XMLHttpRequest"in window){if("opera"in window)if(!("setRequestHeader"in new XMLHttpRequest))return;if(typeof cur_session_var=="undefined")cur_session_var="sesc";if(in_edit_mode==1)if(cur_topic_id==a)return;else modify_topic_cancel();mouse_on_div=in_edit_mode=1;cur_topic_id=a;typeof window.ajax_indicator=="function"&&ajax_indicator(true);getXMLDocument(smf_prepareScriptUrl(smf_scripturl)+"action=quotefast;quote="+c+";modify;xml",onDocReceived_modify_topic)}}
function onDocReceived_modify_topic(a){cur_msg_id=a.getElementsByTagName("message")[0].getAttribute("id");cur_subject_div=document.getElementById("msg_"+cur_msg_id.substr(4));buff_subject=getInnerHTML(cur_subject_div);set_hidden_topic_areas("none");modify_topic_show_edit(a.getElementsByTagName("subject")[0].childNodes[0].nodeValue);typeof window.ajax_indicator=="function"&&ajax_indicator(false)}
function modify_topic_cancel(){setInnerHTML(cur_subject_div,buff_subject);set_hidden_topic_areas("");in_edit_mode=0;return false}
function modify_topic_save(a,c){if(!in_edit_mode)return true;if(typeof c=="undefined")c="sesc";var b=[];b[b.length]="subject="+document.forms.quickModForm.subject.value.replace(/&#/g,"&#38;#").php_to8bit().php_urlencode();b[b.length]="topic="+parseInt(document.forms.quickModForm.elements.topic.value);b[b.length]="msg="+parseInt(document.forms.quickModForm.elements.msg.value);typeof window.ajax_indicator=="function"&&ajax_indicator(true);sendXMLDocument(smf_prepareScriptUrl(smf_scripturl)+"action=jsmodify;topic="+
parseInt(document.forms.quickModForm.elements.topic.value)+";"+c+"="+a+";xml",b.join("&"),modify_topic_done);return false}
function modify_topic_done(a){if(!a){modify_topic_cancel();return true}var c=a.getElementsByTagName("smf")[0].getElementsByTagName("message")[0];a=c.getElementsByTagName("subject")[0];c=c.getElementsByTagName("error")[0];typeof window.ajax_indicator=="function"&&ajax_indicator(false);if(!a||c)return false;subjectText=a.childNodes[0].nodeValue;modify_topic_hide_edit(subjectText);set_hidden_topic_areas("");in_edit_mode=0;return false}
function set_hidden_topic_areas(a){for(var c=0;c<hide_prefixes.length;c++)if(document.getElementById(hide_prefixes[c]+cur_msg_id.substr(4))!=null)document.getElementById(hide_prefixes[c]+cur_msg_id.substr(4)).style.display=a}function QuickReply(a){this.opt=a;this.bCollapsed=this.opt.bDefaultCollapsed}
QuickReply.prototype.quote=function(a,c){if(typeof c!="undefined")return true;if(this.bCollapsed)window.location.href=smf_prepareScriptUrl(this.opt.sScriptUrl)+"action=post;quote="+a+";topic="+this.opt.iTopicId+"."+this.opt.iStart;else{if(window.XMLHttpRequest){ajax_indicator(true);getXMLDocument(smf_prepareScriptUrl(this.opt.sScriptUrl)+"action=quotefast;quote="+a+";xml",this.onQuoteReceived)}else reqWin(smf_prepareScriptUrl(this.opt.sScriptUrl)+"action=quotefast;quote="+a,240,90);window.location.hash=
navigator.appName=="Microsoft Internet Explorer"?this.opt.sJumpAnchor:"#"+this.opt.sJumpAnchor}return false};QuickReply.prototype.onQuoteReceived=function(a){for(var c="",b=0;b<a.getElementsByTagName("quote")[0].childNodes.length;b++)c+=a.getElementsByTagName("quote")[0].childNodes[b].nodeValue;replaceText(c,document.forms.postmodify.message);ajax_indicator(false)};
QuickReply.prototype.swap=function(){document.getElementById(this.opt.sImageId).src=this.opt.sImagesUrl+"/"+(this.bCollapsed?this.opt.sImageCollapsed:this.opt.sImageExpanded);document.getElementById(this.opt.sContainerId).style.display=this.bCollapsed?"":"none";this.bCollapsed=!this.bCollapsed};
function QuickModify(a){this.opt=a;this.bInEditMode=false;this.sCurMessageId="";this.oCurSubjectDiv=this.oCurMessageDiv=null;this.sSubjectBuffer=this.sMessageBuffer="";if(this.bXmlHttpCapable=this.isXmlHttpCapable())for(a=document.images.length-1;a>=0;a--)if(document.images[a].id.substr(0,14)=="modify_button_")document.images[a].style.display=""}
QuickModify.prototype.isXmlHttpCapable=function(){if(typeof window.XMLHttpRequest=="undefined")return false;if("opera"in window)if(!("setRequestHeader"in new XMLHttpRequest))return false;return true};
QuickModify.prototype.modifyMsg=function(a){if(this.bXmlHttpCapable){if(typeof sSessionVar=="undefined")sSessionVar="sesc";this.bInEditMode&&this.modifyCancel();this.bInEditMode=true;ajax_indicator(true);this.tmpMethod=getXMLDocument;this.tmpMethod(smf_prepareScriptUrl(this.opt.sScriptUrl)+"action=quotefast;quote="+a+";modify;xml",this.onMessageReceived);delete this.tmpMethod}};
QuickModify.prototype.onMessageReceived=function(a){var c="",b="";ajax_indicator(false);this.sCurMessageId=a.getElementsByTagName("message")[0].getAttribute("id");if(!document.getElementById(this.sCurMessageId))return this.modifyCancel();for(b=0;b<a.getElementsByTagName("message")[0].childNodes.length;b++)c+=a.getElementsByTagName("message")[0].childNodes[b].nodeValue;this.oCurMessageDiv=document.getElementById(this.sCurMessageId);this.sMessageBuffer=getInnerHTML(this.oCurMessageDiv);c=c.replace(/\$/g,
"{&dollarfix;$}");setInnerHTML(this.oCurMessageDiv,this.opt.sTemplateBodyEdit.replace(/%msg_id%/g,this.sCurMessageId.substr(4)).replace(/%body%/,c).replace(/\{&dollarfix;\$\}/g,"$"));this.oCurSubjectDiv=document.getElementById("subject_"+this.sCurMessageId.substr(4));this.sSubjectBuffer=getInnerHTML(this.oCurSubjectDiv);b=a.getElementsByTagName("subject")[0].childNodes[0].nodeValue.replace(/\$/g,"{&dollarfix;$}");setInnerHTML(this.oCurSubjectDiv,this.opt.sTemplateSubjectEdit.replace(/%subject%/,b).replace(/\{&dollarfix;\$\}/g,
"$"));return true};QuickModify.prototype.modifyCancel=function(){if(this.oCurMessageDiv){setInnerHTML(this.oCurMessageDiv,this.sMessageBuffer);setInnerHTML(this.oCurSubjectDiv,this.sSubjectBuffer)}return this.bInEditMode=false};
QuickModify.prototype.modifySave=function(a,c){if(!this.bInEditMode)return true;if(typeof c=="undefined")c="sesc";var b=[];b[b.length]="subject="+escape(document.forms.quickModForm.subject.value.replace(/&#/g,"&#38;#").php_to8bit()).replace(/\+/g,"%2B");b[b.length]="message="+escape(document.forms.quickModForm.message.value.replace(/&#/g,"&#38;#").php_to8bit()).replace(/\+/g,"%2B");b[b.length]="topic="+parseInt(document.forms.quickModForm.elements.topic.value);b[b.length]="msg="+parseInt(document.forms.quickModForm.elements.msg.value);
ajax_indicator(true);sendXMLDocument.call(this,smf_prepareScriptUrl(this.opt.sScriptUrl)+"action=jsmodify;topic="+this.opt.iTopicId+";"+c+"="+a+";xml",b.join("&"),this.onModifyDone);return false};
QuickModify.prototype.onModifyDone=function(a){ajax_indicator(false);if(!a||!a.getElementsByTagName("smf")[0])this.modifyCancel();else{a=a.getElementsByTagName("smf")[0].getElementsByTagName("message")[0];var c=a.getElementsByTagName("body")[0],b=a.getElementsByTagName("error")[0];if(c){b="";for(var d=0;d<c.childNodes.length;d++)b+=c.childNodes[d].nodeValue;this.sMessageBuffer=this.opt.sTemplateBodyNormal.replace(/%body%/,b.replace(/\$/g,"{&dollarfix;$}")).replace(/\{&dollarfix;\$\}/g,"$");setInnerHTML(this.oCurMessageDiv,
this.sMessageBuffer);c=a.getElementsByTagName("subject")[0];b=c.childNodes[0].nodeValue.replace(/\$/g,"{&dollarfix;$}");this.sSubjectBuffer=this.opt.sTemplateSubjectNormal.replace(/%msg_id%/g,this.sCurMessageId.substr(4)).replace(/%subject%/,b).replace(/\{&dollarfix;\$\}/g,"$");setInnerHTML(this.oCurSubjectDiv,this.sSubjectBuffer);c.getAttribute("is_first")=="1"&&setInnerHTML(document.getElementById("top_subject"),this.opt.sTemplateTopSubject.replace(/%subject%/,b).replace(/\{&dollarfix;\$\}/g,"$"));
this.opt.bShowModify&&setInnerHTML(document.getElementById("modified_"+this.sCurMessageId.substr(4)),a.getElementsByTagName("modified")[0].childNodes[0].nodeValue)}else if(b){setInnerHTML(document.getElementById("error_box"),b.childNodes[0].nodeValue);document.forms.quickModForm.message.style.border=b.getAttribute("in_body")=="1"?this.opt.sErrorBorderStyle:"";document.forms.quickModForm.subject.style.border=b.getAttribute("in_subject")=="1"?this.opt.sErrorBorderStyle:""}}};
function InTopicModeration(a){this.opt=a;this.bButtonsShown=false;this.iNumSelected=0;if(typeof this.opt.sSessionVar=="undefined")this.opt.sSessionVar="sesc";this.init()}
InTopicModeration.prototype.init=function(){for(var a=0,c=this.opt.aMessageIds.length;a<c;a++){var b=document.createElement("input");b.type="checkbox";b.className="input_check";b.name="msgs[]";b.value=this.opt.aMessageIds[a];b.instanceRef=this;b.onclick=function(){this.instanceRef.handleClick(this)};var d=document.getElementById(this.opt.sCheckboxContainerMask+this.opt.aMessageIds[a]);d.appendChild(b);d.style.display=""}};
InTopicModeration.prototype.handleClick=function(a){if(!this.bButtonsShown){if(this.opt.sButtonStripDisplay&&document.getElementById(this.opt.sButtonStripDisplay))document.getElementById(this.opt.sButtonStripDisplay).style.display="";this.opt.bCanRemove&&smf_addButton(this.opt.sButtonStrip,this.opt.bUseImageButton,{sId:this.opt.sSelf+"_remove_button",sText:this.opt.sRemoveButtonLabel,sImage:this.opt.sRemoveButtonImage,sUrl:"#",sCustom:' onclick="return '+this.opt.sSelf+".handleSubmit('remove')\""});
this.opt.bCanRestore&&smf_addButton(this.opt.sButtonStrip,this.opt.bUseImageButton,{sId:this.opt.sSelf+"_restore_button",sText:this.opt.sRestoreButtonLabel,sImage:this.opt.sRestoreButtonImage,sUrl:"#",sCustom:' onclick="return '+this.opt.sSelf+".handleSubmit('restore')\""});this.bButtonsShown=true}this.iNumSelected+=a.checked?1:-1;if(this.opt.bCanRemove&&!this.opt.bUseImageButton){setInnerHTML(document.getElementById(this.opt.sSelf+"_remove_button"),this.opt.sRemoveButtonLabel+" ["+this.iNumSelected+
"]");document.getElementById(this.opt.sSelf+"_remove_button").style.display=this.iNumSelected<1?"none":""}if(this.opt.bCanRestore&&!this.opt.bUseImageButton){setInnerHTML(document.getElementById(this.opt.sSelf+"_restore_button"),this.opt.sRestoreButtonLabel+" ["+this.iNumSelected+"]");document.getElementById(this.opt.sSelf+"_restore_button").style.display=this.iNumSelected<1?"none":""}a=document.getElementById(this.opt.sButtonStrip).getElementsByTagName("span");if(this.iNumSelected<1){a[a.length-
3].className=a[a.length-3].className.replace(/\s*position_holder/,"last");a[a.length-2].className=a[a.length-2].className.replace(/\s*position_holder/,"last")}else{a[a.length-2].className=a[a.length-2].className.replace(/\s*last/,"position_holder");a[a.length-3].className=a[a.length-3].className.replace(/\s*last/,"position_holder")}};
InTopicModeration.prototype.handleSubmit=function(a){var c=document.getElementById(this.opt.sFormId),b=document.createElement("input");b.type="hidden";b.name=this.opt.sSessionVar;b.value=this.opt.sSessionId;c.appendChild(b);switch(a){case "remove":if(!confirm(this.opt.sRemoveButtonConfirm))return false;c.action=c.action.replace(/;restore_selected=1/,"");break;case "restore":if(!confirm(this.opt.sRestoreButtonConfirm))return false;c.action+=";restore_selected=1";break;default:return false}c.submit();
return true};function expandThumb(a){var c=document.getElementById("thumb_"+a);a=document.getElementById("link_"+a);var b=c.src;c.src=a.href;a.href=b;c.style.width="";c.style.height="";return false};