var Debug={write:function(text){if(jsDebug&&!Object.isUndefined(window.console)){console.log(text);}},dir:function(values){if(jsDebug&&!Object.isUndefined(window.console)){console.dir(values);}},error:function(text){if(jsDebug&&!Object.isUndefined(window.console)){console.error(text);}},warn:function(text){if(jsDebug&&!Object.isUndefined(window.console)){console.warn(text);}},info:function(text){if(jsDebug&&!Object.isUndefined(window.console)){console.info(text);}}} Event.observe(window,'load',function(e){Element.Methods.getOffsetParent=function(element){if(element.offsetParent&&element.offsetParent!=document.body)return $(element.offsetParent);if(element==document.body)return $(element);while((element=element.parentNode)&&element!=document.body) if(Element.getStyle(element,'position')!='static') return $(element);return $(document.body);}});function _getOffsetParent(element) {if(element.offsetParent&&element.offsetParent!=document.body)return $(element.offsetParent);if(element==document.body)return $(element);while((element=element.parentNode)&&element!=document.body) if(Element.getStyle(element,'position')!='static') return $(element);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']);} var effect=new Effect.Appear($('ajax_loading'),{duration:0.2});},onComplete:function(){if(!$('ajax_loading')){return;} var effect=new Effect.Fade($('ajax_loading'),{duration:0.2});}});ipb.delegate.initialize();ipb.initDone=true;}.bind(this));},positionCenter:function(elem,dir) {if(!$(elem)){return;} elem_s=$(elem).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(dir)=='undefined'||(dir!='h'&&dir!='v')) {$(elem).setStyle('top: '+center['top']+'px; left: '+center['left']+'px');} else if(dir=='h') {$(elem).setStyle('left: '+center['left']+'px');} else if(dir=='v') {$(elem).setStyle('top: '+center['top']+'px');} $(elem).setStyle('position: fixed');},showModal:function() {if(!$('ipb_modal')) {this.createModal();} this.modal.show();},hideModal:function() {if(!$('ipb_modal')){return;} 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(message) {if(!$('ipb_alert')) {this.createAlert();} this.showModal();$('ipb_alert_message').update(message);},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(content,editorid) {if(!editorid){Debug.dir(ipb.editors);var editor=$A(ipb.editors).first();Debug.write(editor);}else{var editor=ipb.editors[editorid];} if(Object.isUndefined(editor)) {Debug.error("Can't find any suitable editor");return;} editor.insert_text(content);editor.editor_check_focus();}});IPBoard.prototype.delegate={store:$A(),initialize:function() {document.observe('click',function(e){if(Event.isLeftClick(e)||Prototype.Browser.IE) {var elem=null;var handler=null;var target=ipb.delegate.store.find(function(item){elem=e.findElement(item['selector']);if(elem){handler=item;return true;}else{return false;}});if(!Object.isUndefined(target)) {if(handler) {Debug.write("Firing callback for selector "+handler['selector']);handler['callback'](e,elem,handler['params']);}}}})},register:function(selector,callback,params) {ipb.delegate.store.push({selector:selector,callback:callback,params:params});}} IPBoard.prototype.Cookie={store:[],initDone:false,set:function(name,value,sticky) {var expires='';var path='/';var domain='';if(!name) {return;} if(sticky) {if(sticky==1) {expires="; expires=Wed, 1 Jan 2020 00:00:00 GMT";} else if(sticky==-1) {expires="; expires=Thu, 01-Jan-1970 00:00:01 GMT";} else if(sticky.length>10) {expires="; expires="+sticky;}} if(ipb.vars['cookie_domain']) {domain="; domain="+ipb.vars['cookie_domain'];} if(ipb.vars['cookie_path']) {path=ipb.vars['cookie_path'];} document.cookie=ipb.vars['cookie_id']+name+"="+escape(value)+"; path="+path+expires+domain+';';ipb.Cookie.store[name]=value;Debug.write("Set cookie: "+ipb.vars['cookie_id']+name+"="+value+"; path="+path+expires+domain+';');},get:function(name) {if(ipb.Cookie.initDone!==true) {ipb.Cookie.init();} if(ipb.Cookie.store[name]) {return ipb.Cookie.store[name];} return'';},doDelete:function(name) {Debug.write("Deleting cookie "+name);ipb.Cookie.set(name,'',-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(";"));if(cookies) {cookies.each(function(cookie){cookie[0]=cookie[0].strip();if(ipb.vars['cookie_id']!='') {if(!cookie[0].startsWith(ipb.vars['cookie_id'])) {return;} else {cookie[0]=cookie[0].replace(ipb.vars['cookie_id'],'');}} if(skip[cookie[0]]) {return;} else {ipb.Cookie.store[cookie[0]]=unescape(cookie[1]||'');Debug.write("Loaded cookie: "+cookie[0]+" = "+cookie[1]);}});} ipb.Cookie.initDone=true;}};IPBoard.prototype.validate={isFilled:function(elem) {if(!$(elem)){return null;} return!$F(elem).blank();},isNumeric:function(elem) {if(!$(elem)){return null;} return $F(elem).match(/^[\d]+?$/);},isMatching:function(elem1,elem2) {if(!$(elem1)||!$(elem2)){return null;} return $F(elem1)==$F(elem2);},email:function(elem) {if(!$(elem)){return null;} if($F(elem).match(/^.+@.+\..{2,4}$/)){return true;}else{return false;}}};IPBoard.prototype.Autocomplete=Class.create({initialize:function(id,options) {this.id=$(id).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(""),item:new Template("
  • #{itemvalue}
  • ")}},arguments[1]||{});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(e) {if(![Event.KEY_TAB,Event.KEY_UP,Event.KEY_DOWN,Event.KEY_LEFT,Event.KEY_RIGHT,Event.KEY_RETURN].include(e.keyCode)){return;} if($(this.list).visible()) {switch(e.keyCode) {case Event.KEY_TAB:case Event.KEY_RETURN:this.selectCurrentItem(e);break;case Event.KEY_UP:case Event.KEY_LEFT:this.selectPreviousItem(e);break;case Event.KEY_DOWN:case Event.KEY_RIGHT:this.selectNextItem(e);break;} Event.stop(e);}},selectCurrentItem:function(e) {var current=$(this.list).down('.active');this.unselectAll();if(!Object.isUndefined(current)) {var itemid=$(current).id.replace(this.id+'_ac_item_','');if(!itemid){return;} var value=this.items[itemid].replace('&','&');if(this.options.multibox) {if($F(this.obj).indexOf(',')!==-1) {var pieces=$F(this.obj).split(',');pieces[pieces.length-1]='';$(this.obj).value=pieces.join(',')+' ';} else {$(this.obj).value='';} $(this.obj).value=$F(this.obj)+value+', ';} else {$(this.obj).value=value;var effect=new Effect.Fade($(this.list),{duration:0.3});this.observing=false;}} $(this.obj).focus();},selectThisItem:function(e) {this.unselectAll();var items=$(this.list).immediateDescendants();var elem=Event.element(e);while(!items.include(elem)) {elem=elem.up();} $(elem).addClassName('active');},selectPreviousItem:function(e) {var current=$(this.list).down('.active');this.unselectAll();if(Object.isUndefined(current)) {this.selectFirstItem();} else {var prev=$(current).previous();if(prev){$(prev).addClassName('active');} else {this.selectLastItem();}}},selectNextItem:function(e) {var current=$(this.list).down('.active');this.unselectAll();if(Object.isUndefined(current)){this.selectFirstItem();} else {var next=$(current).next();if(next){$(next).addClassName('active');} else {this.selectFirstItem();}}},selectFirstItem:function() {if(!$(this.list).visible()){return;} this.unselectAll();$(this.list).firstDescendant().addClassName('active');},selectLastItem:function() {if(!$(this.list).visible()){return;} this.unselectAll();var d=$(this.list).immediateDescendants();var l=d[d.length-1];if(l) {$(l).addClassName('active');}},unselectAll:function() {$(this.list).childElements().invoke('removeClassName','active');},timerEventBlur:function(e) {window.clearTimeout(this.timer);this.eventBlur.bind(this).delay(0.6,e);},timerEventFocus:function(e) {this.timer=this.eventFocus.bind(this).delay(0.4,e);},eventBlur:function(e) {this.objHasFocus=false;if($(this.list).visible()) {var effect=new Effect.Fade($(this.list),{duration:0.3});}},eventFocus:function(e) {if(!this.observing){return;} this.objHasFocus=true;this.timer=this.eventFocus.bind(this).delay(0.6,e);var curValue=this.getCurrentName();if(curValue==this.last_string){return;} if(curValue.length");},boot:function() {$A(document.getElementsByTagName("script")).findAll(function(s) {return(s.src&&s.src.match(/ipb\.js(\?.*)?$/))}).each(function(s){var path=s.src.replace(/ipb\.js(\?.*)?$/,'');var includes=s.src.match(/\?.*load=([a-z0-9_,]*)/);if(!Object.isUndefined(includes)&&includes!=null&&includes[1]) {includes[1].split(',').each(function(include) {if(include) {Loader.require(path+"ips."+include);}})}});}} var _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);if($('rss_feed')){ipb.global.buildRSSmenu();} if($('newSkin')||$('newLang')){ipb.global.setUpSkinLang();} if($('pm_notification')){new Effect.Parallel([new Effect.Appear($('pm_notification')),new Effect.BlindDown($('pm_notification'))],{duration:0.5});} if($('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(e,elem) {Event.stop(e);var sourceid=elem.identify();var user=$(elem).className.match('__id([0-9]+)');var fid=$(elem).className.match('__fid([0-9]+)');if(user==null||Object.isUndefined(user[1])){Debug.error("Error showing popup");return;} var popid='popup_'+user[1]+'_user';var _url=ipb.vars['base_url']+'&app=members&module=ajax&secure_key='+ipb.vars['secure_hash']+'§ion=card&mid='+user[1];Debug.write(fid);if(fid!=null&&!Object.isUndefined(fid[1])&&fid[1]) {_url+='&f='+fid[1];} Debug.write(_url);ipb.namePops[user]=new ipb.Popup(popid,{type:'balloon',ajaxURL:_url,stem:true,hideAtStart:false,attach:{target:elem,position:'auto'},w:'400px'});},displayWarnLogs:function(e,elem) {mid=elem.id.match('warn_link_([0-9a-z]+)_([0-9]+)')[2];if(Object.isUndefined(mid)){return;} if(parseInt(mid)==0){return false;} Event.stop(e);var _url=ipb.vars['base_url']+'&app=members&module=ajax&secure_key='+ipb.vars['secure_hash']+'§ion=warn&do=view&mid='+mid;warnLogs=new ipb.Popup('warnLogs',{type:'pane',modal:false,w:'500px',h:'500px',ajaxURL:_url,hideAtStart:false,close:'.cancel'});},toggleFriend:function(e,elem) {Event.stop(e);var id=$(elem).id.match('friend_(.*)_([0-9]+)');if(Object.isUndefined(id[2])){return;} var isFriend=($(elem).hasClassName('is_friend'))?1:0;var urlBit=(isFriend)?'remove':'add';var url=ipb.vars['base_url']+"app=members§ion=friends&module=ajax&do="+urlBit+"&member_id="+id[2]+"&md5check="+ipb.vars['secure_hash'];new Ajax.Request(url,{method:'get',onSuccess:function(t) {switch(t.responseText) {case'pp_friend_timeflood':alert(ipb.lang['cannot_readd_friend']);Event.stop(e);break;case"pp_friend_already":alert(ipb.lang['friend_already']);Event.stop(e);break;case"error":return true;break;default:var newIcon=(isFriend)?ipb.templates['m_add_friend'].evaluate({id:id[2]}):ipb.templates['m_rem_friend'].evaluate({id:id[2]});var friends=$$('.mini_friend_toggle').each(function(fr){if($(fr).id.endsWith('_'+id[2])) {if(isFriend){$(fr).removeClassName('is_friend').addClassName('is_not_friend').update(newIcon);}else{$(fr).removeClassName('is_not_friend').addClassName('is_friend').update(newIcon);}}});new Effect.Highlight($(elem),{startcolor:ipb.vars['highlight_color']});document.fire('ipb:friendRemoved',{friendID:id[2]});Event.stop(e);break;}}});},toggleFlagSpammer:function(memberId,flagStatus) {if(flagStatus==true) {if(confirm(ipb.lang['set_as_spammer'])) {var tid=0;var fid=0;var sid=0;if(typeof(ipb.topic)!='undefined') {tid=ipb.topic.topic_id;fid=ipb.topic.forum_id;sid=ipb.topic.start_id;} window.location=ipb.vars['base_url']+'app=forums&module=moderate§ion=moderate&do=setAsSpammer&member_id='+memberId+'&t='+tid+'&f='+fid+'&st='+sid+'&auth_key='+ipb.vars['secure_hash'];return false;} else {return false;}} else {alert(ipb.lang['is_spammer']);return false;}},toggleSpoiler:function(e,button) {Event.stop(e);var returnvalue=$(button).up().down('.bbc_spoiler_wrapper').down('.bbc_spoiler_content').toggle();if(returnvalue.visible()) {$(button).value='Hide';} else {$(button).value='Show';}},setUpSkinLang:function() {if($('newSkin')) {var form=$('newSkin').up('form');if(form) {if($('newSkinSubmit')){$('newSkinSubmit').hide();} $('newSkin').observe('change',function(e) {form.submit();return true;});}} if($('newLang')) {var form1=$('newLang').up('form');if(form1) {if($('newLangSubmit')){$('newLangSubmit').hide();} $('newLang').observe('change',function(e) {form1.submit();return true;});}}},buildRSSmenu:function() {$$('link').each(function(link) {if(link.readAttribute('type')=="application/rss+xml") {ipb.global.rssItems.push(ipb.templates['rss_item'].evaluate({url:link.readAttribute('href'),title:link.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(e) {if($('pm_notification')) {new Effect.Parallel([new Effect.Fade($('pm_notification')),new Effect.BlindUp($('pm_notification'))],{duration:0.5});} Event.stop(e);},initGD:function(elem) {if(!$(elem)){return;} $(elem).observe('click',ipb.global.generateNewImage);if($('gd-image-link')) {$('gd-image-link').observe('click',ipb.global.generateNewImage);}},generateImageExternally:function(elem) {if(!$(elem)){return;} $(elem).observe('click',ipb.global.generateNewImage);},generateNewImage:function(e) {img=Event.findElement(e,'img');Event.stop(e);if(img==document){return;} if(!img) {anchor=Event.findElement(e,'a');if(anchor) {img=anchor.up().down('img');}} oldSrc=img.src.toQueryParams();oldSrc=$H(oldSrc).toObject();if(!oldSrc['captcha_unique_id']){Debug.error("No captcha ID found");} new Ajax.Request(ipb.vars['base_url']+"app=core&module=global§ion=captcha&do=refresh&captcha_unique_id="+oldSrc['captcha_unique_id']+'&secure_key='+ipb.vars['secure_hash'],{method:'get',onSuccess:function(t) {oldSrc['captcha_unique_id']=t.responseText;img.writeAttribute({src:ipb.vars['base_url']+$H(oldSrc).toQueryString()});$F('regid').value=t.responseText;}});},registerReputation:function(id,url,rating) {if(!$(id)){return;} var rep_up=$(id).down('.rep_up');var rep_down=$(id).down('.rep_down');var sendUrl=ipb.vars['base_url']+'&app=core&module=ajax§ion=reputation&do=add_rating&app_rate='+url.app+'&type='+url.type+'&type_id='+url.typeid+'&secure_key='+ipb.vars['secure_hash'];if($(rep_up)){$(rep_up).observe('click',ipb.global.repRate.bindAsEventListener(this,1,id));} if($(rep_down)){$(rep_down).observe('click',ipb.global.repRate.bindAsEventListener(this,-1,id));} ipb.global.reputation[id]={obj:$(id),url:url,sendUrl:sendUrl,currentRating:rating||0};Debug.write("Registered reputation");},repRate:function(e) {Event.stop(e);var type=$A(arguments)[1];var id=$A(arguments)[2];var value=(type==1)?1:-1;if(!ipb.global.reputation[id]){return;}else{var rep=ipb.global.reputation[id];} new Ajax.Request(rep.sendUrl+'&rating='+value,{method:'get',onSuccess:function(t) {if(t.responseText=='done') {try{rep.obj.down('.rep_up').hide();rep.obj.down('.rep_down').hide();}catch(err){} var rep_display=rep.obj.down('.rep_show');if(rep_display) {['positive','negative','zero'].each(function(c){rep_display.removeClassName(c)});var newValue=rep.currentRating+value;if(newValue>0) {rep_display.addClassName('positive');} else if(newValue<0) {rep_display.addClassName('negative');} else {rep_display.addClassName('zero');} rep_display.update(parseInt(rep.currentRating+value));}} else {if(t.responseText=='nopermission') {alert(ipb.lang['no_permission']);} else {alert(ipb.lang['action_failed']+": "+t.responseText);}}}});},timer_liveSearch:function(e) {ipb.global.searchTimer['show']=setTimeout(ipb.global.liveSearch,400);},timer_hideLiveSearch:function(e) {ipb.global.searchTimer['hide']=setTimeout(ipb.global.hideLiveSearch,800);},hideLiveSearch:function(e) {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(e) {ipb.global.timer_liveSearch();if($F('main_search').lengthwidthCompare) {var percent=Math.ceil((widthCompare/dims.width)*100);if(percent<100) {elem.height=dims.height*(percent/100);elem.width=dims.width*(percent/100);} var temp=ipb.templates['resized_img'];var wrap=$(elem).wrap('div').addClassName('resized_img');$(elem).insert({before:temp.evaluate({percent:percent,width:dims.width,height:dims.height})});$(elem).addClassName('resized').setStyle('cursor: pointer;');$(elem).writeAttribute('origWidth',dims.width).writeAttribute('origHeight',dims.height).writeAttribute('shrunk',1);$(elem).writeAttribute('newWidth',elem.width).writeAttribute('newHeight',elem.height).writeAttribute('handled',1);$(elem).observe('click',ipb.global.enlargeImage);}},enlargeImage:function(e) {var elem=Event.element(e);if(!elem.hasClassName('resized')){elem=Event.findElement(e,'.resized');} var img=elem;if(!img){return;} if($(img).readAttribute('shrunk')==1) {$(img).setStyle('width: '+img.readAttribute('origWidth')+'px; height: '+img.readAttribute('origHeight')+'px; cursor: pointer');$(img).writeAttribute('shrunk',0);} else {$(img).setStyle('width: '+img.readAttribute('newWidth')+'px; height: '+img.readAttribute('newHeight')+'px; cursor: pointer');$(img).writeAttribute('shrunk',1);Debug.write("width: "+img.readAttribute('newWidth'));}},registerPageJump:function(source,options) {if(!source||!options){return;} ipb.global.pageJumps[source]=options;},buildPageJumps:function() {$$('.pagejump').each(function(elem){var classes=$(elem).className.match(/pj([0-9]+)/);if(!classes[1]){return;} $(elem).identify();var temp=ipb.templates['page_jump'].evaluate({id:'pj_'+$(elem).identify()});$$('body')[0].insert(temp);$('pj_'+$(elem).identify()+'_submit').observe('click',ipb.global.pageJump.bindAsEventListener(this,$(elem).identify()));$('pj_'+$(elem).identify()+'_input').observe('keypress',function(e){if(e.which==Event.KEY_RETURN) {ipb.global.pageJump(e,$(elem).identify());}});var wrap=$('pj_'+$(elem).identify()+'_wrap').addClassName('pj'+classes[1]).writeAttribute('jumpid',classes[1]);var callback={afterOpen:function(popup){try{$('pj_'+$(elem).identify()+'_input').activate();} catch(err){}}};ipb.global.pageJumpMenus[classes[1]]=new ipb.Menu($(elem),$(wrap),{stopClose:true},callback);});},pageJump:function(e,elem) {if(!$(elem)||!$('pj_'+$(elem).id+'_input')){return;} var value=$F('pj_'+$(elem).id+'_input');var jumpid=$('pj_'+$(elem).id+'_wrap').readAttribute('jumpid');if(value.blank()){try{ipb.global.pageJumpMenus[source].doClose();}catch(err){}} else {value=parseInt(value);} var options=ipb.global.pageJumps[jumpid];if(!options){Debug.dir(ipb.global.pageJumps);Debug.write(jumpid);return;} var pageNum=((value-1)*options.perPage);Debug.write(pageNum);if(pageNum<1){pageNum=0;} if(ipb.vars['seo_enabled']&&document.location.toString().match(ipb.vars['seo_params']['start'])&&document.location.toString().match(ipb.vars['seo_params']['end'])){if(options.url.match(ipb.vars['seo_params']['varBlock'])) {var url=options.url+ipb.vars['seo_params']['varSep']+options.stKey+ipb.vars['seo_params']['varSep']+pageNum;} else {var url=options.url+ipb.vars['seo_params']['varBlock']+options.stKey+ipb.vars['seo_params']['varSep']+pageNum;}}else{var url=options.url+'&'+options.stKey+'='+pageNum;} url=url.replace(/&/g,'&');url=url.replace(/(http:)?\/\//g,function($0,$1){return $1?$0:'/'});document.location=url;return;},openNewWindow:function(e,link,force) {var ourHost=document.location.host;var newHost=link.host;if(ourHost!=newHost||force) {window.open(link.href);Event.stop(e);return false;} else {return true;}},registerMarker:function(id,key,url) {if(!$(id)||key.blank()||url.blank()){return;} if(Object.isUndefined(ipb.global.boardMarkers)){return;} Debug.write("Marker INIT: "+id);$(id).observe('click',ipb.global.sendMarker.bindAsEventListener(this,id,key,url));},sendMarker:function(e,id,key,url) {Event.stop(e);if(!ipb.global.boardMarkers[key]){return;} new Ajax.Request(url+"&secure_key="+ipb.vars['secure_hash'],{method:'get',evalJSON:'force',onSuccess:function(t) {if(Object.isUndefined(t.responseJSON)) {Debug.error("Invalid server response");return false;} if(t.responseJSON['error']) {Debug.error(t.responseJSON['error']);return false;} $(id).replace(ipb.global.boardMarkers[key]);}});},registerCheckAll:function(id,classname) {if(!$(id)){return;} $(id).observe('click',ipb.global.checkAll.bindAsEventListener(this,classname));$$('.'+classname).each(function(elem){$(elem).observe('click',ipb.global.checkOne.bindAsEventListener(this,id));});},checkAll:function(e,classname) {Debug.write('checkAll');var elem=Event.element(e);var checkboxes=$$('.'+classname);if(elem.checked){checkboxes.each(function(check){check.checked=true;});}else{checkboxes.each(function(check){check.checked=false;});}},checkOne:function(e,id) {var elem=Event.element(e);if($(id).checked&&elem.checked==false) {$(id).checked=false;}},updateReportStatus:function(e,reportID,noauto,noimg) {Event.stop(e);var url=ipb.vars['base_url']+"app=core&module=ajax&section=reports&do=change_status&secure_key="+ipb.vars['secure_hash']+"&status=3&id="+parseInt(reportID)+"&noimg="+parseInt(noimg)+"&noauto="+parseInt(noauto);new Ajax.Request(url.replace(/&/g,'&'),{method:'post',evalJSON:'force',onSuccess:function(t) {if(Object.isUndefined(t.responseJSON)) {alert(ipb.lang['action_failed']);return;} try{$('rstat-'+reportID).update(t.responseJSON['img']);ipb.menus.closeAll(e);}catch(err){Debug.error(err);}}});},getTotalOffset:function(elem,top,left) {if($(elem).getOffsetParent()!=document.body) {Debug.write("Checking "+$(elem).id);var extra=$(elem).positionedOffset();top+=extra['top'];left+=extra['left'];return ipb.global.getTotalOffset($(elem).getOffsetParent(),top,left);} else {Debug.write("OK Finished!");return{top:top,left:left};}},checkPermission:function(text) {if(text=="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(menu){id=menu.identify();if($(id+"_menucontent")) {new ipb.Menu(menu,$(id+"_menucontent"));}});},register:function(source,obj) {ipb.menus.registered.set(source,obj);},docCloseAll:function(e) {if((!Event.isLeftClick(e)||e.ctrlKey==true||e.keyCode==91)&&!Prototype.Browser.IE) {} else {ipb.menus.closeAll(e);}},closeAll:function(except) {ipb.menus.registered.each(function(menu,force){if(typeof(except)=='undefined'||(except&&menu.key!=except)) {try{menu.value.doClose();}catch(err){}}});}} _menu.prototype.Menu=Class.create({initialize:function(source,target,options,callbacks){if(!$(source)||!$(target)){return;} if(!$(source).id){$(source).identify();} this.id=$(source).id+'_menu';this.source=$(source);this.target=$(target);this.callbacks=callbacks||{};this.options=Object.extend({eventType:'click',stopClose:false,offsetX:0,offsetY:0},arguments[2]||{});$(source).observe('click',this.eventClick.bindAsEventListener(this));$(source).observe('mouseover',this.eventOver.bindAsEventListener(this));$(target).observe('click',this.targetClick.bindAsEventListener(this));$(this.target).setStyle('position: absolute;').hide().setStyle({zIndex:9999});$(this.target).descendants().each(function(elem){$(elem).setStyle({zIndex:10000});});ipb.menus.register($(source).id,this);if(Object.isFunction(this.callbacks['afterInit'])) {this.callbacks['afterInit'](this);}},doOpen:function() {Debug.write("Menu open");var pos={};_source=(this.options.positionSource)?this.options.positionSource:this.source;var sourcePos=$(_source).positionedOffset();var _sourcePos=$(_source).cumulativeOffset();var _offset=$(_source).cumulativeScrollOffset();var realSourcePos={top:_sourcePos.top-_offset.top,left:_sourcePos.left-_offset.left};var sourceDim=$(_source).getDimensions();var screenDim=document.viewport.getDimensions();var menuDim=$(this.target).getDimensions();Debug.write("realSourcePos: "+realSourcePos.top+" x "+realSourcePos.left);Debug.write("sourcePos: "+sourcePos.top+" x "+sourcePos.left);Debug.write("scrollOffset: "+_offset.top+" x "+_offset.left);Debug.write("_sourcePos: "+_sourcePos.top+" x "+_sourcePos.left);Debug.write("sourceDim: "+sourceDim.width+" x "+sourceDim.height);Debug.write("menuDim: "+menuDim.height);Debug.write("screenDim: "+screenDim.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((realSourcePos.left+menuDim.width)>screenDim.width){diff=menuDim.width-sourceDim.width;pos.left=_sourcePos.left-diff+this.options.offsetX;}else{if(Prototype.Browser.IE7) {pos.left=(sourcePos.left)+this.options.offsetX;} else {pos.left=(_sourcePos.left)+this.options.offsetX;}} if((((realSourcePos.top+sourceDim.height)+menuDim.height)>screenDim.height)&&(_sourcePos.top-menuDim.height+this.options.offsetY)>0) {pos.top=_sourcePos.top-menuDim.height+this.options.offsetY;}else{pos.top=_sourcePos.top+sourceDim.height+this.options.offsetY;}} else {if((realSourcePos.left+menuDim.width)>screenDim.width){diff=menuDim.width-sourceDim.width;pos.left=sourcePos.left-diff+this.options.offsetX;}else{pos.left=sourcePos.left+this.options.offsetX;} if((((realSourcePos.top+sourceDim.height)+menuDim.height)>screenDim.height)&&(_sourcePos.top-menuDim.height+this.options.offsetY)>0) {pos.top=sourcePos.top-menuDim.height+this.options.offsetY;}else{pos.top=sourcePos.top+sourceDim.height+this.options.offsetY;}} Debug.write("Menu position: "+pos.top+" x "+pos.left);$(this.target).setStyle('top: '+(pos.top-1)+'px; left: '+pos.left+'px;');new Effect.Appear($(this.target),{duration:0.2,afterFinish:function(e){if(Object.isFunction(this.callbacks['afterOpen'])) {this.callbacks['afterOpen'](this);}}.bind(this)});Event.observe(document,'keypress',this.checkKeyPress.bindAsEventListener(this));},checkKeyPress:function(e) {if(e.keyCode==Event.KEY_ESC) {this.doClose();}},doClose:function() {new Effect.Fade($(this.target),{duration:0.3,afterFinish:function(e){if(Object.isFunction(this.callbacks['afterClose'])) {this.callbacks['afterClose'](this);}}.bind(this)});},targetClick:function(e) {if(this.options.stopClose) {Event.stop(e);}},eventClick:function(e) {Event.stop(e);if($(this.target).visible()){if(Object.isFunction(this.callbacks['beforeClose'])) {this.callbacks['beforeClose'](this);} this.doClose();}else{ipb.menus.closeAll($(this.source).id);if(Object.isFunction(this.callbacks['beforeOpen'])) {this.callbacks['beforeOpen'](this);} this.doOpen();}},eventOver:function() {}});_popup=window.IPBoard;_popup.prototype.Popup=Class.create({initialize:function(id,options,callbacks) {this.id='';this.wrapper=null;this.inner=null;this.stem=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=id;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']},arguments[1]||{});this.callbacks=callbacks||{};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(e){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(err){} 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');if(this.options.w){this.inner.setStyle('width: '+this.options.w);} if(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);if(this.options.classname){this.wrapper.addClassName(this.options.classname);} if(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) {setTimeout(this.continueInit.bind(this),80);return;} if(this.options.type=='balloon'){this.setUpBalloon();}else{this.setUpPane();} try{if(this.options.close){closeElem=$(this.wrapper).select(this.options.close)[0];if(Object.isElement(closeElem)) {$(closeElem).observe('click',this.hide.bindAsEventListener(this));}}}catch(err){Debug.write(err);} if(Object.isFunction(this.callbacks['afterInit'])) {this.callbacks['afterInit'](this);} if(!this.options.hideAtStart&&!this.hideAfterSetup) {this.show();} if(this.hideAfterSetup&&this._startup) {Event.stopObserving($(this.options.attach.target),this.eventPairs[this.options.attach.event],this._startup);}},updateAjax:function() {new Ajax.Request(this.options.ajaxURL,{method:'get',onSuccess:function(t) {if(t.responseText!='error') {if(t.responseText=='nopermission') {alert(ipb.lang['no_permission']);return;} if(t.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(t.responseText);this.ready=true;if(Object.isFunction(this.callbacks['afterAjax'])) {this.callbacks['afterAjax'](this,t.responseText);}} else {Debug.write(t.responseText);return;}}.bind(this)});},show:function(e) {if(e){Event.stop(e);} if(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(e) {if(e){Event.stop(e);} if(this.document_event){Event.stopObserving(document,'click',this.document_event);} if(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(){if(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(){if(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(){if(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(){if(Object.isFunction(this.callbacks['afterHide'])) {this.callbacks['afterHide'](this);}}.bind(this)})}.bind(this)});}},handleDocumentClick:function(e) {if(!Event.element(e).descendantOf(this.wrapper)) {this._hide(e);}},update:function(content) {this.inner.update(content);},setUpBalloon:function() {if(this.options.attach) {var attach=this.options.attach;if(attach.target&&$(attach.target)) {if(this.options.stem==true) {this.createStem();} if(!attach.position){attach.position='auto';} if(Object.isUndefined(attach.offset)){attach.offset={top:0,left:0}} if(Object.isUndefined(attach.offset.top)){attach.offset.top=0} if(Object.isUndefined(attach.offset.left)){attach.offset.left=0} if(attach.position=='auto') {Debug.write("Popup: auto-positioning");var screendims=document.viewport.getDimensions();var screenscroll=document.viewport.getScrollOffsets();var toff=$(attach.target).viewportOffset();var wrapSize=$(this.wrapper).getDimensions();var delta=[0,0];if(Element.getStyle($(attach.target),'position')=='absolute') {var parent=element.getOffsetParent();delta=parent.viewportOffset();} toff['left']=toff[0]-delta[0];toff['top']=toff[1]-delta[1]+screenscroll.top;var start='top';var end='left';if((toff.top-wrapSize.height-attach.offset.top)<(0+screenscroll.top)){var start='bottom';} if((toff.left+wrapSize.width-attach.offset.left)>(screendims.width-screenscroll.left)){var end='right';} finalPos=this.position(start+end,{target:$(attach.target),content:$(this.wrapper),offset:attach.offset});if(this.options.stem==true) {finalPos=this.positionStem(start+end,finalPos);}} else {Debug.write("Popup: manual positioning");finalPos=this.position(attach.position,{target:$(attach.target),content:$(this.wrapper),offset:attach.offset});if(this.options.stem==true) {finalPos=this.positionStem(attach.position,finalPos);}} if(!Object.isUndefined(attach.event)){$(attach.target).observe(attach.event,this.show.bindAsEventListener(this));if(attach.event!='click'&&!Object.isUndefined(this.eventPairs[attach.event])){$(attach.target).observe(this.eventPairs[attach.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(e) {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(pos,finalPos) {var stemSize={height:16,width:31};var wrapStyle={};var stemStyle={};switch(pos.toLowerCase()) {case'topleft':wrapStyle={marginBottom:stemSize.height+'px'};stemStyle={bottom:-(stemSize.height)+'px',left:'5px'};finalPos.left=finalPos.left-15;break;case'topright':wrapStyle={marginBottom:stemSize.height+'px'};stemStyle={bottom:-(stemSize.height)+'px',right:'5px'};finalPos.left=finalPos.left+15;break;case'bottomleft':wrapStyle={marginTop:stemSize.height+'px'};stemStyle={top:-(stemSize.height)+'px',left:'5px'};finalPos.left=finalPos.left-15;break;case'bottomright':wrapStyle={marginTop:stemSize.height+'px'};stemStyle={top:-(stemSize.height)+'px',right:'5px'};finalPos.left=finalPos.left+15;break;} $(this.wrapper).setStyle(wrapStyle);$(this.stem).setStyle(stemStyle).setStyle('z-index: 6000').addClassName(pos.toLowerCase());return finalPos;},position:function(pos,v) {finalPos={};var toff=$(v.target).viewportOffset();var tsize=$(v.target).getDimensions();var wrapSize=$(v.content).getDimensions();var screenscroll=document.viewport.getScrollOffsets();var offset=v.offset;var delta=[0,0];if(Element.getStyle($(v.target),'position')=='absolute') {var parent=element.getOffsetParent();delta=parent.viewportOffset();} toff['left']=toff[0]-delta[0];toff['top']=toff[1]-delta[1];if(!Prototype.Browser.Opera){toff['top']+=screenscroll.top;} switch(pos.toLowerCase()) {case'topleft':finalPos.top=(toff.top-wrapSize.height-tsize.height)-offset.top;finalPos.left=toff.left+offset.left;break;case'topright':finalPos.top=(toff.top-wrapSize.height-tsize.height)-offset.top;finalPos.left=(toff.left-(wrapSize.width-tsize.width))-offset.left;break;case'bottomleft':finalPos.top=(toff.top+tsize.height)+offset.top;finalPos.left=toff.left+offset.left;break;case'bottomright':finalPos.top=(toff.top+tsize.height)+offset.top;finalPos.left=(toff.left-(wrapSize.width-tsize.width))-offset.left;break;} return finalPos;},createStem:function() {this.stem=new Element('div',{id:this.id+'_stem'}).update(' ').addClassName('stem');this.wrapper.insert({top:this.stem});},setUpPane:function() {if(!$('document_modal')){this.createDocumentModal();} this.positionPane();},positionPane:function() {var elem_s=$(this.wrapper).getDimensions();var window_s=document.viewport.getDimensions();var window_offsets=document.viewport.getScrollOffsets();var center={left:((window_s['width']-elem_s['width'])/2),top:(((window_s['height']-elem_s['height'])/2)/2)} if(center.top<10){center.top=10;} $(this.wrapper).setStyle('top: '+center['top']+'px; left: '+center['left']+'px; position: fixed;');},createDocumentModal:function() {var pageSize=$('ipboard_body').getDimensions();var viewSize=document.viewport.getDimensions();var dims=[];if(viewSize['height']