/**
 * Tools for posting
 * @author mad@Max
 */
function MDMTools(a,b,c){this.varname=a;if(location.href.search(/www\./)!=-1){if(b.search(/www\./)!=-1){this.bb=b}else{this.bb="http://www."+((b.substring(0,7)=="http://")?b.substring(7):b)}}else{this.bb=(b.search(/www\./)!=-1)?b.replace(/www\./):b}this.member=c;this.tid=null;this.pid=null}MDMTools.prototype.showPost=function(h,f){this.close();var a=document.createElement("div");a.id="mdmsp";a.className="tborder";a.style.width="640px";a.style.position="absolute";a.style.zIndex="100";document.body.appendChild(a);var b=document.createElement("div");b.className="tcat";b.id="mdmdd";b.style.cursor="move";b.innerHTML='<span style="float: right;">'+(this.member?'<a id="mdmec" href="#" onclick="'+this.varname+".getEditor("+f+'); return false;" >Call Editor</a>':"")+'&nbsp;&nbsp;&nbsp;<a href="#" onclick="'+this.varname+".postNav("+h+", "+f+', \'prevpost\'); return false;">Prev</a>&nbsp|&nbsp;<a href="#" onclick="'+this.varname+".postNav("+h+", "+f+', \'nextpost\'); return false;">Next</a>&nbsp;&nbsp;<a href="#" onclick="'+this.varname+'.close(); return false;" title="Close Window" style="text-decoration: none; color: red;">X</a></span><a href="'+this.bb+"/showthread.php?"+(SESSIONURL?"s="+SESSIONURL:"")+"p="+h+"#post"+h+'">'+vbphrase.changsp+'</a>&nbsp&nbsp;<span id="postloading" style="display: none;">Loading...</span>';a.appendChild(b);var g=document.createElement("div");g.id="edit"+h;g.style.height="480px";g.style.overflow="auto";a.appendChild(g);center_element(a);display_post(h);var c=document.createElement("div");c.innerHTML='<div style="display: none;"><div id="lastpost"></div></div><div id="editorpost"></div>';a.appendChild(c);var e=this;if(typeof(post_thanks_give)=="undefined"){this.loadScript([this.bb+"/clientscript/vbulletin_textedit.js",this.bb+"/clientscript/vbulletin_quick_edit.js",this.bb+"/clientscript/post_thanks.js"],function(){vB_AJAX_QuickEdit_Init("edit"+h)})}if(typeof(YAHOO.util.DD)=="undefined"){this.loadScript("http://yui.yahooapis.com/2.7.0/build/dragdrop/dragdrop-min.js",function(){var i=new YAHOO.util.DD("mdmsp");i.setHandleElId("mdmdd")})}else{var d=new YAHOO.util.DD("mdmsp");d.setHandleElId("mdmdd")}};MDMTools.prototype.close=function(){var a=fetch_object("mdmsp");if(a!==null){a.parentNode.removeChild(a)}};MDMTools.prototype.postNav=function(c,a,b){YAHOO.util.Connect.asyncRequest("POST",this.bb+"/postnav.php?do="+b,{success:function(d){if(d.responseText){this.showPost(d.responseText,a)}},failure:vBulletin_AJAX_Error_Handler,timeout:vB_Default_Timeout,scope:this},SESSIONURL+"&securitytoken="+SECURITYTOKEN+"&do="+b+"&p="+c+"&t="+a)};MDMTools.prototype.getEditor=function(b){this.tid=b;var a=this;fetch_object("postloading").style.display="inline";if(typeof(qr_init)=="undefined"){this.loadScript(this.bb+"/clientscript/vbulletin_quick_reply.js",function(){a.getting()})}else{this.getting()}};MDMTools.prototype.getting=function(){YAHOO.util.Connect.asyncRequest("POST",this.bb+"/showthread.php?do=geteditor",{success:function(f){if(f.responseXML){var g=document.getElementsByTagName("head")[0];var d=f.responseXML.getElementsByTagName("stcss");var c=f.responseXML.getElementsByTagName("scred");var b=f.responseXML.getElementsByTagName("stateditor");fetch_object("editorpost").innerHTML=b[0].firstChild.nodeValue;var e=document.createElement("script");e.innerHTML=c[0].firstChild.nodeValue;g.appendChild(e);var a=document.createElement("style");a.innerHTML=d[0].firstChild.nodeValue;g.appendChild(a);fetch_object("postloading").style.display="none";fetch_object("mdmec").style.display="none"}},failure:vBulletin_AJAX_Error_Handler,timeout:vB_Default_Timeout,scope:this},SESSIONURL+"securitytoken="+SECURITYTOKEN+"&do=geteditor&t="+this.tid)};MDMTools.prototype.loadScript=function(b,d){b=(typeof(b)=="string")?[b]:b;for(var c=0;c<b.length;c++){var a=document.createElement("script");YAHOO.util.Dom.setAttribute(a,"type","text/javascript");if(c==b.length-1){if(typeof(d)!="undefined"){if(a.readyState){a.onreadystatechange=function(){if(a.readyState=="loaded"||a.readyState=="complete"){a.onreadystatechange=null;d()}}}else{a.onload=function(){d()}}}}YAHOO.util.Dom.setAttribute(a,"src",b[c]+"?"+Math.floor(Math.random()*100000));document.getElementsByTagName("head")[0].appendChild(a)}};
