/*======================================================================*\
|| #################################################################### ||
|| # vBulletin 4.0.0 Alpha 5
|| # ---------------------------------------------------------------- # ||
|| # Copyright ©2000-2009 Jelsoft Enterprises Ltd. 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 qr_repost=false;var qr_errors_shown=false;var qr_active=false;var qr_ajax=null;var qr_old_title="";var qr_postid=null;var qr_withquote=null;var qr_imgsrc="";var clickedelm=false;if(typeof (vB_XHTML_Ready)!="undefined"){vB_XHTML_Ready.subscribe(qr_init)}function qr_init(){if(fetch_object("quick_reply")){qr_old_title=fetch_object("quickreply_title").innerHTML;qr_disable_controls();qr_init_buttons(fetch_object("posts"))}}function qr_init_buttons(D){var C=fetch_tags(D,"a");for(var B=0;B<C.length;B++){if(C[B].id&&C[B].id.substr(0,3)=="qr_"){C[B].onclick=function(F){return qr_newreply_activate(this.id.substr(3),false)}}else{if(C[B].id&&C[B].id.substr(0,5)=="qrwq_"){C[B].onclick=function(F){return qr_newreply_activate(this.id.substr(5),true)}}}}var A=fetch_object("newreplylink_top");if(A){A.onclick=function(F){qr_reset();return qr_activate(last_post_id)};A.ondblclick=function(F){window.location=this.href}}var E=fetch_object("newreplylink_bottom");if(E){E.onclick=function(F){qr_reset();return qr_activate(last_post_id)};E.ondblclick=function(F){window.location=this.href}}}function qr_disable_controls(){if(require_click){fetch_object("qr_postid").value=0;vB_Editor[QR_EditorID].disable_editor(vbphrase.click_quick_reply_icon);var A=fetch_object("cb_signature");if(A!=null){A.disabled=true}active=false;qr_active=false}else{vB_Editor[QR_EditorID].write_editor_contents("");qr_active=true}}function qr_activate(D,B){var C=fetch_object("collapseobj_quickreply");if(C&&C.style.display=="none"){toggle_collapse("quickreply")}fetch_object("qr_postid").value=D;if(fetch_object("qr_specifiedpost")){fetch_object("qr_specifiedpost").value=1}fetch_object("qr_preview").select();var A=fetch_object("cb_signature");if(A){A.disabled=false;A.checked=true}B=(B?B:"");vB_Editor[QR_EditorID].enable_editor(B);if(!is_ie&&vB_Editor[QR_EditorID].wysiwyg_mode){fetch_object("qr_scroll").scrollIntoView(false)}vB_Editor[QR_EditorID].check_focus();qr_active=true;return false}function qr_newreply_activate(C,B){if(qr_postid==C&&qr_withquote==B){return true}qr_postid=C;qr_withquote=B;if(YAHOO.util.Dom.get("progress_"+C)){var A=(B?"quoteimg_":"replyimg_")+C;qr_imgsrc=YAHOO.util.Dom.get(A).getAttribute("src");YAHOO.util.Dom.get(A).setAttribute("src",YAHOO.util.Dom.get("progress_"+C).getAttribute("src"))}document.body.style.cursor="wait";if(B){qr_ajax=YAHOO.util.Connect.asyncRequest("POST","ajax.php?do=getquotes&p="+C,{success:qr_handle_activate,failure:qr_handle_error,timeout:vB_Default_Timeout},SESSIONURL+"securitytoken="+SECURITYTOKEN+"&do=getquotes&p="+C)}else{qr_handle_activate(false)}return false}function qr_handle_activate(I){try{var A=qr_postid;qr_reset();qr_disable_controls();qr_hide_errors();qr_postid=A;var G="";if(I){var F=I.responseXML.getElementsByTagName("quotes");if(F){var G=F[0].firstChild.nodeValue}}fetch_object("quickreply_title").innerHTML="Reply";var H=fetch_object("qr_cancelbutton");H.style.display="";var C=fetch_object("quick_reply");C.parentNode.removeChild(C);var D=fetch_object("qr_container_"+A);D.appendChild(C);qr_activate(A,G);if(YAHOO.util.Dom.get("progress_"+A)){var B=(qr_withquote?"quoteimg_":"replyimg_")+A;YAHOO.util.Dom.get(B).setAttribute("src",qr_imgsrc)}document.body.style.cursor="auto"}catch(E){qr_resubmit()}}function qr_reset(){qr_postid=null;fetch_object("qr_postid").value=last_post_id;var C=fetch_object("quick_reply");C.parentNode.removeChild(C);var B=fetch_object("qr_defaultcontainer");B.appendChild(C);var D=fetch_object("quickreply_title");D.innerHTML=qr_old_title;var A=fetch_object("qr_cancelbutton");A.style.display="none";if(!require_click){vB_Editor[QR_EditorID].enable_editor("")}return false}function qr_prepare_submit(D,A){if(qr_repost==true){return true}if(!allow_ajax_qr||!AJAX_Compatible){return qr_check_data(D,A)}else{if(qr_check_data(D,A)){if(typeof vb_disable_ajax!="undefined"&&vb_disable_ajax>0){return true}if(is_ie&&userAgent.indexOf("msie 5.")!=-1){if(PHP.urlencode(D.message.value).indexOf("%u")!=-1){return true}}if(YAHOO.util.Connect.isCallInProgress(qr_ajax)){return false}if(clickedelm==D.preview.value){return true}else{var E="ajax=1";if(typeof ajax_last_post!="undefined"){E+="&ajax_lastpost="+PHP.urlencode(ajax_last_post)}for(var C=0;C<D.elements.length;C++){var F=D.elements[C];if(F.name&&!F.disabled){switch(F.type){case"text":case"textarea":case"hidden":E+="&"+F.name+"="+PHP.urlencode(F.value);break;case"checkbox":case"radio":E+=F.checked?"&"+F.name+"="+PHP.urlencode(F.value):"";break;case"select-one":E+="&"+F.name+"="+PHP.urlencode(F.options[F.selectedIndex].value);break;case"select-multiple":for(var B=0;B<F.options.length;B++){E+=(F.options[B].selected?"&"+F.name+"="+PHP.urlencode(F.options[B].value):"")}break}}}fetch_object("qr_posting_msg").style.display="";document.body.style.cursor="wait";qr_ajax_post(D.action,E);return false}}else{return false}}}function qr_resubmit(){qr_repost=true;var B=document.createElement("input");B.type="hidden";B.name="ajaxqrfailed";B.value="1";var A=YAHOO.util.Dom.get("quick_reply");if(!A){A=YAHOO.util.Dom.get("qrform")}A.appendChild(B);A.submit()}function qr_check_data(B,A){switch(fetch_object("qr_postid").value){case"0":fetch_object("qr_postid").value=last_post_id;case"who cares":if(typeof B.quickreply!="undefined"){B.quickreply.checked=false}break}if(clickedelm==B.preview.value){A=0}return vB_Editor[QR_EditorID].prepare_submit(0,A)}function qr_ajax_post(B,A){if(YAHOO.util.Connect.isCallInProgress(qr_ajax)){YAHOO.util.Connect.abort(qr_ajax)}qr_repost=false;qr_ajax=YAHOO.util.Connect.asyncRequest("POST",B,{success:qr_do_ajax_post,failure:qr_handle_error,timeout:vB_Default_Timeout},SESSIONURL+"securitytoken="+SECURITYTOKEN+"&"+A)}function qr_handle_error(A){vBulletin_AJAX_Error_Handler(A);fetch_object("qr_posting_msg").style.display="none";document.body.style.cursor="default";qr_resubmit()}function qr_do_ajax_post(F){if(F.responseXML){document.body.style.cursor="auto";fetch_object("qr_posting_msg").style.display="none";var D;if(fetch_tag_count(F.responseXML,"postbit")){qr_reset();ajax_last_post=F.responseXML.getElementsByTagName("time")[0].firstChild.nodeValue;qr_disable_controls();qr_hide_errors();var C=F.responseXML.getElementsByTagName("postbit");for(D=0;D<C.length;D++){var I=document.createElement("div");I.innerHTML=C[D].firstChild.nodeValue;var A=I.getElementsByTagName("li")[0];var H=YAHOO.util.Dom.get("posts");if(A){var B=H.appendChild(A);PostBit_Init(B,C[D].getAttribute("postid"));A.scrollIntoView(false)}}if(typeof mq_unhighlight_all=="function"){mq_unhighlight_all()}if(fetch_object("qr_submit")){fetch_object("qr_submit").blur()}}else{if(!is_saf){var G=F.responseXML.getElementsByTagName("error");if(G.length){var E="<ol>";for(D=0;D<G.length;D++){E+="<li>"+G[D].firstChild.nodeValue+"</li>"}E+="</ol>";qr_show_errors(E);return false}}qr_resubmit()}}else{qr_resubmit()}}function qr_show_errors(A){qr_errors_shown=true;fetch_object("qr_error_td").innerHTML=A;fetch_object("qr_error_tbody").style.display="";vB_Editor[QR_EditorID].check_focus();return false}function qr_hide_errors(){if(qr_errors_shown){qr_errors_shown=true;fetch_object("qr_error_tbody").style.display="none";return false}}var vB_QuickReply=true;