var Debug={write:function(a){jsDebug&&!Object.isUndefined(window.console)&&console.log(a)},dir:function(a){jsDebug&&!Object.isUndefined(window.console)&&console.dir(a)},error:function(a){jsDebug&&!Object.isUndefined(window.console)&&console.error(a)},warn:function(a){jsDebug&&!Object.isUndefined(window.console)&&console.warn(a)},info:function(a){jsDebug&&!Object.isUndefined(window.console)&&console.info(a)}};Event.observe(window,"load",function(){Element.Methods.getOffsetParent=function(a){if(a.offsetParent&&a.offsetParent!=document.body)return $(a.offsetParent);if(a==document.body)return $(a);for(;(a=a.parentNode)&&a!=document.body;)if(Element.getStyle(a,"position")!="static")return $(a);return $(document.body)}});function _getOffsetParent(a){if(a.offsetParent&&a.offsetParent!=document.body)return $(a.offsetParent);if(a==document.body)return $(a);for(;(a=a.parentNode)&&a!=document.body;)if(Element.getStyle(a,"position")!="static")return $(a);return $(document.body)}
Prototype.Browser.IE6=Prototype.Browser.IE&&parseInt(navigator.userAgent.substring(navigator.userAgent.indexOf("MSIE")+5))==6;Prototype.Browser.IE7=Prototype.Browser.IE&&parseInt(navigator.userAgent.substring(navigator.userAgent.indexOf("MSIE")+5))==7;Prototype.Browser.IE8=Prototype.Browser.IE&&!Prototype.Browser.IE6&&!Prototype.Browser.IE7;Prototype.Browser.Chrome=Prototype.Browser.WebKit&&navigator.userAgent.indexOf("Chrome/")>-1;window.IPBoard=Class.create({namePops:[],vars:[],lang:[],templates:[],editors:$A(),initDone:false,initialize:function(){Debug.write("IPBjs is loading...");document.observe("dom:loaded",function(){this.Cookie.init();Ajax.Responders.register({onLoading:function(){if(!$("ajax_loading")){if(!ipb.templates.ajax_loading)return;$("ipboard_body").insert(ipb.templates.ajax_loading)}new Effect.Appear($("ajax_loading"),{duration:0.2})},onComplete:function(){$("ajax_loading")&&new Effect.Fade($("ajax_loading"),{duration:0.2})}});ipb.delegate.initialize();ipb.initDone=true}.bind(this))},positionCenter:function(a,b){if($(a)){elem_s=$(a).getDimensions();window_s=document.viewport.getDimensions();window_offsets=document.viewport.getScrollOffsets();center={left:(window_s.width-elem_s.width)/2,top:(window_s.height-elem_s.height)/2};if(typeof b=="undefined"||b!="h"&&b!="v")$(a).setStyle("top: "+center.top+"px; left: "+center.left+"px");else if(b=="h")$(a).setStyle("left: "+center.left+"px");else b=="v"&&$(a).setStyle("top: "+center.top+"px");$(a).setStyle("position: fixed")}},showModal:function(){$("ipb_modal")||this.createModal();this.modal.show()},hideModal:function(){$("ipb_modal")&&this.modal.hide()},createModal:function(){this.modal=(new Element("div",{id:"ipb_modal"})).hide().addClassName("modal");this.modal.setStyle("width: 100%; height: 100%; position: absolute; top: 0px; left: 0px; overflow: hidden; z-index: 1000; opacity: 0.2");$("ipboard_body").insert({bottom:this.modal})},alert:function(a){$("ipb_alert")||this.createAlert();this.showModal();$("ipb_alert_message").update(a)},createAlert:function(){wrapper=new Element("div",{id:"ipb_alert"});icon=new Element("div",{id:"ipb_alert_icon"});message=new Element("div",{id:"ipb_alert_message"});ok_button=new Element("input",{type:"button",value:"OK",id:"ipb_alert_ok"});cancel_button=new Element("input",{type:"button",value:"Cancel",id:"ipb_alert_cancel"});wrapper.insert({bottom:icon}).insert({bottom:message}).insert({bottom:ok_button}).insert({bottom:cancel_button}).setStyle("z-index: 1001");$("ipboard_body").insert({bottom:wrapper});this.positionCenter(wrapper,"h")},editorInsert:function(a,b){if(b)b=ipb.editors[b];else{Debug.dir(ipb.editors);b=$A(ipb.editors).first();Debug.write(b)}if(Object.isUndefined(b))Debug.error("Can't find any suitable editor");else{b.insert_text(a);b.editor_check_focus()}}});IPBoard.prototype.delegate={store:$A(),initialize:function(){document.observe("click",function(a){if(Event.isLeftClick(a)||Prototype.Browser.IE){var b=null,c=null,d=ipb.delegate.store.find(function(e){if(b=a.findElement(e.selector)){c=e;return true}else return false});if(!Object.isUndefined(d))if(c){Debug.write("Firing callback for selector "+c.selector);c.callback(a,b,c.params)}}})},register:function(a,b,c){ipb.delegate.store.push({selector:a,callback:b,params:c})}};IPBoard.prototype.Cookie={store:[],initDone:false,set:function(a,b,c){var d="",e="/",f="";if(a){if(c)if(c==1)d="; expires=Wed, 1 Jan 2020 00:00:00 GMT";else if(c==-1)d="; expires=Thu, 01-Jan-1970 00:00:01 GMT";else if(c.length>10)d="; expires="+c;if(ipb.vars.cookie_domain)f="; domain="+ipb.vars.cookie_domain;if(ipb.vars.cookie_path)e=ipb.vars.cookie_path;document.cookie=ipb.vars.cookie_id+a+"="+escape(b)+"; path="+e+d+f+";";ipb.Cookie.store[a]=b;Debug.write("Set cookie: "+ipb.vars.cookie_id+a+"="+b+"; path="+e+d+f+";")}},get:function(a){ipb.Cookie.initDone!==true&&ipb.Cookie.init();if(ipb.Cookie.store[a])return ipb.Cookie.store[a];return""},doDelete:function(a){Debug.write("Deleting cookie "+a);ipb.Cookie.set(a,"",-1)},init:function(){if(ipb.Cookie.initDone)return true;skip=["session_id","ipb_admin_session_id","member_id","pass_hash"];(cookies=$H(document.cookie.replace(" ","").toQueryParams(";")))&&cookies.each(function(a){a[0]=a[0].strip();if(ipb.vars.cookie_id!="")if(a[0].startsWith(ipb.vars.cookie_id))a[0]=a[0].replace(ipb.vars.cookie_id,"");else return;if(!skip[a[0]]){ipb.Cookie.store[a[0]]=unescape(a[1]||"");Debug.write("Loaded cookie: "+a[0]+" = "+a[1])}});ipb.Cookie.initDone=true}};IPBoard.prototype.validate={isFilled:function(a){if(!$(a))return null;return!$F(a).blank()},isNumeric:function(a){if(!$(a))return null;return $F(a).match(/^[\d]+?$/)},isMatching:function(a,b){if(!$(a)||!$(b))return null;return $F(a)==$F(b)},email:function(a){if(!$(a))return null;return $F(a).match(/^.+@.+\..{2,4}$/)?true:false}};IPBoard.prototype.Autocomplete=Class.create({initialize:function(a,b){this.id=$(a).id;this.timer=null;this.last_string="";this.internal_cache=$H();this.pointer=0;this.items=$A();this.observing=true;this.objHasFocus=null;this.options=Object.extend({min_chars:3,multibox:false,global_cache:false,classname:"ipb_autocomplete",templates:{wrap:new Template("<ul id='#{id}'></ul>"),item:new Template("<li id='#{id}'>#{itemvalue}</li>")}},b||{});if(!$(this.id)){Debug.error("Invalid textbox ID");return false}this.obj=$(this.id);if(!this.options.url){Debug.error("No URL specified for autocomplete");return false}$(this.obj).writeAttribute("autocomplete","off");this.buildList();$(this.obj).observe("focus",this.timerEventFocus.bindAsEventListener(this));$(this.obj).observe("blur",this.timerEventBlur.bindAsEventListener(this));$(this.obj).observe("keypress",this.eventKeypress.bindAsEventListener(this))},eventKeypress:function(a){if([Event.KEY_TAB,Event.KEY_UP,Event.KEY_DOWN,Event.KEY_LEFT,Event.KEY_RIGHT,Event.KEY_RETURN].include(a.keyCode))if($(this.list).visible()){switch(a.keyCode){case Event.KEY_TAB:;case Event.KEY_RETURN:this.selectCurrentItem(a);break;case Event.KEY_UP:;case Event.KEY_LEFT:this.selectPreviousItem(a);break;case Event.KEY_DOWN:;case Event.KEY_RIGHT:this.selectNextItem(a);break}
Event.stop(a)}},selectCurrentItem:function(){var a=$(this.list).down(".active");this.unselectAll();if(!Object.isUndefined(a)){a=$(a).id.replace(this.id+"_ac_item_","");if(!a)return;a=this.items[a].replace("&amp;","&");if(this.options.multibox){if($F(this.obj).indexOf(",")!==-1){var b=$F(this.obj).split(",");b[b.length-1]="";$(this.obj).value=b.join(",")+" "}else $(this.obj).value="";$(this.obj).value=$F(this.obj)+a+", "}else{$(this.obj).value=a;new Effect.Fade($(this.list),{duration:0.3});this.observing=false}}$(this.obj).focus()},selectThisItem:function(a){this.unselectAll();var b=$(this.list).immediateDescendants();for(a=Event.element(a);!b.include(a);)a=a.up();$(a).addClassName("active")},selectPreviousItem:function(){var a=$(this.list).down(".active");this.unselectAll();if(Object.isUndefined(a))this.selectFirstItem();else(a=$(a).previous())?$(a).addClassName("active"):this.selectLastItem()},selectNextItem:function(){var a=$(this.list).down(".active");this.unselectAll();if(Object.isUndefined(a))this.selectFirstItem();else(a=$(a).next())?$(a).addClassName("active"):this.selectFirstItem()},selectFirstItem:function(){if($(this.list).visible()){this.unselectAll();$(this.list).firstDescendant().addClassName("active")}},selectLastItem:function(){if($(this.list).visible()){this.unselectAll();var a=$(this.list).immediateDescendants();(a=a[a.length-1])&&$(a).addClassName("active")}},unselectAll:function(){$(this.list).childElements().invoke("removeClassName","active")},timerEventBlur:function(a){window.clearTimeout(this.timer);this.eventBlur.bind(this).delay(0.6,a)},timerEventFocus:function(a){this.timer=this.eventFocus.bind(this).delay(0.4,a)},eventBlur:function(){this.objHasFocus=false;$(this.list).visible()&&new Effect.Fade($(this.list),{duration:0.3})},eventFocus:function(a){if(this.observing){this.objHasFocus=true;this.timer=this.eventFocus.bind(this).delay(0.6,a);var b=this.getCurrentName();if(b!=this.last_string)if(b.length<this.options.min_chars)$(this.list).visible()&&new Effect.Fade($(this.list),{duration:0.3,afterFinish:function(){$(this.list).update()}.bind(this)});else{this.last_string=b;json=this.cacheRead(b);if(json==false)new Ajax.Request(this.options.url+escape(b),{method:"get",evalJSON:"force",onSuccess:function(c){if(Object.isUndefined(c.responseJSON))Debug.error("Invalid response returned from the server");else{if(c.responseJSON.error){switch(c.responseJSON.error){case"requestTooShort":Debug.warn("Server said request was too short, skipping...");break;default:Debug.error("Server returned an error: "+c.responseJSON.error);break}
return false}if(c.responseText!="[]"){this.cacheWrite(b,c.responseJSON);this.updateAndShow(c.responseText.evalJSON())}}}.bind(this)});else this.updateAndShow(json)}}},updateAndShow:function(a){if(a){this.updateList(a);if(!$(this.list).visible()&&this.objHasFocus){Debug.write("Showing");new Effect.Appear($(this.list),{duration:0.3,afterFinish:function(){this.selectFirstItem()}.bind(this)})}}},cacheRead:function(a){if(this.options.global_cache!=false){if(!Object.isUndefined(this.options.global_cache[a])){Debug.write("Read from global cache");return this.options.global_cache[a]}}else if(!Object.isUndefined(this.internal_cache[a])){Debug.write("Read from internal cache");return this.internal_cache[a]}return false},cacheWrite:function(a,b){if(this.options.global_cache!==false)this.options.global_cache[a]=b;else this.internal_cache[a]=b;return true},getCurrentName:function(){if(this.options.multibox)if($F(this.obj).indexOf(",")===-1)return $F(this.obj).strip();else{var a=$F(this.obj).split(",");return a[a.length-1].strip()}else return $F(this.obj).strip()},buildList:function(){if(!$(this.id+"_ac")){var a=this.options.templates.wrap.evaluate({id:this.id+"_ac"});$$("body")[0].insert({bottom:a});a={};var b=$(this.id).viewportOffset(),c=$(this.id).getDimensions(),d=[0,0],e=null,f=document.viewport.getScrollOffsets();if(Element.getStyle($(this.id),"position")=="absolute"){e=element.getOffsetParent();d=e.viewportOffset()}a.left=b[0]-d[0];a.top=b[1]-d[1]+f.top;a.top+=c.height;$(this.id+"_ac").setStyle("position: absolute; top: "+a.top+"px; left: "+a.left+"px;").hide();this.list=$(this.id+"_ac")}},updateList:function(a){if(a&&$(this.list)){var b="";this.items=$A();a=$H(a);a.each(function(c){var d=this.options.templates.item.evaluate({id:this.id+"_ac_item_"+c.key,itemid:c.key,itemvalue:c.value.showas||c.value.name,img:c.value.img||"",img_w:c.value.img_w||"",img_h:c.value.img_h||""});this.items[c.key]=c.value.name;b+=d}.bind(this));$(this.list).update(b);$(this.list).immediateDescendants().each(function(c){$(c).observe("mouseover",this.selectThisItem.bindAsEventListener(this));$(c).observe("click",this.selectCurrentItem.bindAsEventListener(this));$(c).setStyle("cursor: pointer")}.bind(this));$(this.list).visible()&&this.selectFirstItem()}}});IPBoard.prototype.editor_values=$H({templates:$A(),colors_perrow:8,colors:["000000","A0522D","556B2F","006400","483D8B","000080","4B0082","2F4F4F","8B0000","FF8C00","808000","008000","008080","0000FF","708090","696969","FF0000","F4A460","9ACD32","2E8B57","48D1CC","4169E1","800080","808080","FF00FF","FFA500","FFFF00","00FF00","00FFFF","00BFFF","9932CC","C0C0C0","FFC0CB","F5DEB3","FFFACD","98FB98","AFEEEE","ADD8E6","DDA0DD","FFFFFF"],primary_fonts:$H({arial:"Arial",arialblack:"Arial Black",arialnarrow:"Arial Narrow",bookantiqua:"Book Antiqua",centurygothic:"Century Gothic",comicsansms:"Comic Sans MS",couriernew:"Courier New",franklingothicmedium:"Franklin Gothic Medium",garamond:"Garamond",georgia:"Georgia",impact:"Impact",lucidaconsole:"Lucida Console",lucidasansunicode:"Lucida Sans Unicode",microsoftsansserif:"Microsoft Sans Serif",palatinolinotype:"Palatino Linotype",tahoma:"Tahoma",timesnewroman:"Times New Roman",trebuchetms:"Trebuchet MS",verdana:"Verdana"}),font_sizes:$A([1,2,3,4,5,6,7])});Object.extend(RegExp,{escape:function(a){if(!arguments.callee.sRE)arguments.callee.sRE=new RegExp("(\\/|\\.|\\*|\\+|\\?|\\||\\(|\\)|\\[|\\]|\\{|\\}|\\\\|\\$)","g");return a.replace(arguments.callee.sRE,"\\$1")}});String.prototype.encodeUrl=function(){text=this;var a=text.match(/[\x90-\xFF]/g);if(a)for(var b=0;b<a.length;b++)text=text.replace(a[b],"%u00"+(a[b].charCodeAt(0)&255).toString(16).toUpperCase());return escape(text).replace(/\+/g,"%2B").replace(/%20/g,"+").replace(/\*/g,"%2A").replace(/\//g,"%2F").replace(/@/g,"%40")};String.prototype.encodeParam=function(){text=this;var a=text.match(/[\x90-\xFF]/g);if(a)for(var b=0;b<a.length;b++)text=text.replace(a[b],"%u00"+(a[b].charCodeAt(0)&255).toString(16).toUpperCase());return escape(text).replace(/\+/g,"%2B")};Date.prototype.getDST=function(){var a=new Date("January 1, 2008"),b=(new Date("July 1, 2008")).getTimezoneOffset()-a.getTimezoneOffset();a=this.getTimezoneOffset()-a.getTimezoneOffset();return b!=0?b==a?1:0:0};var Loader={require:function(a){document.write("<script type='text/javascript' src='"+a+".js'><\/script>")},boot:function(){$A(document.getElementsByTagName("script")).findAll(function(a){return a.src&&a.src.match(/ipb\.js(\?.*)?$/)}).each(function(a){var b=a.src.replace(/ipb\.js(\?.*)?$/,"");a=a.src.match(/\?.*load=([a-z0-9_,]*)/);!Object.isUndefined(a)&&a!=null&&a[1]&&a[1].split(",").each(function(c){c&&Loader.require(b+"ips."+c)})})}},_global=window.IPBoard;_global.prototype.global={searchTimer:[],searchLastQuery:"",rssItems:[],reputation:{},ac_cache:$H(),pageJumps:$H(),pageJumpMenus:$H(),boardMarkers:$H(),init:function(){Debug.write("Initializing ips.global.js");document.observe("dom:loaded",function(){ipb.global.initEvents()})},initEvents:function(){ipb.delegate.register(".__user",ipb.global.userPopup);ipb.delegate.register(".warn_link",ipb.global.displayWarnLogs);ipb.delegate.register(".mini_friend_toggle",ipb.global.toggleFriend);$("rss_feed")&&ipb.global.buildRSSmenu();if($("newSkin")||$("newLang"))ipb.global.setUpSkinLang();$("pm_notification")&&new Effect.Parallel([new Effect.Appear($("pm_notification")),new Effect.BlindDown($("pm_notification"))],{duration:0.5});$("close_pm_notification")&&$("close_pm_notification").observe("click",ipb.global.closePMpopup);ipb.global.buildPageJumps();ipb.delegate.register(".bbc_spoiler_show",ipb.global.toggleSpoiler);ipb.delegate.register('a[rel~="external"]',ipb.global.openNewWindow)},userPopup:function(a,b){Event.stop(a);b.identify();a=$(b).className.match("__id([0-9]+)");var c=$(b).className.match("__fid([0-9]+)");if(a==null||Object.isUndefined(a[1]))Debug.error("Error showing popup");else{var d="popup_"+a[1]+"_user",e=ipb.vars.base_url+"&app=members&module=ajax&secure_key="+ipb.vars.secure_hash+"&section=card&mid="+a[1];Debug.write(c);if(c!=null&&!Object.isUndefined(c[1])&&c[1])e+="&f="+c[1];Debug.write(e);ipb.namePops[a]=new ipb.Popup(d,{type:"balloon",ajaxURL:e,stem:true,hideAtStart:false,attach:{target:b,position:"auto"},w:"400px"})}},displayWarnLogs:function(a,b){mid=b.id.match("warn_link_([0-9a-z]+)_([0-9]+)")[2];if(!Object.isUndefined(mid)){if(parseInt(mid)==0)return false;Event.stop(a);warnLogs=new ipb.Popup("warnLogs",{type:"pane",modal:false,w:"500px",h:"500px",ajaxURL:ipb.vars.base_url+"&app=members&module=ajax&secure_key="+ipb.vars.secure_hash+"&section=warn&do=view&mid="+mid,hideAtStart:false,close:".cancel"})}},toggleFriend:function(a,b){Event.stop(a);var c=$(b).id.match("friend_(.*)_([0-9]+)");if(!Object.isUndefined(c[2])){var d=$(b).hasClassName("is_friend")?1:0;new Ajax.Request(ipb.vars.base_url+"app=members&section=friends&module=ajax&do="+(d?"remove":"add")+"&member_id="+c[2]+"&md5check="+ipb.vars.secure_hash,{method:"get",onSuccess:function(e){switch(e.responseText){case"pp_friend_timeflood":alert(ipb.lang.cannot_readd_friend);Event.stop(a);break;case"pp_friend_already":alert(ipb.lang.friend_already);Event.stop(a);break;case"error":return true;default:var f=d?ipb.templates.m_add_friend.evaluate({id:c[2]}):ipb.templates.m_rem_friend.evaluate({id:c[2]});$$(".mini_friend_toggle").each(function(g){if($(g).id.endsWith("_"+c[2]))d?$(g).removeClassName("is_friend").addClassName("is_not_friend").update(f):$(g).removeClassName("is_not_friend").addClassName("is_friend").update(f)});new Effect.Highlight($(b),{startcolor:ipb.vars.highlight_color});document.fire("ipb:friendRemoved",{friendID:c[2]});Event.stop(a);break}}})}},toggleFlagSpammer:function(a,b){if(b==true){if(confirm(ipb.lang.set_as_spammer)){var c=b=0,d=0;if(typeof ipb.topic!="undefined"){b=ipb.topic.topic_id;c=ipb.topic.forum_id;d=ipb.topic.start_id}window.location=ipb.vars.base_url+"app=forums&module=moderate&section=moderate&do=setAsSpammer&member_id="+a+"&t="+b+"&f="+c+"&st="+d+"&auth_key="+ipb.vars.secure_hash}}else alert(ipb.lang.is_spammer);return false},toggleSpoiler:function(a,b){Event.stop(a);if($(b).up().down(".bbc_spoiler_wrapper").down(".bbc_spoiler_content").toggle().visible())$(b).value="Hide";else $(b).value="Show"},setUpSkinLang:function(){if($("newSkin")){var a=$("newSkin").up("form");if(a){$("newSkinSubmit")&&$("newSkinSubmit").hide();$("newSkin").observe("change",function(){a.submit();return true})}}if($("newLang")){var b=$("newLang").up("form");if(b){$("newLangSubmit")&&$("newLangSubmit").hide();$("newLang").observe("change",function(){b.submit();return true})}}},buildRSSmenu:function(){$$("link").each(function(a){a.readAttribute("type")=="application/rss+xml"&&ipb.global.rssItems.push(ipb.templates.rss_item.evaluate({url:a.readAttribute("href"),title:a.readAttribute("title")}))});if(ipb.global.rssItems.length>0){rssmenu=ipb.templates.rss_shell.evaluate({items:ipb.global.rssItems.join("\n")});$("rss_feed").insert({after:rssmenu});new ipb.Menu($("rss_feed"),$("rss_menu"))}else $("rss_feed").hide()},closePMpopup:function(a){$("pm_notification")&&new Effect.Parallel([new Effect.Fade($("pm_notification")),new Effect.BlindUp($("pm_notification"))],{duration:0.5});Event.stop(a)},initGD:function(a){if($(a)){$(a).observe("click",ipb.global.generateNewImage);$("gd-image-link")&&$("gd-image-link").observe("click",ipb.global.generateNewImage)}},generateImageExternally:function(a){$(a)&&$(a).observe("click",ipb.global.generateNewImage)},generateNewImage:function(a){img=Event.findElement(a,"img");Event.stop(a);if(img!=document){if(!img)if(anchor=Event.findElement(a,"a"))img=anchor.up().down("img");oldSrc=img.src.toQueryParams();oldSrc=$H(oldSrc).toObject();oldSrc.captcha_unique_id||Debug.error("No captcha ID found");new Ajax.Request(ipb.vars.base_url+"app=core&module=global&section=captcha&do=refresh&captcha_unique_id="+oldSrc.captcha_unique_id+"&secure_key="+ipb.vars.secure_hash,{method:"get",onSuccess:function(b){oldSrc.captcha_unique_id=b.responseText;img.writeAttribute({src:ipb.vars.base_url+$H(oldSrc).toQueryString()});$F("regid").value=b.responseText}})}},registerReputation:function(a,b,c){if($(a)){var d=$(a).down(".rep_up"),e=$(a).down(".rep_down"),f=ipb.vars.base_url+"&app=core&module=ajax&section=reputation&do=add_rating&app_rate="+b.app+"&type="+b.type+"&type_id="+b.typeid+"&secure_key="+ipb.vars.secure_hash;$(d)&&$(d).observe("click",ipb.global.repRate.bindAsEventListener(this,1,a));$(e)&&$(e).observe("click",ipb.global.repRate.bindAsEventListener(this,-1,a));ipb.global.reputation[a]={obj:$(a),url:b,sendUrl:f,currentRating:c||0};Debug.write("Registered reputation")}},repRate:function(a){Event.stop(a);var b=$A(arguments)[1],c=$A(arguments)[2],d=b==1?1:-1;if(ipb.global.reputation[c]){var e=ipb.global.reputation[c];new Ajax.Request(e.sendUrl+"&rating="+d,{method:"get",onSuccess:function(f){if(f.responseText=="done"){try{e.obj.down(".rep_up").hide();e.obj.down(".rep_down").hide()}catch(g){}var h=e.obj.down(".rep_show");if(h){["positive","negative","zero"].each(function(i){h.removeClassName(i)});f=e.currentRating+d;if(f>0)h.addClassName("positive");else f<0?h.addClassName("negative"):h.addClassName("zero");h.update(parseInt(e.currentRating+d))}}else f.responseText=="nopermission"?alert(ipb.lang.no_permission):alert(ipb.lang.action_failed+": "+f.responseText)}})}},timer_liveSearch:function(){ipb.global.searchTimer.show=setTimeout(ipb.global.liveSearch,400)},timer_hideLiveSearch:function(){ipb.global.searchTimer.hide=setTimeout(ipb.global.hideLiveSearch,800)},hideLiveSearch:function(){new Effect.Fade($("live_search_popup"),{duration:0.4,afterFinish:function(){$("ajax_result").update("")}});ipb.global.searchLastQuery="";clearTimeout(ipb.global.searchTimer.show);clearTimeout(ipb.global.searchTimer.hide)},liveSearch:function(){ipb.global.timer_liveSearch();if(!($F("main_search").length<ipb.vars.live_search_limit)){if($("live_search_popup"))$("live_search_popup").visible()||new Effect.Appear($("live_search_popup"),{duration:0.4});else{Debug.write("Creating popup");ipb.global.buildSearchPopup()}if($F("main_search")!=ipb.global.searchLastQuery){var a="";if(ipb.vars.active_app)a+="&app_search="+ipb.vars.active_app;if(ipb.vars.search_type&&ipb.vars.search_type_id)a+="&search_type="+ipb.vars.search_type+"&search_type_id="+ipb.vars.search_type_id;if(ipb.vars.search_type_2&&ipb.vars.search_type_id_2)a+="&search_type_2="+ipb.vars.search_type_2+"&search_type_id_2="+ipb.vars.search_type_id_2;new Ajax.Request(ipb.vars.base_url+"app=core&module=ajax&section=livesearch&do=search&secure_key="+ipb.vars.secure_hash+"&search_term="+$F("main_search").encodeUrl()+a,{method:"get",onSuccess:function(b){$("ajax_result")&&$("ajax_result").update(b.responseText)}});ipb.global.searchLastQuery=$F("main_search")}}},buildSearchPopup:function(){pos=$("main_search").cumulativeOffset();finalPos={top:pos.top+$("main_search").getHeight(),left:pos.left+45};popup=(new Element("div",{id:"live_search_popup"})).hide().setStyle("top: "+finalPos.top+"px; left: "+finalPos.left+"px");$("content").insert({bottom:popup});var a="";if(ipb.vars.active_app)a+="&app_search="+ipb.vars.active_app;if(ipb.vars.search_type&&ipb.vars.search_type_id)a+="&search_type="+ipb.vars.search_type+"&search_type_id="+ipb.vars.search_type_id;if(ipb.vars.search_type_2&&ipb.vars.search_type_id_2)a+="&search_type_2="+ipb.vars.search_type_2+"&search_type_id_2="+ipb.vars.search_type_id_2;new Ajax.Request(ipb.vars.base_url+"app=core&module=ajax&section=livesearch&do=template&secure_key="+ipb.vars.secure_hash+a,{method:"get",onSuccess:function(b){popup.update(b.responseText)}});new Effect.Appear($("live_search_popup"),{duration:0.3})},convertSize:function(a){if(a<1024)return a+" B";if(a<1048576)return(a/1024).toFixed(2)+" KB";if(a<1073741824)return(a/1048576).toFixed(2)+" MB";return(a/1073741824).toFixed(2)+" GB"},initImageResize:function(){var a=document.viewport.getDimensions();ipb.global.screen_w=a.width;ipb.global.screen_h=a.height;ipb.global.max_w=Math.ceil(ipb.global.screen_w*(ipb.vars.image_resize/100))},findImgs:function(a){if($(a))if(ipb.vars.image_resize)$(a).hasClassName("imgsize_ignore")?Debug.write("Ignoring this post for image resizing..."):$(a).select("img.bbc_img").each(function(b){ipb.global.screen_w||ipb.global.initImageResize();ipb.global.resizeImage(b)})},resizeImage:function(a){if(a.tagName=="IMG")if(a.readAttribute("handled"))Debug.write("Handled...");else{if(!ipb.global.post_width){var b=$(a).up(".post");if(!Object.isUndefined(b)){var c=parseInt(b.getStyle("padding-left"))+parseInt(b.getStyle("padding-right"));ipb.global.post_width=$(b).getWidth()-c*2}}c=ipb.vars.image_resize_force?ipb.vars.image_resize_force:ipb.global.post_width?ipb.global.post_width:ipb.global.max_w;b=a.getDimensions();if(b.width>c){c=Math.ceil(c/b.width*100);if(c<100){a.height=b.height*(c/100);a.width=b.width*(c/100)}var d=ipb.templates.resized_img;$(a).wrap("div").addClassName("resized_img");$(a).insert({before:d.evaluate({percent:c,width:b.width,height:b.height})});$(a).addClassName("resized").setStyle("cursor: pointer;");$(a).writeAttribute("origWidth",b.width).writeAttribute("origHeight",b.height).writeAttribute("shrunk",1);$(a).writeAttribute("newWidth",a.width).writeAttribute("newHeight",a.height).writeAttribute("handled",1);$(a).observe("click",ipb.global.enlargeImage)}}},enlargeImage:function(a){var b=Event.element(a);b.hasClassName("resized")||(b=Event.findElement(a,".resized"));if(a=b)if($(a).readAttribute("shrunk")==1){$(a).setStyle("width: "+a.readAttribute("origWidth")+"px; height: "+a.readAttribute("origHeight")+"px; cursor: pointer");$(a).writeAttribute("shrunk",0)}else{$(a).setStyle("width: "+a.readAttribute("newWidth")+"px; height: "+a.readAttribute("newHeight")+"px; cursor: pointer");$(a).writeAttribute("shrunk",1);Debug.write("width: "+a.readAttribute("newWidth"))}},registerPageJump:function(a,b){if(a&&b)ipb.global.pageJumps[a]=b},buildPageJumps:function(){$$(".pagejump").each(function(a){var b=$(a).className.match(/pj([0-9]+)/);if(b[1]){$(a).identify();var c=ipb.templates.page_jump.evaluate({id:"pj_"+$(a).identify()});$$("body")[0].insert(c);$("pj_"+$(a).identify()+"_submit").observe("click",ipb.global.pageJump.bindAsEventListener(this,$(a).identify()));$("pj_"+$(a).identify()+"_input").observe("keypress",function(e){e.which==Event.KEY_RETURN&&ipb.global.pageJump(e,$(a).identify())});c=$("pj_"+$(a).identify()+"_wrap").addClassName("pj"+b[1]).writeAttribute("jumpid",b[1]);var d={afterOpen:function(){try{$("pj_"+$(a).identify()+"_input").activate()}catch(e){}}};ipb.global.pageJumpMenus[b[1]]=new ipb.Menu($(a),$(c),{stopClose:true},d)}})},pageJump:function(a,b){if($(b)&&$("pj_"+$(b).id+"_input")){a=$F("pj_"+$(b).id+"_input");var c=$("pj_"+$(b).id+"_wrap").readAttribute("jumpid");if(a.blank())try{ipb.global.pageJumpMenus[source].doClose()}catch(d){}else a=parseInt(a);if(b=ipb.global.pageJumps[c]){a=(a-1)*b.perPage;Debug.write(a);if(a<1)a=0;a=ipb.vars.seo_enabled&&document.location.toString().match(ipb.vars.seo_params.start)&&document.location.toString().match(ipb.vars.seo_params.end)?b.url.match(ipb.vars.seo_params.varBlock)?b.url+ipb.vars.seo_params.varSep+b.stKey+ipb.vars.seo_params.varSep+a:b.url+ipb.vars.seo_params.varBlock+b.stKey+ipb.vars.seo_params.varSep+a:b.url+"&amp;"+b.stKey+"="+a;a=a.replace(/&amp;/g,"&");a=a.replace(/(http:)?\/\//g,function(e,f){return f?e:"/"});document.location=a}else{Debug.dir(ipb.global.pageJumps);Debug.write(c)}}},openNewWindow:function(a,b,c){if(document.location.host!=b.host||c){window.open(b.href);Event.stop(a);return false}else return true},registerMarker:function(a,b,c){if(!(!$(a)||b.blank()||c.blank()))if(!Object.isUndefined(ipb.global.boardMarkers)){Debug.write("Marker INIT: "+a);$(a).observe("click",ipb.global.sendMarker.bindAsEventListener(this,a,b,c))}},sendMarker:function(a,b,c,d){Event.stop(a);ipb.global.boardMarkers[c]&&new Ajax.Request(d+"&secure_key="+ipb.vars.secure_hash,{method:"get",evalJSON:"force",onSuccess:function(e){if(Object.isUndefined(e.responseJSON)){Debug.error("Invalid server response");return false}if(e.responseJSON.error){Debug.error(e.responseJSON.error);return false}$(b).replace(ipb.global.boardMarkers[c])}})},registerCheckAll:function(a,b){if($(a)){$(a).observe("click",ipb.global.checkAll.bindAsEventListener(this,b));$$("."+b).each(function(c){$(c).observe("click",ipb.global.checkOne.bindAsEventListener(this,a))})}},checkAll:function(a,b){Debug.write("checkAll");a=Event.element(a);b=$$("."+b);a.checked?b.each(function(c){c.checked=true}):b.each(function(c){c.checked=false})},checkOne:function(a,b){a=Event.element(a);if($(b).checked&&a.checked==false)$(b).checked=false},updateReportStatus:function(a,b,c,d){Event.stop(a);c=ipb.vars.base_url+"app=core&amp;module=ajax&amp;section=reports&amp;do=change_status&secure_key="+ipb.vars.secure_hash+"&amp;status=3&amp;id="+parseInt(b)+"&amp;noimg="+parseInt(d)+"&amp;noauto="+parseInt(c);new Ajax.Request(c.replace(/&amp;/g,"&"),{method:"post",evalJSON:"force",onSuccess:function(e){if(Object.isUndefined(e.responseJSON))alert(ipb.lang.action_failed);else try{$("rstat-"+b).update(e.responseJSON.img);ipb.menus.closeAll(a)}catch(f){Debug.error(f)}}})},getTotalOffset:function(a,b,c){if($(a).getOffsetParent()!=document.body){Debug.write("Checking "+$(a).id);var d=$(a).positionedOffset();b+=d.top;c+=d.left;return ipb.global.getTotalOffset($(a).getOffsetParent(),b,c)}else{Debug.write("OK Finished!");return{top:b,left:c}}},checkPermission:function(a){if(a=="nopermission"){alert(ipb.lang.nopermission);return false}return true}};var _menu=window.IPBoard;_menu.prototype.menus={registered:$H(),init:function(){Debug.write("Initializing ips.menu.js");document.observe("dom:loaded",function(){ipb.menus.initEvents()})},initEvents:function(){Event.observe(document,"click",ipb.menus.docCloseAll);$$(".ipbmenu").each(function(a){id=a.identify();$(id+"_menucontent")&&new ipb.Menu(a,$(id+"_menucontent"))})},register:function(a,b){ipb.menus.registered.set(a,b)},docCloseAll:function(a){(!Event.isLeftClick(a)||a.ctrlKey==true||a.keyCode==91)&&!Prototype.Browser.IE||ipb.menus.closeAll(a)},closeAll:function(a){ipb.menus.registered.each(function(b){if(typeof a=="undefined"||a&&b.key!=a)try{b.value.doClose()}catch(c){}})}};_menu.prototype.Menu=Class.create({initialize:function(a,b,c,d){if($(a)&&$(b)){$(a).id||$(a).identify();this.id=$(a).id+"_menu";this.source=$(a);this.target=$(b);this.callbacks=d||{};this.options=Object.extend({eventType:"click",stopClose:false,offsetX:0,offsetY:0},c||{});$(a).observe("click",this.eventClick.bindAsEventListener(this));$(a).observe("mouseover",this.eventOver.bindAsEventListener(this));$(b).observe("click",this.targetClick.bindAsEventListener(this));$(this.target).setStyle("position: absolute;").hide().setStyle({zIndex:9999});$(this.target).descendants().each(function(e){$(e).setStyle({zIndex:1E4})});ipb.menus.register($(a).id,this);Object.isFunction(this.callbacks.afterInit)&&this.callbacks.afterInit(this)}},doOpen:function(){Debug.write("Menu open");var a={};_source=this.options.positionSource?this.options.positionSource:this.source;var b=$(_source).positionedOffset(),c=$(_source).cumulativeOffset(),d=$(_source).cumulativeScrollOffset(),e={top:c.top-d.top,left:c.left-d.left},f=$(_source).getDimensions(),g=document.viewport.getDimensions(),h=$(this.target).getDimensions();Debug.write("realSourcePos: "+e.top+" x "+e.left);Debug.write("sourcePos: "+b.top+" x "+b.left);Debug.write("scrollOffset: "+d.top+" x "+d.left);Debug.write("_sourcePos: "+c.top+" x "+c.left);Debug.write("sourceDim: "+f.width+" x "+f.height);Debug.write("menuDim: "+h.height);Debug.write("screenDim: "+g.height);Debug.write("manual ofset: "+this.options.offsetX+" x "+this.options.offsetY);if(Prototype.Browser.IE7){_a=_source.getOffsetParent();_b=this.target.getOffsetParent()}else{_a=_getOffsetParent(_source);_b=_getOffsetParent(this.target)}if(_a!=_b){if(e.left+h.width>g.width){diff=h.width-f.width;a.left=c.left-diff+this.options.offsetX}else a.left=Prototype.Browser.IE7?b.left+this.options.offsetX:c.left+this.options.offsetX;a.top=e.top+f.height+h.height>g.height&&c.top-h.height+this.options.offsetY>0?c.top-h.height+this.options.offsetY:c.top+f.height+this.options.offsetY}else{if(e.left+h.width>g.width){diff=h.width-f.width;a.left=b.left-diff+this.options.offsetX}else a.left=b.left+this.options.offsetX;a.top=e.top+f.height+h.height>g.height&&c.top-h.height+this.options.offsetY>0?b.top-h.height+this.options.offsetY:b.top+f.height+this.options.offsetY}Debug.write("Menu position: "+a.top+" x "+a.left);$(this.target).setStyle("top: "+(a.top-1)+"px; left: "+a.left+"px;");new Effect.Appear($(this.target),{duration:0.2,afterFinish:function(){Object.isFunction(this.callbacks.afterOpen)&&this.callbacks.afterOpen(this)}.bind(this)});Event.observe(document,"keypress",this.checkKeyPress.bindAsEventListener(this))},checkKeyPress:function(a){a.keyCode==Event.KEY_ESC&&this.doClose()},doClose:function(){new Effect.Fade($(this.target),{duration:0.3,afterFinish:function(){Object.isFunction(this.callbacks.afterClose)&&this.callbacks.afterClose(this)}.bind(this)})},targetClick:function(a){this.options.stopClose&&Event.stop(a)},eventClick:function(a){Event.stop(a);if($(this.target).visible()){Object.isFunction(this.callbacks.beforeClose)&&this.callbacks.beforeClose(this);this.doClose()}else{ipb.menus.closeAll($(this.source).id);Object.isFunction(this.callbacks.beforeOpen)&&this.callbacks.beforeOpen(this);this.doOpen()}},eventOver:function(){}});_popup=window.IPBoard;_popup.prototype.Popup=Class.create({initialize:function(a,b,c){this.id="";this.stem=this.inner=this.wrapper=null;this.options={};this.timer=[];this.ready=false;this._startup=null;this.hideAfterSetup=false;this.eventPairs={mouseover:"mouseout",mousedown:"mouseup"};this._tmpEvent=null;this.id=a;this.options=Object.extend({type:"pane",w:"500px",modal:false,modalOpacity:0.4,hideAtStart:true,delay:{show:0,hide:0},defer:false,hideClose:false,closeContents:ipb.templates.close_popup},b||{});this.callbacks=c||{};if(this.options.defer&&$(this.options.attach.target)){this._defer=this.init.bindAsEventListener(this);$(this.options.attach.target).observe(this.options.attach.event,this._defer);if(this.eventPairs[this.options.attach.event]){this._startup=function(){this.hideAfterSetup=true;this.hide()}.bindAsEventListener(this);$(this.options.attach.target).observe(this.eventPairs[this.options.attach.event],this._startup)}}else this.init()},init:function(){try{Event.stopObserving($(this.options.attach.target),this.options.attach.event,this._defer)}catch(a){}this.wrapper=(new Element("div",{id:this.id+"_popup"})).setStyle("z-index: 16000").hide().addClassName("popupWrapper");this.inner=(new Element("div",{id:this.id+"_inner"})).addClassName("popupInner");this.options.w&&this.inner.setStyle("width: "+this.options.w);this.options.h&&this.inner.setStyle("max-height: "+this.options.h);this.wrapper.insert(this.inner);if(this.options.hideClose!=true){this.closeLink=(new Element("div",{id:this.id+"_close"})).addClassName("popupClose").addClassName("clickable");this.closeLink.update(this.options.closeContents);this.closeLink.observe("click",this.hide.bindAsEventListener(this));this.wrapper.insert(this.closeLink)}$$("body")[0].insert(this.wrapper);this.options.classname&&this.wrapper.addClassName(this.options.classname);this.options.initial&&this.update(this.options.initial);if(this.options.ajaxURL){this.updateAjax();setTimeout(this.continueInit.bind(this),80)}else{this.ready=true;this.continueInit()}},continueInit:function(){if(this.ready){this.options.type=="balloon"?this.setUpBalloon():this.setUpPane();try{if(this.options.close){closeElem=$(this.wrapper).select(this.options.close)[0];Object.isElement(closeElem)&&$(closeElem).observe("click",this.hide.bindAsEventListener(this))}}catch(a){Debug.write(a)}Object.isFunction(this.callbacks.afterInit)&&this.callbacks.afterInit(this);!this.options.hideAtStart&&!this.hideAfterSetup&&this.show();this.hideAfterSetup&&this._startup&&Event.stopObserving($(this.options.attach.target),this.eventPairs[this.options.attach.event],this._startup)}else setTimeout(this.continueInit.bind(this),80)},updateAjax:function(){new Ajax.Request(this.options.ajaxURL,{method:"get",onSuccess:function(a){if(a.responseText!="error")if(a.responseText=="nopermission")alert(ipb.lang.no_permission);else{if(a.responseText.match("__session__expired__log__out__")){this.update("");alert("Your session has expired, please refresh the page and log back in");return false}Debug.write("AJAX done!");this.update(a.responseText);this.ready=true;Object.isFunction(this.callbacks.afterAjax)&&this.callbacks.afterAjax(this,a.responseText)}else Debug.write(a.responseText)}.bind(this)})},show:function(a){a&&Event.stop(a);this.timer.show&&clearTimeout(this.timer.show);if(this.options.delay.show!=0)this.timer.show=setTimeout(this._show.bind(this),this.options.delay.show);else this._show()},hide:function(a){a&&Event.stop(a);this.document_event&&Event.stopObserving(document,"click",this.document_event);this.timer.hide&&clearTimeout(this.timer.hide);if(this.options.delay.hide!=0)this.timer.hide=setTimeout(this._hide.bind(this),this.options.delay.hide);else this._hide()},_show:function(){if(this.options.modal==false){new Effect.Appear($(this.wrapper),{duration:0.3,afterFinish:function(){Object.isFunction(this.callbacks.afterShow)&&this.callbacks.afterShow(this)}.bind(this)});this.document_event=this.handleDocumentClick.bindAsEventListener(this);Event.observe(document,"click",this.document_event)}else new Effect.Appear($("document_modal"),{duration:0.3,to:this.options.modalOpacity,afterFinish:function(){new Effect.Appear($(this.wrapper),{duration:0.4,afterFinish:function(){Object.isFunction(this.callbacks.afterShow)&&this.callbacks.afterShow(this)}.bind(this)})}.bind(this)})},_hide:function(){if(this._tmpEvent!=null){Event.stopObserving($(this.wrapper),"mouseout",this._tmpEvent);this._tmpEvent=null}if(this.options.modal==false)new Effect.Fade($(this.wrapper),{duration:0.3,afterFinish:function(){Object.isFunction(this.callbacks.afterHide)&&this.callbacks.afterHide(this)}.bind(this)});else new Effect.Fade($(this.wrapper),{duration:0.3,afterFinish:function(){new Effect.Fade($("document_modal"),{duration:0.2,afterFinish:function(){Object.isFunction(this.callbacks.afterHide)&&this.callbacks.afterHide(this)}.bind(this)})}.bind(this)})},handleDocumentClick:function(a){Event.element(a).descendantOf(this.wrapper)||this._hide(a)},update:function(a){this.inner.update(a)},setUpBalloon:function(){if(this.options.attach){var a=this.options.attach;if(a.target&&$(a.target)){this.options.stem==true&&this.createStem();if(!a.position)a.position="auto";if(Object.isUndefined(a.offset))a.offset={top:0,left:0};if(Object.isUndefined(a.offset.top))a.offset.top=0;if(Object.isUndefined(a.offset.left))a.offset.left=0;if(a.position=="auto"){Debug.write("Popup: auto-positioning");var b=document.viewport.getDimensions(),c=document.viewport.getScrollOffsets(),d=$(a.target).viewportOffset(),e=$(this.wrapper).getDimensions(),f=[0,0];if(Element.getStyle($(a.target),"position")=="absolute")f=element.getOffsetParent().viewportOffset();d.left=d[0]-f[0];d.top=d[1]-f[1]+c.top;f="top";var g="left";if(d.top-e.height-a.offset.top<0+c.top)f="bottom";if(d.left+e.width-a.offset.left>b.width-c.left)g="right";finalPos=this.position(f+g,{target:$(a.target),content:$(this.wrapper),offset:a.offset});if(this.options.stem==true)finalPos=this.positionStem(f+g,finalPos)}else{Debug.write("Popup: manual positioning");finalPos=this.position(a.position,{target:$(a.target),content:$(this.wrapper),offset:a.offset});if(this.options.stem==true)finalPos=this.positionStem(a.position,finalPos)}if(!Object.isUndefined(a.event)){$(a.target).observe(a.event,this.show.bindAsEventListener(this));a.event!="click"&&!Object.isUndefined(this.eventPairs[a.event])&&$(a.target).observe(this.eventPairs[a.event],this.hide.bindAsEventListener(this));$(this.wrapper).observe("mouseover",this.wrapperEvent.bindAsEventListener(this))}}}Debug.write("Popup: Left: "+finalPos.left+"; Top: "+finalPos.top);$(this.wrapper).setStyle("top: "+finalPos.top+"px; left: "+finalPos.left+"px; position: absolute;")},wrapperEvent:function(){if(this.timer.hide){clearTimeout(this.timer.hide);this.timer.hide=null;if(this.options.attach.event&&this.options.attach.event=="mouseover")if(this._tmpEvent==null){this._tmpEvent=this.hide.bindAsEventListener(this);$(this.wrapper).observe("mouseout",this._tmpEvent)}}},positionStem:function(a,b){var c={height:16,width:31},d={},e={};switch(a.toLowerCase()){case"topleft":d={marginBottom:c.height+"px"};e={bottom:-c.height+"px",left:"5px"};b.left-=15;break;case"topright":d={marginBottom:c.height+"px"};e={bottom:-c.height+"px",right:"5px"};b.left+=15;break;case"bottomleft":d={marginTop:c.height+"px"};e={top:-c.height+"px",left:"5px"};b.left-=15;break;case"bottomright":d={marginTop:c.height+"px"};e={top:-c.height+"px",right:"5px"};b.left+=15;break}
$(this.wrapper).setStyle(d);$(this.stem).setStyle(e).setStyle("z-index: 6000").addClassName(a.toLowerCase());return b},position:function(a,b){finalPos={};var c=$(b.target).viewportOffset(),d=$(b.target).getDimensions(),e=$(b.content).getDimensions(),f=document.viewport.getScrollOffsets(),g=b.offset,h=[0,0];if(Element.getStyle($(b.target),"position")=="absolute")h=element.getOffsetParent().viewportOffset();c.left=c[0]-h[0];c.top=c[1]-h[1];Prototype.Browser.Opera||(c.top+=f.top);switch(a.toLowerCase()){case"topleft":finalPos.top=c.top-e.height-d.height-g.top;finalPos.left=c.left+g.left;break;case"topright":finalPos.top=c.top-e.height-d.height-g.top;finalPos.left=c.left-(e.width-d.width)-g.left;break;case"bottomleft":finalPos.top=c.top+d.height+g.top;finalPos.left=c.left+g.left;break;case"bottomright":finalPos.top=c.top+d.height+g.top;finalPos.left=c.left-(e.width-d.width)-g.left;break}
return finalPos},createStem:function(){this.stem=(new Element("div",{id:this.id+"_stem"})).update("&nbsp;").addClassName("stem");this.wrapper.insert({top:this.stem})},setUpPane:function(){$("document_modal")||this.createDocumentModal();this.positionPane()},positionPane:function(){var a=$(this.wrapper).getDimensions(),b=document.viewport.getDimensions();document.viewport.getScrollOffsets();a={left:(b.width-a.width)/2,top:(b.height-a.height)/2/2};if(a.top<10)a.top=10;$(this.wrapper).setStyle("top: "+a.top+"px; left: "+a.left+"px; position: fixed;")},createDocumentModal:function(){var a=$("ipboard_body").getDimensions(),b=document.viewport.getDimensions(),c=[];c.height=b.height<a.height?a.height:b.height;c.width=b.width<a.width?a.width:b.width;a=(new Element("div",{id:"document_modal"})).addClassName("modal").hide();a.setStyle("width: "+c.width+"px; height: "+c.height+"px; position: absolute; top: 0px; left: 0px; z-index: 15000;");$$("body")[0].insert(a)},getObj:function(){return $(this.wrapper)}});ipb=new IPBoard;ipb.global.init();ipb.menus.init();;var _quickpm=window.IPBoard;_quickpm.prototype.quickpm={popupObj:null,sendingToUser:0,init:function(){Debug.write("Initializing ips.quickpm.js");document.observe("dom:loaded",function(){ipb.quickpm.initEvents()})},initEvents:function(){ipb.delegate.register(".pm_button",ipb.quickpm.launchPMform)},launchPMform:function(a,b){Debug.write("Launching PM form");pmInfo=b.id.match(/pm_([0-9a-z]+)_([0-9]+)/);pmInfo[2]||Debug.error("Could not find member ID in string "+b.id);if($("pm_popup_popup"))if(pmInfo[2]==ipb.quickpm.sendingToUser){try{$("pm_error_"+ipb.quickpm.sendingToUser).hide()}catch(c){}ipb.quickpm.popupObj.show();Event.stop(a);return}else{ipb.quickpm.popupObj.getObj().remove();ipb.quickpm.sendingToUser=null;ipb.quickpm.sendingToUser=pmInfo[2]}else ipb.quickpm.sendingToUser=pmInfo[2];ipb.quickpm.popupObj=new ipb.Popup("pm_popup",{type:"pane",modal:true,hideAtStart:true,w:"600px"});var d=ipb.quickpm.popupObj;new Ajax.Request(ipb.vars.base_url+"&app=members&module=ajax&secure_key="+ipb.vars.secure_hash+"&section=messenger&do=showQuickForm&toMemberID="+pmInfo[2],{method:"post",evalJSON:"force",onSuccess:function(e){if(e.responseJSON.error){switch(e.responseJSON.error){case"noSuchToMember":alert(ipb.lang.member_no_exist);break;case"cannotUsePMSystem":;case"nopermission":alert(ipb.lang.no_permission);break;default:alert(e.responseJSON.error);break}
ipb.quickpm.sendingToUser=0}else{d.update(e.responseJSON.success);d.positionPane();d.show();$(d.getObj()).select(".input_submit")[0]&&$(d.getObj()).select(".input_submit")[0].observe("click",ipb.quickpm.doSend);$(d.getObj()).select(".cancel")[0]&&$(d.getObj()).select(".cancel")[0].observe("click",ipb.quickpm.cancelForm)}}});Event.stop(a)},cancelForm:function(a){$("pm_error_"+ipb.quickpm.sendingToUser).hide();ipb.quickpm.popupObj.hide();Event.stop(a)},doSend:function(a){Debug.write("Sending");if(ipb.quickpm.sendingToUser){Event.stop(a);if($F("pm_subject_"+ipb.quickpm.sendingToUser).blank())ipb.quickpm.showError(ipb.lang.quickpm_enter_subject);else if($F("pm_textarea_"+ipb.quickpm.sendingToUser).blank())ipb.quickpm.showError(ipb.lang.quickpm_msg_blank);else{var b=ipb.quickpm.popupObj;if($(b.getObj()).select(".input_submit")[0])$(b.getObj()).select(".input_submit")[0].disabled=true;new Ajax.Request(ipb.vars.base_url+"&app=members&module=ajax&secure_key="+ipb.vars.secure_hash+"&section=messenger&do=PMSend&toMemberID="+ipb.quickpm.sendingToUser,{method:"post",parameters:{Post:$F("pm_textarea_"+ipb.quickpm.sendingToUser).encodeParam(),std_used:1,toMemberID:ipb.quickpm.sendingToUser,subject:$F("pm_subject_"+ipb.quickpm.sendingToUser).encodeParam()},evalJSON:"force",onSuccess:function(c){Object.isUndefined(c.responseJSON)&&alert(ipb.lang.action_failed);if(c.responseJSON.error){b.hide();ipb.quickpm.sendingToUser=0;Event.stop(a);switch(c.responseJSON.error){case"cannotUsePMSystem":;case"nopermission":alert(ipb.lang.no_permission);break;default:alert(c.responseJSON.error);break}}else if(c.responseJSON.inlineError){ipb.quickpm.showError(c.responseJSON.inlineError);if($(b.getObj()).select(".input_submit")[0])$(b.getObj()).select(".input_submit")[0].disabled=false}else if(c.responseJSON.status){b.hide();ipb.quickpm.sendingToUser=0;Event.stop(a);alert(ipb.lang.message_sent)}else Debug.dir(c.responseJSON)}})}}},showError:function(a){if(ipb.quickpm.sendingToUser&&$("pm_error_"+ipb.quickpm.sendingToUser)){$("pm_error_"+ipb.quickpm.sendingToUser).select(".message")[0].update(a);$("pm_error_"+ipb.quickpm.sendingToUser).visible()||new Effect.BlindDown($("pm_error_"+ipb.quickpm.sendingToUser),{duration:0.3})}}};ipb.quickpm.init();;var _forums=window.IPBoard;_forums.prototype.forums={totalChecked:0,showMod:[],init:function(){Debug.write("Initializing ips.forums.js");document.observe("dom:loaded",function(){ipb.forums.initEvents()})},initEvents:function(){$$("ul.topic_moderation").each(function(a){ipb.forums.setUpModeration(a)});if($("show_filters")){$("show_filters").observe("click",ipb.forums.toggleFilters);$("filter_form").hide()}if($("tmod_all")){ipb.forums.preCheckTopics();$("tmod_all").observe("click",ipb.forums.checkAllTopics)}$$(".topic_mod").each(function(a){a.observe("click",ipb.forums.checkTopic)})},submitModForm:function(a){if($F("mod_tact")=="delete")confirm(ipb.lang.delete_confirm)||Event.stop(a);if($F("mod_tact")=="merge")confirm(ipb.lang.delete_confirm)||Event.stop(a)},setUpModeration:function(a){cell=a.up("td");a.hide();a.identify();$(cell).observe("mouseover",ipb.forums.showModeration);$(a).observe("mouseover",ipb.forums.moverModeration);$(a).observe("mouseout",ipb.forums.moutModeration);$(a).observe("mouseover",function(b){$(a).setStyle("cursor: pointer;");Event.stop(b)});$(a).observe("mouseout",function(b){Event.stop(b)})},showModeration:function(a){ipb.forums.hideAllModeration();elem=Event.findElement(a,"td");if(elem!=document){theUL=$(elem).down("ul.topic_moderation");theUL.show().setOpacity(0.3);ipb.forums.showMod.push(theUL);theUL.down(".t_rename")&&$(theUL.down(".t_rename")).observe("click",ipb.forums.topicRename);theUL.down(".t_delete")&&$(theUL.down(".t_delete")).observe("click",ipb.forums.topicDelete)}Event.stop(a)},moverModeration:function(a){elem=Event.element(a);elem.hasClassName("topic_moderation")||(elem=elem.up(".topic_moderation"));elem.setStyle("cursor: pointer").setOpacity(1)},moutModeration:function(a){elem=Event.element(a);elem.hasClassName("topic_moderation")||(elem=elem.up(".topic_moderation"));elem.setOpacity(0.3)},topicDelete:function(a){confirm(ipb.lang.delete_topic_confirm)||Event.stop(a)},topicRename:function(a){Event.stop(a);a=Event.findElement(a,"td").down("a.topic_title");if($(a).readAttribute("showingRename")!="true"){var b=ipb.templates.topic_rename.evaluate({inputid:a.id+"_input",submitid:a.id+"_submit",cancelid:a.id+"_cancel",value:a.innerHTML.unescapeHTML().replace(/'/g,"&#039;")});$(a).insert({before:b});$(a.id+"_input").observe("keydown",ipb.forums.saveTopicRename);$(a.id+"_submit").observe("click",ipb.forums.saveTopicRename);$(a.id+"_cancel").observe("click",ipb.forums.cancelTopicRename);$(a).hide().writeAttribute("showingRename","true")}},cancelTopicRename:function(a){var b=Event.element(a);b.hasClassName("_cancel")||(b=Event.findElement(a,".cancel"));try{var c=b.up("tr").id.replace("trow_","")}catch(d){Debug.write(d);return}b="tid-link-"+c;$(b+"_input")&&$(b+"_input").remove();$(b+"_submit")&&$(b+"_submit").remove();$(b+"_cancel").remove();$(b).show().writeAttribute("showingRename",false);Event.stop(a)},saveTopicRename:function(a){elem=Event.element(a);if(a.type=="keydown")if(a.which!=Event.KEY_RETURN)return;try{tid=elem.up("tr").id.replace("trow_","")}catch(b){Debug.write(b);return}new Ajax.Request(ipb.vars.base_url+"app=forums&module=ajax&section=topics&do=saveTopicTitle&md5check="+ipb.vars.secure_hash+"&tid="+tid,{method:"post",evalJSON:"force",parameters:{name:$F("tid-link-"+tid+"_input").replace(/&#039;/g,"'").encodeParam()},onSuccess:function(c){if(Object.isUndefined(c.responseJSON))alert(ipb.lang.action_failed);else if(c.responseJSON.error)alert(ipb.lang.error+": "+c.responseJSON.error);else{$("tid-link-"+tid).update(c.responseJSON.title);$("tid-link-"+tid).href=c.responseJSON.url}$("tid-link-"+tid+"_input").hide().remove();$("tid-link-"+tid+"_submit").hide().remove();$("tid-link-"+tid+"_cancel").hide().remove();$("tid-link-"+tid).show().writeAttribute("showingRename",false)}})},hideAllModeration:function(){ipb.forums.showMod.invoke("hide")},toggleFilters:function(){if($("filter_form")){Effect.toggle($("filter_form"),"blind",{duration:0.2});Effect.toggle($("show_filters"),"blind",{duration:0.2})}},preCheckTopics:function(){(topics=$F("selectedtids").split(","))&&topics.each(function(a){if(a!=""){if($("tmod_"+a))$("tmod_"+a).checked=true;ipb.forums.totalChecked++}});ipb.forums.updateTopicModButton()},checkAllTopics:function(a){Debug.write("checkAllTopics");check=Event.findElement(a,"input");toCheck=$F(check);ipb.forums.totalChecked=0;toRemove=[];selectedTopics=$F("selectedtids").split(",").compact();$$(".topic_mod").each(function(b){if(toCheck!=null){b.checked=true;selectedTopics.push(b.id.replace("tmod_",""));ipb.forums.totalChecked++}else{toRemove.push(b.id.replace("tmod_",""));b.checked=false}});selectedTopics=selectedTopics.uniq();if(toRemove.length>=1)for(i=0;i<toRemove.length;i++)selectedTopics=selectedTopics.without(parseInt(toRemove[i]));selectedTopics=selectedTopics.join(",");ipb.Cookie.set("modtids",selectedTopics,0);$("selectedtids").value=selectedTopics;ipb.forums.updateTopicModButton()},checkTopic:function(a){remove=[];check=Event.findElement(a,"input");selectedTopics=$F("selectedtids").split(",").compact();if(check.checked==true){selectedTopics.push(check.id.replace("tmod_",""));ipb.forums.totalChecked++}else{remove.push(check.id.replace("tmod_",""));ipb.forums.totalChecked--}selectedTopics=selectedTopics.uniq().without(remove).join(",");ipb.Cookie.set("modtids",selectedTopics,0);$("selectedtids").value=selectedTopics;ipb.forums.updateTopicModButton()},updateTopicModButton:function(){if($("mod_submit")){if(ipb.forums.totalChecked==0)$("mod_submit").disabled=true;else $("mod_submit").disabled=false;$("mod_submit").value=ipb.lang.with_selected.replace("{num}",ipb.forums.totalChecked)}},retrieveAttachments:function(a){url=ipb.vars.base_url+"&app=forums&module=ajax&secure_key="+ipb.vars.secure_hash+"&section=attachments&tid="+a;popup=new ipb.Popup("attachments",{type:"pane",modal:false,w:"500px",h:"600px",ajaxURL:url,hideAtStart:false,close:'a[rel="close"]'});return false},retrieveWhoPosted:function(a){if(parseInt(a)==0)return false;url=ipb.vars.base_url+"&app=forums&module=ajax&secure_key="+ipb.vars.secure_hash+"&section=stats&do=who&t="+a;popup=new ipb.Popup("whoPosted",{type:"pane",modal:false,w:"500px",h:"400px",ajaxURL:url,hideAtStart:false,close:'a[rel="close"]'});return false}};ipb.forums.init();;ipb.lang['fail_cblock']="Failed to save content block changes";ipb.lang['fail_config']="Failed to save configuration";ipb.lang['gallery_rotate_failed']="There was an error rotating the image";ipb.lang['go_to_category']="Go to this category";ipb.lang['max_notes_reached']="You cannot add any more notes to this image, because you have reached the maximum number allowed";ipb.lang['note_confirm_delete']="Are you sure you want to delete this note?";ipb.lang['note_save_empty']="Your note cannot be empty; click the Delete link for this note if you do not wish to keep it";ipb.lang['required_data_missing']="Some required data was missing";ipb.lang['note_no_permission_e']="You do not have permission to edit this note";ipb.lang['note_no_permission_a']="You do not have permission to add notes to this image";ipb.lang['note_no_permission_d']="You don't have permission to delete notes";ipb.lang['idm_invalid_file']="Invalid File";ipb.lang['idm_comment_empty']="Comment is empty";ipb.lang['idm_msg_email']="You did not enter an email address to send the email to";ipb.lang['idm_msg_text']="You did not enter any text to email to the user";ipb.lang['blog_cat_exists']="That category already exists";ipb.lang['blog_revert_header']="Are you sure you want to revert your header?";ipb.lang['blog_uncategorized']="Uncategorized";ipb.lang['js_rte_erroriespell']="ieSpell was not detected. Click OK to go to the download page.";ipb.lang['js_rte_errorloadingiespell']="Error loading ieSpell. Exception: ";ipb.lang['option_is_empty']="This tag's option cannot be left empty!";ipb.lang['prof_update_button']="Update";ipb.lang['prof_update_tooltip']="Update my status";ipb.lang['enter_x_names']="Enter up to [x] names";ipb.lang['enter_unlimited_names']="Enter names";ipb.lang['prof_comment_empty']="You must enter a comment";ipb.lang['prof_comment_perm']="You do not have permission to post comments on this profile";ipb.lang['prof_comment_mod']="Your comment was added, but requires approval by this member before it will be displayed";ipb.lang['save_folder']=">";ipb.lang['invalid_folder_name']="The folder name is invalid";ipb.lang['confirm_empty']="Are you sure you want to empty this folder?";ipb.lang['confirm_delete']="Are you sure you want to delete this folder? ALL messages in it will be deleted. This cannot be undone!";ipb.lang['cant_delete_folder']="You can't delete a protected folder!";ipb.lang['must_enter_name']="You must enter a name";ipb.lang['folder_protected']="Cannot perform that action on a protected folder";ipb.lang['delete_pm_confirm']="Are you sure you wish to permanently delete this conversation?";ipb.lang['folder_not_found']="Cannot find that folder";ipb.lang['upload_queue']="You have attempted to queue too many files. The number of files you can queue is: ";ipb.lang['delete_reply_confirm']="Are you sure you want to delete this reply?";ipb.lang['delete_pm_many_confirm']="Are you sure you wish to delete these conversations?";ipb.lang['reached_max_folders']="You have reached the maximum number of allowed folders";ipb.lang['message_sent']="Message Sent";ipb.lang['upload_skipped']="Upload Skipped";ipb.lang['pending']="Pending";ipb.lang['uploading']="Uploading...";ipb.lang['upload_done']="Done (uploaded [total])";ipb.lang['upload_progress']="Uploaded [done] of [total]";ipb.lang['silly_server']="The server returned an error during upload";ipb.lang['upload_limit_hit']="Upload limit exceeded";ipb.lang['invalid_mime_type']="You aren't permitted to upload this kind of file";ipb.lang['upload_too_big']="This file was too big to upload";ipb.lang['upload_failed']="This upload failed";ipb.lang['upload_no_file']="No file was selected for upload";ipb.lang['trouble_uploading']="Trouble uploading?";ipb.lang['switch_to_advanced']="Try our advanced uploader which supports multiple file uploading (modern browser required)";ipb.lang['click_to_attach']="Click To Attach Files";ipb.lang['att_select_files']="Select files";ipb.lang['post_empty']="Your post is empty";ipb.lang['editor_enter_list']="Enter list item (or hit Cancel to finish list)";ipb.lang['poll_stats']="You may add [q] more question(s), with [c] choices per question";ipb.lang['with_selected']="With Selected ({num})";ipb.lang['delete_topic_confirm']="Are you sure you want to delete this topic?";ipb.lang['approve']="Approve";ipb.lang['poll_not_enough_choices']="One or more of your questions doesn't contain enough choices. Each question must contain at least 2 choices!";ipb.lang['poll_no_more_choices']="You cannot add any more choices to this question";ipb.lang['poll_no_more_q']="You cannot add any more questions to this poll!";ipb.lang['click_to_show_opts']="Click to configure post options";ipb.lang['unapprove']="Unapprove";ipb.lang['is_spammer']="This account has been flagged as a spam account";ipb.lang['set_as_spammer']="Are you sure you want to flag this user as a spam account?";ipb.lang['copy_topic_link']="Copy the permalink below to store the direct address to this post in your clipboard";ipb.lang['vote_updated']="Vote updated!";ipb.lang['delete_post_confirm']="Are you sure you want to delete this post?";ipb.lang['vote_success']="Vote saved!";ipb.lang['pass_doesnt_match']="&#10007; The passwords you entered don't match";ipb.lang['pass_too_short']="&#10007; Your password is too short (min. 3 characters)";ipb.lang['pass_too_long']="&#10007; Your password is too long (max. 32 characters)";ipb.lang['invalid_email']="&#10007; This isn't a valid address";ipb.lang['email_banned']="&#10007; This email address has been banned";ipb.lang['email_in_use']="&#10007; This email address is in use";ipb.lang['too_long']="&#10007; The name you entered is too long";ipb.lang['invalid_chars']="&#10007; This field contains invalid characters";ipb.lang['not_available']="&#10007; This name is taken!";ipb.lang['email_doesnt_match']="&#10007; The addresses you entered don't match";ipb.lang['too_short']="&#10007; The name you entered is too short";ipb.lang['is_required']="&#10007; This field is required";ipb.lang['available']="&#10004; Available!";ipb.lang['rtg_topic_locked']="This topic is locked";ipb.lang['rtg_already']="You've already rated this entry";ipb.lang['rtg_awesome']="Awesome!";ipb.lang['rtg_good']="Good";ipb.lang['rtg_nbad']="Not Bad";ipb.lang['rtg_ok']="Okay";ipb.lang['rtg_poor']="Poor";ipb.lang['quickpm_enter_subject']="Please enter a subject";ipb.lang['quickpm_msg_blank']="Your message is blank";ipb.lang['cannot_readd_friend']="You cannot re-add this friend for five minutes after removing them";ipb.lang['friend_already']="This member is already on your friends list";ipb.lang['member_no_exist']="That member does not exist!";ipb.lang['delete_confirm']="Are you sure you want to continue?";ipb.lang['no_permission']="You do not have permission for this action";ipb.lang['error_security']="Security Error";ipb.lang['error']="Error";ipb.lang['loading']="Loading...";ipb.lang['usercp_photo_upload']="You have not selected a file to upload";ipb.lang['error_occured']="An error occurred";ipb.lang['action_failed']="Action failed";ipb.lang['post_empty_post']="Sorry, you can't submit a blank post. Please enter some text in the editor box";ipb.lang['post_empty_title']="You must enter a topic title!";ipb.lang['post_empty_username']="You must enter a username";