var smf_topic, smf_start, smf_show_modify, quickReplyCollapsed, buff_message, cur_msg_id, cur_msg_div, buff_subject, cur_subject_div, in_edit_mode = 0; function doQuote(c, a) { if(quickReplyCollapsed) { window.location.href = smf_scripturl + "?action=post;quote=" + c + ";topic=" + smf_topic + "." + smf_start + ";sesc=" + a }else { if(window.XMLHttpRequest) { typeof window.ajax_indicator == "function" && ajax_indicator(true); getXMLDocument(smf_scripturl + "?action=quotefast;quote=" + c + ";sesc=" + a + ";xml", onDocReceived) }else { reqWin(smf_scripturl + "?action=quotefast;quote=" + c + ";sesc=" + a, 240, 90) } window.location.hash = navigator.appName == "Microsoft Internet Explorer" ? "quickreply" : "#quickreply" } } function onDocReceived(c) { for(var a = "", b = 0;b < c.getElementsByTagName("quote")[0].childNodes.length;b++) { a += c.getElementsByTagName("quote")[0].childNodes[b].nodeValue } replaceText(a, document.forms.postmodify.message); typeof window.ajax_indicator == "function" && ajax_indicator(false) } function modify_msg(c, a) { if(window.XMLHttpRequest) { if(typeof window.opera != "undefined") { if(typeof(new XMLHttpRequest).setRequestHeader != "function") { return } } in_edit_mode == 1 && modify_cancel(); in_edit_mode = 1; typeof window.ajax_indicator == "function" && ajax_indicator(true); getXMLDocument(smf_scripturl + "?action=quotefast;quote=" + c + ";sesc=" + a + ";modify;xml", onDocReceived_modify) } } function onDocReceived_modify(c) { var a = "", b = ""; cur_msg_id = c.getElementsByTagName("message")[0].getAttribute("id"); for(b = 0;b < c.getElementsByTagName("message")[0].childNodes.length;b++) { a += c.getElementsByTagName("message")[0].childNodes[b].nodeValue } cur_msg_div = document.getElementById(cur_msg_id); buff_message = getInnerHTML(cur_msg_div); a = a.replace(/\$/g, "{&dollarfix;$}"); a = smf_template_body_edit.replace(/%body%/, a).replace(/%msg_id%/g, cur_msg_id.substr(4));  a = a.replace(/\{&dollarfix;\$\}/g, "$"); setInnerHTML(cur_msg_div, a); cur_subject_div = document.getElementById("subject_" + cur_msg_id.substr(4)); buff_subject = getInnerHTML(cur_subject_div); b = c.getElementsByTagName("subject")[0].childNodes[0].nodeValue; b = b.replace(/\$/g, "{&dollarfix;$}"); b = smf_template_subject_edit.replace(/%subject%/, b); b = b.replace(/\{&dollarfix;\$\}/g, "$"); setInnerHTML(cur_subject_div, b); typeof window.ajax_indicator == "function" && ajax_indicator(false) } function modify_cancel() { setInnerHTML(cur_msg_div, buff_message); setInnerHTML(cur_subject_div, buff_subject); in_edit_mode = 0; return false } function modify_save(c) { if(!in_edit_mode) { return true } var a = []; a[a.length] = "subject=" + escape(textToEntities(document.forms.quickModForm.subject.value.replace(/&#/g, "&#38;#"))).replace(/\+/g, "%2B"); a[a.length] = "message=" + escape(textToEntities(document.forms.quickModForm.message.value.replace(/&#/g, "&#38;#"))).replace(/\+/g, "%2B"); a[a.length] = "topic=" + parseInt(document.forms.quickModForm.elements.topic.value); a[a.length] = "msg=" + parseInt(document.forms.quickModForm.elements.msg.value); typeof window.ajax_indicator == "function" && ajax_indicator(true); sendXMLDocument(smf_scripturl + "?action=jsmodify;topic=" + smf_topic + ";sesc=" + c + ";xml", a.join("&"), modify_done); return false } function modify_done(c) { if(c) { c = c.getElementsByTagName("smf")[0].getElementsByTagName("message")[0]; var a = c.getElementsByTagName("body")[0], b = c.getElementsByTagName("error")[0]; if(a) { b = ""; for(i = 0;i < a.childNodes.length;i++) { b += a.childNodes[i].nodeValue } b = b.replace(/\$/g, "{&dollarfix;$}"); b = smf_template_body_normal.replace(/%body%/, b); b = b.replace(/\{&dollarfix;\$\}/g, "$"); setInnerHTML(cur_msg_div, b); buff_message = b; a = c.getElementsByTagName("subject")[0];  b = a.childNodes[0].nodeValue; b = b.replace(/\$/g, "{&dollarfix;$}"); var d = smf_template_subject_normal.replace(/%msg_id%/g, cur_msg_id.substr(4)).replace(/%subject%/, b); d = d.replace(/\{&dollarfix;\$\}/g, "$"); setInnerHTML(cur_subject_div, d); buff_subject = d; if(a.getAttribute("is_first") == 1) { a = smf_template_top_subject.replace(/%subject%/, b); a = a.replace(/\{&dollarfix;\$\}/g, "$"); setInnerHTML(document.getElementById("top_subject"), a) } if(smf_show_modify) { a = document.getElementById("modified_" + cur_msg_id.substr(4)); setInnerHTML(a, c.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" ? "1px solid red" : ""; document.forms.quickModForm.subject.style.border = b.getAttribute("in_subject") == "1" ? "1px solid red" : "" } } typeof window.ajax_indicator == "function" && ajax_indicator(false) }else { modify_cancel() } } function showModifyButtons() { for(var c = document.images.length, a = 0;a < c;a++) { if(document.images[a].id.substr(0, 14) == "modify_button_") { document.images[a].style.display = "" } } } function expandThumb(c) { var a = document.getElementById("thumb_" + c); c = document.getElementById("link_" + c); var b = a.src; a.src = c.href; c.href = b; a.style.width = ""; a.style.height = ""; return false } function swapQuickReply() { document.getElementById("quickReplyExpand").src = smf_images_url + "/" + (quickReplyCollapsed ? "collapse.gif" : "expand.gif"); document.getElementById("quickReplyOptions").style.display = quickReplyCollapsed ? "" : "none"; quickReplyCollapsed = !quickReplyCollapsed } ;
