HEX
Server: Apache/2.4.59 (Debian)
System: Linux skycube.cz 4.19.0-25-amd64 #1 SMP Debian 4.19.289-2 (2023-08-08) x86_64
User: ilya (534)
PHP: 7.3.31-1~deb10u7
Disabled: pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,
Upload Files
File: /var/www/ilya/data/www/irkboard.ru/cache/tmp/minify_c37f6ad740f675f7b072b77d2c498d1a
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':"Отмена",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);}});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("<ul id='#{id}'></ul>"),item:new Template("<li id='#{id}'>#{itemvalue}</li>")}},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('&amp;','&');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<this.options.min_chars){if($(this.list).visible())
{var effect=new Effect.Fade($(this.list),{duration:0.3,afterFinish:function(){$(this.list).update()}.bind(this)});}
return;}
this.last_string=curValue;json=this.cacheRead(curValue);if(json==false){var request=new Ajax.Request(this.options.url+escape(curValue),{method:'get',evalJSON:'force',onSuccess:function(t)
{if(Object.isUndefined(t.responseJSON))
{Debug.error("Invalid response returned from the server");return;}
if(t.responseJSON['error'])
{switch(t.responseJSON['error'])
{case'requestTooShort':Debug.warn("Server said request was too short, skipping...");break;default:Debug.error("Server returned an error: "+t.responseJSON['error']);break;}
return false;}
if(t.responseText!="[]")
{this.cacheWrite(curValue,t.responseJSON);this.updateAndShow(t.responseText.evalJSON());}}.bind(this)});}
else
{this.updateAndShow(json);}},updateAndShow:function(json)
{if(!json){return;}
this.updateList(json);if(!$(this.list).visible()&&this.objHasFocus)
{Debug.write("Showing");var effect=new Effect.Appear($(this.list),{duration:0.3,afterFinish:function(){this.selectFirstItem();}.bind(this)});}},cacheRead:function(value)
{if(this.options.global_cache!=false)
{if(!Object.isUndefined(this.options.global_cache[value])){Debug.write("Read from global cache");return this.options.global_cache[value];}}
else
{if(!Object.isUndefined(this.internal_cache[value])){Debug.write("Read from internal cache");return this.internal_cache[value];}}
return false;},cacheWrite:function(key,value)
{if(this.options.global_cache!==false){this.options.global_cache[key]=value;}else{this.internal_cache[key]=value;}
return true;},getCurrentName:function()
{if(this.options.multibox)
{if($F(this.obj).indexOf(',')===-1){return $F(this.obj).strip();}
else
{var pieces=$F(this.obj).split(',');var lastPiece=pieces[pieces.length-1];return lastPiece.strip();}}
else
{return $F(this.obj).strip();}},buildList:function()
{if($(this.id+'_ac'))
{return;}
var ul=this.options.templates.wrap.evaluate({id:this.id+'_ac'});$$('body')[0].insert({bottom:ul});var finalPos={};var sourcePos=$(this.id).viewportOffset();var sourceDim=$(this.id).getDimensions();var delta=[0,0];var parent=null;var screenScroll=document.viewport.getScrollOffsets();if(Element.getStyle($(this.id),'position')=='absolute')
{parent=element.getOffsetParent();delta=parent.viewportOffset();}
finalPos['left']=sourcePos[0]-delta[0];finalPos['top']=sourcePos[1]-delta[1]+screenScroll.top;finalPos['top']=finalPos['top']+sourceDim.height;$(this.id+'_ac').setStyle('position: absolute; top: '+finalPos['top']+'px; left: '+finalPos['left']+'px;').hide();this.list=$(this.id+'_ac');},updateList:function(json)
{if(!json||!$(this.list)){return;}
var newitems='';this.items=$A();json=$H(json);json.each(function(item)
{var li=this.options.templates.item.evaluate({id:this.id+'_ac_item_'+item.key,itemid:item.key,itemvalue:item.value['showas']||item.value['name'],img:item.value['img']||'',img_w:item.value['img_w']||'',img_h:item.value['img_h']||''});this.items[item.key]=item.value['name'];newitems=newitems+li;}.bind(this));$(this.list).update(newitems);$(this.list).immediateDescendants().each(function(elem){$(elem).observe('mouseover',this.selectThisItem.bindAsEventListener(this));$(elem).observe('click',this.selectCurrentItem.bindAsEventListener(this));$(elem).setStyle('cursor: pointer');}.bind(this));if($(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(text)
{if(!arguments.callee.sRE)
{var specials=['/','.','*','+','?','|','(',')','[',']','{','}','\\','$'];arguments.callee.sRE=new RegExp('(\\'+specials.join('|\\')+')');}
return text.replace(arguments.callee.sRE,'\\$1');}});String.prototype.encodeUrl=function()
{text=this;var regcheck=text.match(/[\x90-\xFF]/g);if(regcheck)
{for(var i=0;i<regcheck.length;i++)
{text=text.replace(regcheck[i],'%u00'+(regcheck[i].charCodeAt(0)&0xFF).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 regcheck=text.match(/[\x90-\xFF]/g);if(regcheck)
{for(var i=0;i<regcheck.length;i++)
{text=text.replace(regcheck[i],'%u00'+(regcheck[i].charCodeAt(0)&0xFF).toString(16).toUpperCase());}}
return escape(text).replace(/\+/g,"%2B");};Date.prototype.getDST=function()
{var beginning=new Date("January 1, 2008");var middle=new Date("July 1, 2008");var difference=middle.getTimezoneOffset()-beginning.getTimezoneOffset();var offset=this.getTimezoneOffset()-beginning.getTimezoneOffset();if(difference!=0)
{return(difference==offset)?1:0;}
else
{return 0;}};var Loader={require:function(name)
{document.write("<script type='text/javascript' src='"+name+".js'></script>");},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]+)');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']+'&section=card&mid='+user[1];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']+'&section=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&section=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&section=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&section=captcha&do=refresh&captcha_unique_id="+oldSrc['captcha_unique_id'],{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&section=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
{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').length<ipb.vars['live_search_limit']){return;}
if(!$('live_search_popup'))
{Debug.write("Creating popup");ipb.global.buildSearchPopup();}
else if(!$('live_search_popup').visible())
{new Effect.Appear($('live_search_popup'),{duration:0.4});}
if($F('main_search')==ipb.global.searchLastQuery){return;}
var refine_search='';if(ipb.vars['active_app'])
{refine_search+="&app_search="+ipb.vars['active_app'];}
if(ipb.vars['search_type']&&ipb.vars['search_type_id'])
{refine_search+='&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'])
{refine_search+='&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()+refine_search,{method:'get',onSuccess:function(t){if(!$('ajax_result')){return;}
$('ajax_result').update(t.responseText);}});ipb.global.searchLastQuery=$F('main_search');},buildSearchPopup:function(e)
{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 refine_search='';if(ipb.vars['active_app'])
{refine_search+="&app_search="+ipb.vars['active_app'];}
if(ipb.vars['search_type']&&ipb.vars['search_type_id'])
{refine_search+='&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'])
{refine_search+='&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']+refine_search,{method:'get',onSuccess:function(t){popup.update(t.responseText);}});new Effect.Appear($('live_search_popup'),{duration:0.3});},convertSize:function(size)
{var kb=1024;var mb=1024*1024;var gb=1024*1024*1024;if(size<kb){return size+" B";}
if(size<mb){return(size/kb).toFixed(2)+" KB";}
if(size<gb){return(size/mb).toFixed(2)+" MB";}
return(size/gb).toFixed(2)+" GB";},initImageResize:function()
{var dims=document.viewport.getDimensions();ipb.global.screen_w=dims.width;ipb.global.screen_h=dims.height;ipb.global.max_w=Math.ceil(ipb.global.screen_w*(ipb.vars['image_resize']/100));},findImgs:function(wrapper)
{if(!$(wrapper)){return;}
if(!ipb.vars['image_resize']){return;}
Event.observe(window,'load',function(){$(wrapper).select('img.bbc_img').each(function(elem){if(!ipb.global.screen_w)
{ipb.global.initImageResize();}
ipb.global.resizeImage(elem);});});},resizeImage:function(elem)
{if(elem.tagName!='IMG'){return;}
if(elem.readAttribute('handled')){return;}
if(!ipb.global.post_width)
{var post=$(elem).up('.post');if(!Object.isUndefined(post))
{var extra=parseInt(post.getStyle('padding-left'))+parseInt(post.getStyle('padding-right'));ipb.global.post_width=$(post).getWidth()-(extra*2);}}
var widthCompare=(ipb.global.post_width)?ipb.global.post_width:ipb.global.max_w;var dims=elem.getDimensions();if(dims.width>widthCompare)
{var percent=Math.ceil((widthCompare/dims.width)*100);if(percent<100)
{elem.height=dims.height*(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);}},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+'&amp;'+options.stKey+'='+pageNum;}
url=url.replace(/&amp;/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,{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&amp;module=ajax&amp;section=reports&amp;do=change_status&amp;status=3&amp;id="+parseInt(reportID)+"&amp;noimg="+parseInt(noimg)+"&amp;noauto="+parseInt(noauto);new Ajax.Request(url.replace(/&amp;/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};}}}
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){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){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')
{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('&nbsp;').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']<pageSize['height']){dims['height']=pageSize['height'];}else{dims['height']=viewSize['height'];}
if(viewSize['width']<pageSize['width']){dims['width']=pageSize['width'];}else{dims['width']=viewSize['width'];}
var modal=new Element('div',{'id':'document_modal'}).addClassName('modal').hide();modal.setStyle('width: '+dims['width']+'px; height: '+dims['height']+'px; position: absolute; top: 0px; left: 0px; z-index: 15000;');$$('body')[0].insert(modal);},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(e,target)
{Debug.write("Launching PM form");pmInfo=target.id.match(/pm_([0-9a-z]+)_([0-9]+)/);if(!pmInfo[2]){Debug.error('Could not find member ID in string '+target.id);}
if($('pm_popup_popup'))
{if(pmInfo[2]==ipb.quickpm.sendingToUser)
{try{$('pm_error_'+ipb.quickpm.sendingToUser).hide();}catch(err){}
ipb.quickpm.popupObj.show();Event.stop(e);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 popup=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(t)
{if(t.responseJSON['error'])
{switch(t.responseJSON['error'])
{case'noSuchToMember':alert(ipb.lang['member_no_exist']);break;case'cannotUsePMSystem':alert(ipb.lang['no_permission']);break;default:alert(t.responseJSON['error']);break;}
ipb.quickpm.sendingToUser=0;return;}
else
{popup.update(t.responseJSON['success']);popup.positionPane();popup.show();if($(popup.getObj()).select('.input_submit')[0]){$(popup.getObj()).select('.input_submit')[0].observe('click',ipb.quickpm.doSend)}
if($(popup.getObj()).select('.cancel')[0]){$(popup.getObj()).select('.cancel')[0].observe('click',ipb.quickpm.cancelForm)}}}});Event.stop(e);},cancelForm:function(e)
{$('pm_error_'+ipb.quickpm.sendingToUser).hide();ipb.quickpm.popupObj.hide();Event.stop(e);},doSend:function(e)
{Debug.write("Sending");if(!ipb.quickpm.sendingToUser){return;}
Event.stop(e);if($F('pm_subject_'+ipb.quickpm.sendingToUser).blank())
{ipb.quickpm.showError('Please enter a subject');return;}
if($F('pm_textarea_'+ipb.quickpm.sendingToUser).blank())
{ipb.quickpm.showError('Your message is blank');return;}
var popup=ipb.quickpm.popupObj;if($(popup.getObj()).select('.input_submit')[0]){$(popup.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(t)
{if(Object.isUndefined(t.responseJSON)){alert(ipb.lang['action_failed']);}
if(t.responseJSON['error'])
{popup.hide();ipb.quickpm.sendingToUser=0;Event.stop(e);switch(t.responseJSON['error'])
{case'cannotUsePMSystem':alert(ipb.lang['no_permission']);break;default:alert(t.responseJSON['error']);break;}}
else if(t.responseJSON['inlineError'])
{ipb.quickpm.showError(t.responseJSON['inlineError']);if($(popup.getObj()).select('.input_submit')[0]){$(popup.getObj()).select('.input_submit')[0].disabled=false};return;}
else if(t.responseJSON['status'])
{popup.hide();ipb.quickpm.sendingToUser=0;Event.stop(e);alert(ipb.lang['message_sent']);return;}
else
{Debug.dir(t.responseJSON);}}});},showError:function(msg)
{if(!ipb.quickpm.sendingToUser||!$('pm_error_'+ipb.quickpm.sendingToUser)){return;}
$('pm_error_'+ipb.quickpm.sendingToUser).select('.message')[0].update(msg);if(!$('pm_error_'+ipb.quickpm.sendingToUser).visible())
{new Effect.BlindDown($('pm_error_'+ipb.quickpm.sendingToUser),{duration:0.3});}
else
{new Effect.Highlight($('pm_error_'+ipb.quickpm.sendingToUser));}
return;}}
ipb.quickpm.init();;var _post=window.IPBoard;_post.prototype.post={cal_open:'',cal_close:'',init:function()
{Debug.write("Initializing ips.post.js");document.observe("dom:loaded",function(){ipb.post.initEvents();});},initEvents:function()
{if($('postingform')){$('postingform').observe('submit',ipb.post.postFormSubmit);}
if($('open_emoticons')){$('open_emoticons').observe('click',ipb.post.toggleEmoticons);}
if($('post_options_options')&&$('toggle_post_options')){$('toggle_post_options').update(ipb.lang['click_to_show_opts']);$('toggle_post_options').observe('click',ipb.post.showOptions);}
if($('mod_open_date')&&$('mod_open_date_icon')){$('mod_open_date_icon').observe('click',function(){new CalendarDateSelect($('mod_open_date'),{year_range:6,close_on_click:true});});}
if($('mod_close_date')&&$('mod_close_date_icon')){$('mod_close_date_icon').observe('click',function(){new CalendarDateSelect($('mod_close_date'),{year_range:6,close_on_click:true});});}
if($('post_preview')){ipb.global.findImgs($('post_preview'));}
if($('topic_summary')){ipb.global.findImgs($('topic_summary'));}
if($('review_topic')){$('review_topic').observe('click',ipb.global.openNewWindow.bindAsEventListener(this,$('review_topic'),1));}},postFormSubmit:function(e)
{return true;Event.stop(e);Debug.write("Submitting");if($('username')&&$F('username').blank()){alert(ipb.lang['post_empty_username']);error=true;}
if($('topic_title')){alert(ipb.lang['post_empty_title']);error=true;}
if($('ed-0_textarea')&&$F('ed-0_textarea').blank()){alert(ipb.lang['post_empty_post']);error=true;}
if(error){Event.stop(e);};},showOptions:function(e)
{new Effect.Fade($('toggle_post_options'),{duration:0.2});new Effect.BlindDown($('post_options_options'),{duration:0.3});},hideOptions:function()
{if($('post_options_options'))
{$('post_options_options').hide();}}}
ipb.post.init();;var _poll=window.IPBoard;_poll.prototype.poll={maxQuestions:0,maxChoices:0,questions:$H(),choices:$H(),_choices:$H(),votes:$H(),multi:$H(),effectDuration:0.3,init:function()
{Debug.write("Initializing ips.poll.js");document.observe("dom:loaded",function(){ipb.poll.initPoll();});},initPoll:function()
{if(ipb.poll.questions.size()>0)
{ipb.poll.choices.each(function(c)
{var match=c.key.match(/([0-9]+)_([0-9]+)/);if(Object.isUndefined(match[1])||Object.isUndefined(match[2])){return false;}
if(!Object.isHash(ipb.poll._choices.get(match[1]))){ipb.poll._choices.set(parseInt(match[1]),$H());}
var votes=ipb.poll.votes.get(match[0])||0;ipb.poll._choices.get(parseInt(match[1])).set(parseInt(match[2]),$H({value:c.value,votes:votes}));});ipb.poll.questions.each(function(q)
{var qid=q.key;var question=q.value;var html=ipb.templates['poll_question'].evaluate({qid:qid,value:question});$('poll_container').insert(html);if(ipb.poll.multi.get(qid)==1){$('multi_'+qid).checked=true;}
var choices=ipb.poll._choices.get(qid);choices.each(function(c)
{var item=ipb.templates['poll_choice'].evaluate({qid:qid,cid:c.key,choice:c.value.get('value'),votes:c.value.get('votes')});$('choices_for_'+qid).insert(item);$('remove_'+qid+'_'+c.key).observe('click',ipb.poll.removeChoice.bindAsEventListener(this,qid,c.key));if(!ipb.poll.isMod||ipb.poll.isPublicPoll){$('poll_'+qid+'_'+c.key+'_votes').remove();}
$('poll_'+qid+'_'+c.key+'_wrap').show();});if($('add_choice_'+qid))
{if(choices.size()>=ipb.poll.maxChoices){$('add_choice_'+qid).hide();}else{$('add_choice_'+qid).observe('click',ipb.poll.addChoice.bindAsEventListener(this,qid));}}
if($('remove_question_'+qid))
{$('remove_question_'+qid).observe('click',ipb.poll.removeQuestion.bindAsEventListener(this,qid));}
$('question_'+qid+'_wrap').show();});}
ipb.poll.updateStatus();if($('add_new_question')){$('add_new_question').observe('click',ipb.poll.addQuestion);}
if(ipb.poll.showOnLoad){$('add_poll').hide();$('poll_wrap').show();}else{$('poll_wrap').hide();$('add_poll').show();}
$('add_poll').observe('click',ipb.poll.toggleForm);$('close_poll').observe('click',ipb.poll.toggleForm);var form=$('poll_form').up('form');if(!Object.isUndefined(form))
{$(form).observe('submit',ipb.poll.submitCheckPoll);}},submitCheckPoll:function(e)
{var stop=false;if(ipb.poll._choices.size()>1)
{ipb.poll._choices.each(function(q){if(q.value.size()<2){stop=true;return;}});if(stop==true)
{alert(ipb.lang['poll_not_enough_choices']);Event.stop(e);return false;}}},updateStatus:function()
{if(!$('poll_stats')){return;}
if(!ipb.lang['poll_stats']){$('poll_stats').remove();}
var questions=parseInt(ipb.poll.maxQuestions)-ipb.poll._choices.size();var choices=parseInt(ipb.poll.maxChoices);var string=ipb.lang['poll_stats'].gsub(/\[\q\]/,questions).gsub(/\[c\]/,choices);$('poll_stats').update(string);},toggleForm:function(e)
{Event.stop(e);if($('poll_wrap').visible()){$('add_poll').show();}else{$('add_poll').hide();if(ipb.poll._choices.size()==0)
{ipb.poll.addQuestion(e,1);}}
Effect.toggle($('poll_wrap'),'blind',{duration:ipb.poll.effectDuration});},destroyPoll:function(e)
{},addChoice:function(e,qid,instant)
{Event.stop(e);if(!qid||!$('choices_for_'+qid)){return;}
var newid=ipb.poll.getNextID('c',qid);if(ipb.poll._choices.get(qid).size()>=ipb.poll.maxChoices){alert(ipb.lang['poll_no_more_choices']);return;}
var choice=ipb.templates['poll_choice'].evaluate({qid:qid,cid:newid,choice:'',votes:0});$('choices_for_'+qid).insert(choice);if(!ipb.poll.isMod||ipb.poll.isPublicPoll)
{$('poll_'+qid+'_'+newid+'_votes').remove();}
if(instant){$('poll_'+qid+'_'+newid+'_wrap').show();}else{new Effect.BlindDown($('poll_'+qid+'_'+newid+'_wrap'),{duration:ipb.poll.effectDuration});}
if($('remove_'+qid+'_'+newid)){$('remove_'+qid+'_'+newid).observe('click',ipb.poll.removeChoice.bindAsEventListener(this,qid,newid));}
ipb.poll._choices.get(qid).set(newid,$H({value:'',votes:0}));ipb.poll.updateStatus();},removeChoice:function(e,qid,cid)
{Event.stop(e);if(!qid||Object.isUndefined(cid)||!$('poll_'+qid+'_'+cid)){return;}
if(!$F('poll_'+qid+'_'+cid).blank())
{if(!confirm(ipb.lang['delete_confirm']))
{return;}}
new Effect.BlindUp($('poll_'+qid+'_'+cid+'_wrap'),{duration:ipb.poll.effectDuration,afterFinish:function(){$('poll_'+qid+'_'+cid+'_wrap').remove();}});ipb.poll._choices.get(qid).unset(cid);ipb.poll.updateStatus();},addQuestion:function(e,instant)
{Event.stop(e);if(ipb.poll._choices.size()>=ipb.poll.maxQuestions){alert(ipb.lang['poll_no_more_q'])
return;}
var newid=ipb.poll.getNextID('q');var item=ipb.templates['poll_question'].evaluate({qid:newid,value:''});$('poll_container').insert(item);if($('remove_question_'+newid)){$('remove_question_'+newid).observe('click',ipb.poll.removeQuestion.bindAsEventListener(this,newid));}
if(instant){$('question_'+newid+'_wrap').show();}else{new Effect.BlindDown($('question_'+newid+'_wrap'),{duration:ipb.poll.effectDuration});}
ipb.poll._choices.set(newid,$H());ipb.poll.addChoice(e,newid,1);if($('add_choice_'+newid))
{$('add_choice_'+newid).observe('click',ipb.poll.addChoice.bindAsEventListener(this,newid));}
ipb.poll.updateStatus();},removeQuestion:function(e,qid,force)
{Event.stop(e);if(!$('question_'+qid+'_wrap')){return;}
if(!force)
{if(!confirm(ipb.lang['delete_confirm']))
{return;}
new Effect.BlindUp($('question_'+qid+'_wrap'),{duration:ipb.poll.effectDuration,afterFinish:function(){$('question_'+qid+'_wrap').remove();}});}
else
{$('question_'+qid+'_wrap').remove();}
ipb.poll._choices.unset(qid);ipb.poll.updateStatus();},getNextID:function(type,qid)
{if(type=='q')
{if(Object.isUndefined(ipb.poll._choices)){var max=1;}
else
{var max=parseInt(ipb.poll._choices.max(function(q){return parseInt(q.key);}))+1;if(isNaN(max))
{var max=1;}}}
else
{if(Object.isUndefined(qid)){return false;}
if(Object.isUndefined(ipb.poll._choices.get(qid))){var max=0;}
else
{var max=parseInt(ipb.poll._choices.get(qid).max(function(c){return parseInt(c.key);}))+1;if(isNaN(max)){max=1;}}}
Debug.write(max);return max;}}
ipb.poll.init();;var _attach=window.IPBoard;_attach.prototype.attach={uploaders:[],template:'',init:function()
{Debug.write("Initializing ips.attach.js");document.observe("dom:loaded",function(){});},registerUploader:function(id,type,wrapper,options)
{if(Object.isUndefined(id)||id==null)
{Debug.error("ips.attach.js: Attachment manager already has that ID");return;}
if(ipb.attach.uploaders[id])
{Debug.error("ips.attach.js: This uploader has already been registered");}
if(type=='swf'){if(options.file_size_limit)
{options.file_size_limit=options.file_size_limit+" B";}
uploader=new ipb.attachSWF(id,options,wrapper,ipb.attach.template);}else{uploader=new ipb.attachTraditional(id,options,wrapper,ipb.attach.template);}
if(uploader)
{ipb.attach.uploaders[id]=uploader;if($('nojs_'+id+'_1')){$('nojs_'+id+'_1').hide();}
if($('nojs_'+id+'_2')){$('nojs_'+id+'_2').hide();}}},removeUpload:function(e)
{elem=Event.findElement(e,'li');elemid=elem.id.match(/^ali_(.+?)_([0-9]+)$/);if(!elemid[1]){return;}
obj=ipb.attach.uploaders[elemid[1]];new Ajax.Request(ipb.vars['base_url']+"app=core&module=attach&section=attach&do=attach_upload_remove&attach_rel_module="+
obj.options['attach_rel_module']+" &attach_rel_id="+obj.options['attach_rel_id']+" &attach_post_key="+
obj.options['attach_post_key']+"&forum_id="+obj.options['forum_id']+"&attach_id="+elem.readAttribute('attachid'),{method:'post',evalJSON:'force',onSuccess:function(t)
{if(Object.isUndefined(t.responseJSON)){alert(ipb.lang['action_failed']);return;}
if(t.responseJSON.msg=='attach_removed')
{ipb.attach.uploaders[elemid[1]].removeUpload(elem.readAttribute('attachid'),elemid[2],t.responseJSON);}
else
{alert(ipb.lang['action_failed']);return;}}});Event.stop(e);},startedUploading:function(handler)
{},finishedUploading:function(attachid,fileindex)
{if(!ipb.attach.uploaders[attachid]){return;}
if(!ipb.attach.uploaders[attachid].boxes[fileindex]){return;}
var row=ipb.attach.uploaders[attachid].boxes[fileindex];if($(row))
{var link=$(row).down('.add_to_post');if($(link))
{$(link).writeAttribute('fileindex',fileindex).writeAttribute('attachid',attachid);$(link).observe('click',ipb.attach.insertIntoPost);}}},getUploader:function(id)
{if(ipb.attach.uploaders[id])
{return ipb.attach.uploaders[id];}
else
{return false;}},_determineServerError:function(msg)
{if(msg.blank()){return ipb.lang['silly_server'];}
switch(msg)
{case'upload_no_file':return ipb.lang['upload_no_file'];break;case'invalid_mime_type':return ipb.lang['invalid_mime_type'];break;case'upload_too_big':return ipb.lang['upload_too_big'];break;case'upload_failed':return ipb.lang['upload_failed'];break;default:return ipb.lang['silly_server'];break;}},_jsonPass:function(id,json)
{ipb.attach.uploaders['attach_'+id].json=json;ipb.attach.uploaders['attach_'+id].isReady();Debug.write("ips.attach.js: Got json back from iframe id "+id);},_buildBoxes:function(currentItems)
{for(var i in currentItems)
{Debug.write("Templating item: "+currentItems[i][1]);id=i;index=currentItems[i][0];name=currentItems[i][1];size=currentItems[i][2];temp=uploader.template.gsub(/\[id\]/,uploader.id+'_'+index).gsub(/\[name\]/,name);$(uploader.wrapper).insert(temp);$('ali_'+uploader.id+'_'+index).select('.progress_bar')[0].hide();new Effect.Appear($('ali_'+uploader.id+'_'+index),{duration:0.3});$('ali_'+uploader.id+'_'+index).select('.info')[0].update(ipb.global.convertSize(size));$('ali_'+uploader.id+'_'+index).writeAttribute('attachid',index);$('ali_'+uploader.id+'_'+index).select('.delete')[0].observe('click',ipb.attach.removeUpload);['complete','in_progress','error'].each(function(cName){$('ali_'+uploader.id+'_'+index).removeClassName(cName);}.bind(uploader));$('ali_'+uploader.id+'_'+index).addClassName('complete');if(currentItems[i][3]==1)
{tmp=currentItems[i];var width=tmp[5];var height=tmp[6];if((tmp[5]&&tmp[5]>30))
{width=30;factor=(30/tmp[5]);height=tmp[6]*factor;}
if((tmp[6]&&tmp[6]>30))
{height=30;factor=(30/tmp[5]);width=tmp[5]*factor;}
thumb=new Element('img',{src:ipb.vars['upload_url']+'/'+tmp[4],'width':width,'height':height,'class':'thumb_img'}).hide();$('ali_'+uploader.id+'_'+index).select('.img_holder')[0].insert(thumb);new Effect.Appear($(thumb),{duration:0.4});}
uploader.boxes[index]='ali_'+uploader.id+'_'+index;ipb.attach.finishedUploading(uploader.id,index);}},insertIntoPost:function(e)
{Event.stop(e);var elem=Event.element(e);if(!elem.hasClassName('add_to_post'))
{elem=Event.findElement(e,'add_to_post');}
elem=elem.up('.attach_row');var fileindex=elem.readAttribute('attachid');var filename=elem.down('.attach_name').innerHTML;if(fileindex&&filename)
{ipb.editorInsert("[attachment="+fileindex+":"+filename+"]",'ed-0');}
else if(fileindex)
{ipb.editorInsert("[attachment="+fileindex+"]",'ed-0');}}}
ipb.attach.init();_attach.prototype.attachTraditional=Class.create({options:[],boxes:[],initialize:function(id,options,wrapper,template)
{this.id=id;this.wrapper=wrapper;this.template=template;this.options=options;this.iframe=new Element('iframe',{id:'iframeAttach_'+this.options['attach_rel_id'],name:'iframeAttach_'+this.options['attach_rel_id'],scrolling:'no',frameBorder:'no',border:'0',className:'',allowTransparency:true,src:this.options.upload_url,tabindex:'1'}).setStyle({width:'500px',height:'50px',overflow:'hidden',backgroundColor:'transparent'});$(this.wrapper).insert({after:this.iframe}).addClassName('traditional');$('add_files_'+this.id).observe('click',this.processUpload.bindAsEventListener(this));},_createFrame:function()
{},removeUpload:function(attachid,fileindex,fileinfo)
{new Effect.Fade($(this.boxes[fileindex]),{duration:0.4});this.boxes[fileindex]=null;if($('space_info_'+this.id)&&ipb.lang['used_space'])
{$('space_info_'+this.id).update(ipb.lang['used_space'].gsub(/\[used\]/,fileinfo['attach_stats']['space_used_human']).gsub(/\[total\]/,fileinfo['attach_stats']['total_space_allowed_human']));}
Debug.write("ips.attach.js: (ID "+this.id+", removeUpload) Attach ID: "+attachid+", File index: "+fileindex);},processUpload:function(e)
{$('attach_error_box').hide();var iFrameBox=window.frames['iframeAttach_'+this.options['attach_rel_id']].document.getElementById('iframeUploadBox');var iFrameForm=window.frames['iframeAttach_'+this.options['attach_rel_id']].document.getElementById('iframeUploadForm');var box=$('attach_'+this.options['attach_rel_id']);iFrameForm.action=ipb.vars['base_url']+"app=core&module=attach&section=attach&do=attachUploadiFrame&attach_rel_module="+
this.options['attach_rel_module']+"&attach_rel_id="+this.options['attach_rel_id']+"&attach_post_key="+
this.options['attach_post_key']+"&forum_id="+this.options['forum_id']+'&fetch_all=1';iFrameForm.submit();},isReady:function()
{if(this.json)
{if(this.json['is_error'])
{$('attach_error_box').update(ipb.lang['error']+" <strong>"+ipb.attach._determineServerError(this.json['msg'])+"</strong>");$('attach_error_box').show();}
if(this.json['current_items'])
{$(this.wrapper).update();ipb.attach._buildBoxes(this.json['current_items']);}
if(typeof(this.json['attach_rel_id'])!='undefined')
{if($('space_info_attach_'+this.json['attach_rel_id']))
{$('space_info_attach_'+this.json['attach_rel_id']).update(ipb.lang['used_space'].gsub(/\[used\]/,this.json['attach_stats']['space_used_human']).gsub(/\[total\]/,this.json['attach_stats']['total_space_allowed_human']));}}}
Debug.write("ips.attach.js: iFrame is ready");},_setJSON:function(json)
{Debug.write("ips.attach.js: Got JSON from the iFrame");}});_attach.prototype.attachSWF=Class.create({options:[],boxes:[],initialize:function(id,options,wrapper,template)
{this.id=id;this.wrapper=wrapper;this.template=template;this.options=Object.extend({upload_url:'',file_post_name:'FILE_UPLOAD',file_types:'*.*',file_types_description:ipb.lang['att_select_files'],file_size_limit:"10 MB",file_upload_limit:0,file_queue_limit:10,flash_color:ipb.vars['swf_bgcolor']||'#FFFFFF',custom_settings:{},post_params:{'s':ipb.vars['session_id']}},arguments[1]||{});if(this.options.upload_url.blank()){Debug.error("(ID "+id+") No upload URL");return false;}
try{$('add_files_'+this.id).value=ipb.lang['click_to_attach'];}catch(err){Debug.write(err);}
try{var swfu;var settings={upload_url:this.options.upload_url,flash_url:ipb.vars['swfupload_swf'],file_post_name:this.options.file_post_name,file_types:this.options.file_types,file_types_description:this.options.file_types_description,file_size_limit:this.options.file_size_limit,file_upload_limit:this.options.file_upload_limit,file_queue_limit:this.options.file_queue_limit,custom_settings:this.options.custom_settings,post_params:this.options.post_params,debug:ipb.vars['swfupload_debug'],button_placeholder_id:'buttonPlaceholder',button_width:$('add_files_'+this.id).getWidth(),button_height:30,button_window_mode:SWFUpload.WINDOW_MODE.TRANSPARENT,button_cursor:SWFUpload.CURSOR.HAND,upload_error_handler:this._uploadError.bind(this),upload_start_handler:this._uploadStart.bind(this),upload_success_handler:this._uploadSuccess.bind(this),upload_complete_handler:this._uploadComplete.bind(this),upload_progress_handler:this._uploadProgress.bind(this),file_dialog_complete_handler:this._fileDialogComplete.bind(this),file_queue_error_handler:this._fileQueueError.bind(this),queue_complete_handler:this._queueComplete.bind(this),file_queued_handler:this._fileQueued.bind(this)}
swfu=new SWFUpload(settings);this.obj=swfu;var getExisting=ipb.vars['base_url']+"app=core&module=attach&section=attach&do=attach_upload_show&attach_rel_module="+
options['attach_rel_module']+"&attach_rel_id="+options['attach_rel_id']+"&attach_post_key="+
options['attach_post_key']+"&forum_id="+options['forum_id']+"&attach_id="+id+'&fetch_all=1';new Ajax.Request(getExisting,{method:'get',evalJSON:'force',onSuccess:function(t)
{if(Object.isUndefined(t.responseJSON)){alert(ipb.lang['action_failed']);return;}
if(t.responseJSON.current_items)
{ipb.attach._buildBoxes(t.responseJSON.current_items);}}});this.obj.onmouseover=$('SWFUpload_0').focus();Debug.write("ips.attach.js: (ID "+this.id+") Created uploader");return true;}
catch(e)
{Debug.error("ips.attach.js: (ID "+this.id+") "+e);return false;}},removeUpload:function(attachid,fileindex,fileinfo)
{new Effect.Fade($(this.boxes[fileindex]),{duration:0.4});this.boxes[fileindex]=null;if($('space_info_'+this.id)&&ipb.lang['used_space'])
{$('space_info_'+this.id).update(ipb.lang['used_space'].gsub(/\[used\]/,fileinfo['attach_stats']['space_used_human']).gsub(/\[total\]/,fileinfo['attach_stats']['total_space_allowed_human']));}
Debug.write("ips.attach.js: (ID "+this.id+", removeUpload) Attach ID: "+attachid+", File index: "+fileindex);},_updateInfo:function(file,msg)
{$(this.boxes[file]).select('.info')[0].update(msg);},_setStatus:function(file,type)
{['complete','in_progress','error'].each(function(cName){$(this.boxes[file]).removeClassName(cName);}.bind(this));$(this.boxes[file]).addClassName(type);},_determineServerError:function(msg)
{if(msg.blank()){return ipb.lang['silly_server'];}
switch(msg)
{case'upload_no_file':return ipb.lang['upload_no_file'];break;case'invalid_mime_type':return ipb.lang['invalid_mime_type'];break;case'upload_too_big':return ipb.lang['upload_too_big'];break;case'upload_failed':return ipb.lang['upload_failed'];break;default:return ipb.lang['silly_server']+" "+msg;break;}},_buildBox:function(file)
{temp=this.template.gsub(/\[id\]/,this.id+'_'+file.index).gsub(/\[name\]/,file.name);this.boxes[file.index]='ali_'+this.id+'_'+file.index;$(this.wrapper).insert(temp);new Effect.Appear($(this.boxes[file.index]),{duration:0.3});this._updateInfo(file.index,ipb.global.convertSize(file.size)+"bytes");},_queueComplete:function(numFiles)
{Debug.write("ips.attach.js: (ID "+this.id+", "+numFiles+" finished uploading");},_fileQueued:function(file)
{this._buildBox(file);$(this.boxes[file.index]).addClassName('in_progress');this._updateInfo(file.index,ipb.lang['pending']);},_fileQueueError:function(file,errorCode,message)
{var msg;try{if(errorCode===SWFUpload.QUEUE_ERROR.QUEUE_LIMIT_EXCEEDED){alert(ipb.lang['upload_queue']+message);return false;}
switch(errorCode){case SWFUpload.QUEUE_ERROR.FILE_EXCEEDS_SIZE_LIMIT:msg=ipb.lang['upload_too_big'];break;case SWFUpload.QUEUE_ERROR.ZERO_BYTE_FILE:msg=ipb.lang['upload_no_file'];break;case SWFUpload.QUEUE_ERROR.INVALID_FILETYPE:msg=ipb.lang['invalid_mime_type'];break;default:if(file!==null){msg=ipb.lang['upload_failed']+" "+errorCode;}
break;}
this._setStatus(file.index,'error');this._updateInfo(file.index,ipb.lang['upload_skipped']+" ("+msg+")");Debug.write("ips.attach.js: (ID "+this.id+", fileQueueError) "+errorCode+": "+message);}
catch(err)
{Debug.write("ips.attach.js: (ID "+this.id+", fileQueueError) "+errorCode+": "+message);}},_uploadError:function(file,errorCode,message)
{var msg;switch(errorCode)
{case SWFUpload.UPLOAD_ERROR.HTTP_ERROR:msg=ipb.lang['error']+message;break;case SWFUpload.UPLOAD_ERROR.UPLOAD_FAILED:msg=message;break;case SWFUpload.UPLOAD_ERROR.IO_ERROR:msg=ipb.lang['error']+" IO";break;case SWFUpload.UPLOAD_ERROR.SECURITY_ERROR:msg=ipb.lang['error_security'];break;case SWFUpload.UPLOAD_ERROR.UPLOAD_LIMIT_EXCEEDED:msg=ipb.lang['upload_limit_hit'];break;case SWFUpload.UPLOAD_ERROR.FILE_VALIDATION_FAILED:msg=ipb.lang['invalid_mime_type'];break;default:msg=ipb.lang['error']+": "+errorCode;break;}
this._setStatus(file.index,'error');this._updateInfo(file.index,ipb.lang['upload_skipped']+" ("+msg+")");Debug.write("ips.attach.js: (ID "+this.id+", uploadError) "+errorCode+": "+message);return false;},_uploadStart:function(file)
{ipb.attach.startedUploading(this.id);Debug.write("ips.attach.js: (ID "+this.id+", uploadStart) ");},_uploadSuccess:function(file,serverData)
{if(!serverData.isJSON()){this._setStatus(file.index,'error');this._updateInfo(file.index,ipb.lang['silly_server']);}
returnedObj=serverData.evalJSON();if(Object.isUndefined(returnedObj)){this._setStatus(file.index,'error');this._updateInfo(file.index,ipb.lang['silly_server']);}
if(returnedObj.is_error==1)
{msg=this._determineServerError(returnedObj.msg);this._setStatus(file.index,'error');this._updateInfo(file.index,msg);return false;}
if($('space_info_'+this.id)&&ipb.lang['used_space'])
{$('space_info_'+this.id).update(ipb.lang['used_space'].gsub(/\[used\]/,returnedObj.attach_stats.space_used_human).gsub(/\[total\]/,returnedObj.attach_stats.total_space_allowed_human));}
if(returnedObj.current_items[returnedObj.insert_id][3]==1)
{tmp=returnedObj.current_items[returnedObj.insert_id];var width=tmp[5];var height=tmp[6];if((tmp[5]&&tmp[5]>30))
{width=30;factor=(30/tmp[5]);height=tmp[6]*factor;}
if((tmp[6]&&tmp[6]>30))
{height=30;factor=(30/tmp[5]);width=tmp[5]*factor;}
thumb=new Element('img',{src:ipb.vars['upload_url']+'/'+tmp[4],'width':width,'height':height,'class':'thumb_img'}).hide();$(this.boxes[file.index]).select('.img_holder')[0].insert(thumb);new Effect.Appear($(thumb),{duration:0.4});}
this._setStatus(file.index,'complete');this._updateInfo(file.index,ipb.lang['upload_done'].gsub(/\[total\]/,ipb.global.convertSize(file.size)));$(this.boxes[file.index]).writeAttribute('attachid',returnedObj.insert_id);$(this.boxes[file.index]).select('.delete')[0].observe('click',ipb.attach.removeUpload);ipb.attach.finishedUploading(this.id,file.index);Debug.write("ips.attach.js: (ID "+this.id+", uploadSuccess) "+serverData);},_uploadComplete:function(file)
{ipb.attach.finishedUploading(this.id);progress_bar=$(this.boxes[file.index]).select('.progress_bar span')[0];progress_bar.setStyle("width: 100%");new Effect.Fade($(this.boxes[file.index]).select('.progress_bar')[0],{duration:0.6});Debug.write("ips.attach.js: (ID "+this.id+", uploadComplete)");},_uploadProgress:function(file,bytesLoaded,bytesTotal)
{var percent=Math.ceil((bytesLoaded/bytesTotal)*100);progress_bar=$(this.boxes[file.index]).select('.progress_bar span')[0];progress_bar.setStyle("width: "+percent+"%").update(percent+"%");this._setStatus(file.index,'in_progress');this._updateInfo(file.index,ipb.lang['upload_progress'].gsub(/\[done\]/,ipb.global.convertSize(bytesLoaded)).gsub(/\[total\]/,ipb.global.convertSize(bytesTotal)))
Debug.write("ips.attach.js: (ID "+this.id+", uploadProgress)");},_fileDialogComplete:function(number,queued)
{Debug.write("ips.attach.js: (ID "+this.id+", fileDialogComplete) Number: "+number+", Queued: "+queued);this.obj.startUpload();}});var jimAuld=window.jimAuld||{};jimAuld.utils=jimAuld.utils||{};jimAuld.utils.flashsniffer={lastMajorRelease:10,installed:false,version:null,detect:function()
{var fp,fpd,fAX;if(navigator.plugins&&navigator.plugins.length)
{fp=navigator.plugins["Shockwave Flash"];if(fp)
{jimAuld.utils.flashsniffer.installed=true;if(fp.description)
{fpd=fp.description;jimAuld.utils.flashsniffer.version=fpd.substr(fpd.indexOf('.')-2,2).strip();Debug.write(jimAuld.utils.flashsniffer.version);}}
else
{jimAuld.utils.flashsniffer.installed=false;}
if(navigator.plugins["Shockwave Flash 2.0"]){jimAuld.utils.flashsniffer.installed=true;jimAuld.utils.flashsniffer.version=2;}}
else if(navigator.mimeTypes&&navigator.mimeTypes.length)
{fp=navigator.mimeTypes['application/x-shockwave-flash'];if(fp&&fp.enabledPlugin)
{jimAuld.utils.flashsniffer.installed=true;}
else
{jimAuld.utils.flashsniffer.installed=false;}}
else
{for(var i=jimAuld.utils.flashsniffer.lastMajorRelease;i>=2;i--)
{try
{fAX=new ActiveXObject("ShockwaveFlash.ShockwaveFlash."+i);jimAuld.utils.flashsniffer.installed=true;jimAuld.utils.flashsniffer.version=i;break;}
catch(e)
{}}
if(jimAuld.utils.flashsniffer.installed==null){try
{fAX=new ActiveXObject("ShockwaveFlash.ShockwaveFlash");jimAuld.utils.flashsniffer.installed=true;jimAuld.utils.flashsniffer.version=2;}
catch(e)
{}}
if(jimAuld.utils.flashsniffer.installed==null)
{jimAuld.utils.flashsniffer.installed=false;}
fAX=null;}},isVersion:function(exactVersion)
{return(jimAuld.utils.flashsniffer.version!=null&&jimAuld.utils.flashsniffer.version==exactVersion);},isLatestVersion:function()
{return(jimAuld.utils.flashsniffer.version!=null&&jimAuld.utils.flashsniffer.version==jimAuld.utils.flashsniffer.lastMajorRelease);},meetsMinVersion:function(minVersion)
{return(jimAuld.utils.flashsniffer.version!=null&&jimAuld.utils.flashsniffer.version>=minVersion);}};jimAuld.utils.flashsniffer.detect();;var _editor=window.IPBoard;var isRTL=(isRTL)?isRTL:false;_editor_rte=Class.create({_identifyType:function()
{Debug.write("(Editor "+this.id+") This is the RTE class");},togglesource_pre_show_html:function()
{},togglesource_post_show_html:function()
{},editor_write_contents:function(text,do_init)
{if(text.blank()&&Prototype.Browser.Gecko)
{text='<br />';}
if(this.editor_document&&this.editor_document.initialized)
{this.editor_document.body.innerHTML=text;}
else
{if(do_init)
{this.editor_document.designMode='on';}
this.editor_document=this.editor_window.document;this.editor_document.open('text/html','replace');this.editor_document.write(this.ips_frame_html.replace('{:content:}',text));this.editor_document.close();if(do_init)
{this.editor_document.body.contentEditable=true;this.editor_document.initialized=true;}}},removeformat:function(e)
{this.apply_formatting('unlink',false,false);this.apply_formatting('removeformat',false,false);var text=this.get_selection();if(text)
{text=this.strip_html(text);text=this.strip_empty_html(text);text=text.replace(/\r/g,"");text=text.replace(/\n/g,"<br />");text=text.replace(/<!--(.*?)-->/g,"");text=text.replace(/&lt;!--(.*?)--&gt;/g,"");this.insert_text(text);}},editor_get_contents:function()
{return this.editor_document.body.innerHTML;},editor_set_content:function(init_text)
{if($(this.id+'_iframe'))
{this.editor_box=$(this.id+'_iframe');}
else
{var iframe=new Element('iframe',{'id':this.id+'_iframe','tabindex':0});if(Prototype.Browser.IE&&window.location.protocol=='https:')
{iframe.writeAttribute('src',this.options.file_path+'/index.html');}
this.items['text_obj'].up().insert(iframe);this.editor_box=iframe;}
if(!Prototype.Browser.IE)
{this.editor_box.setStyle('border: 1px inset');}
var test_height=ipb.Cookie.get('ips_rte_height');if(Object.isNumber(test_height)&&test_height>50)
{this.items['text_obj'].setStyle({height:test_height+'px'});Debug.write("Set text_obj height to "+test_height);}
var tobj_dims=this.items['text_obj'].getDimensions();if(Object.isUndefined(tobj_dims)||tobj_dims['height']==0)
{tobj_dims['height']=250;}
this.editor_box.setStyle({width:'100%',height:tobj_dims.height+'px',className:this.items['text_obj'].className});this.items['text_obj'].hide();this.editor_window=this.editor_box.contentWindow;this.editor_document=this.editor_window.document;this.editor_write_contents((Object.isUndefined(init_text)||!init_text?this.items['text_obj'].value:init_text),true);this.editor_document.editor_id=this.editor_id;this.editor_window.editor_id=this.editor_id;this.editor_window.has_focus=false;},apply_formatting:function(cmd,dialog,argument)
{dialog=(Object.isUndefined(dialog)?false:dialog);argument=(Object.isUndefined(argument)?true:argument);if(Prototype.Browser.IE&&this.forum_fix_ie_newlines)
{if(cmd=='justifyleft'||cmd=='justifycenter'||cmd=='justifyright')
{var _a=cmd.replace("justify","");this.wrap_tags_lite("["+_a+"]","[/"+_a+"]");return true;}
else if(cmd=='outdent'||cmd=='indent'||cmd=='insertorderedlist'||cmd=='insertunorderedlist')
{this.editor_check_focus();var sel=this.editor_document.selection;var ts=this.editor_document.selection.createRange();var t=ts.htmlText.replace(/<p([^>]*)>(.*)<\/p>/i,'$2');if((sel.type=="Text"||sel.type=="None"))
{ts.pasteHTML(t+"<p />\n");}
else
{this.editor_document.body.innerHTML+="<p />";}}}
if(Prototype.Browser.IE&&this._ie_cache!=null)
{this.editor_check_focus();this._ie_cache.select();}
this.editor_document.execCommand(cmd,dialog,argument);return false;},get_selection:function()
{var rng=this._ie_cache?this._ie_cache:this.editor_document.selection.createRange();if(rng.htmlText)
{return rng.htmlText;}
else
{var rtn='';for(var i=0;i<rng.length;i++)
{rtn+=rng.item(i).outerHTML;}}
return rtn;},editor_set_functions:function()
{Event.observe(this.editor_document,'mouseup',this.events.editor_document_onmouseup.bindAsEventListener(this));Event.observe(this.editor_document,'keyup',this.events.editor_document_onkeyup.bindAsEventListener(this));Event.observe(this.editor_document,'keydown',this.events.editor_document_onkeydown.bindAsEventListener(this));Event.observe(this.editor_window,'blur',this.events.editor_window_onblur.bindAsEventListener(this));Event.observe(this.editor_window,'focus',this.events.editor_window_onfocus.bindAsEventListener(this));},set_context:function(cmd)
{if(this._showing_html)
{return false;}
this.button_update.each(function(item)
{var obj=$(this.id+'_cmd_'+item);if(obj!=null)
{try{var state=new String(this.editor_document.queryCommandState(item));if(obj.readAttribute('state')!=state)
{obj.writeAttribute('state',new String(state));this.set_button_context(obj,(obj.readAttribute('cmd')==cmd?'mouseover':'mouseout'));}}
catch(error)
{Debug.write("#1 "+error);}}}.bind(this));this.button_set_font_context();this.button_set_size_context();},button_set_font_context:function(font_state)
{changeto='';if(this._showing_html)
{return false;}
if(this.items['buttons']['fontname'])
{if(Object.isUndefined(font_state)){font_state=this.editor_document.queryCommandValue('fontname')||'';}
if(font_state.blank()){if(!Prototype.Browser.IE&&window.getComputedStyle)
{font_state=this.editor_document.body.style.fontFamily;}}else if(font_state==null){font_state='';}
if(font_state!=this.font_state)
{this.font_state=font_state;var fontword=font_state;var commapos=fontword.indexOf(",");if(commapos!=-1){fontword=fontword.substr(0,commapos);}
fontword=fontword.toLowerCase();changeto='';ipb.editor_values.get('primary_fonts').any(function(font){if(font.value.toLowerCase()==fontword){changeto=font.value;return true;}else{return false;}});changeto=(changeto=='')?this.fontoptions['_default']:changeto;this.items['buttons']['fontname'].update(changeto);}}},button_set_size_context:function(size_state)
{if(this.items['buttons']['fontsize'])
{if(Object.isUndefined(size_state)){size_state=this.editor_document.queryCommandValue('fontsize');}
if(size_state==null||size_state=='')
{if(Prototype.Browser.Gecko)
{size_state=this.convert_size(this.editor_document.body.style.fontSize,0);if(!size_state)
{size_state='2';}}}
changeto='';if(size_state!=this.size_state)
{this.size_state=size_state;ipb.editor_values.get('font_sizes').any(function(size){if(parseInt(size)==parseInt(this.size_state)){changeto=size;return true;}else{return false;}}.bind(this));changeto=(changeto=='')?this.sizeoptions['_default']:changeto;this.items['buttons']['fontsize'].update(changeto);}}},insert_text:function(text)
{this.editor_check_focus();if(typeof(this.editor_document.selection)!='undefined'&&this.editor_document.selection.type!='Text'&&this.editor_document.selection.type!='None')
{this.editor_document.selection.clear();}
if(this.get_selection()){var sel=this._ie_cache;}else{var sel=this.editor_document.selection.createRange();}
sel.pasteHTML(text);sel.select();this._ie_cache=null;},insert_emoticon:function(emo_id,emo_image,emo_code,event)
{try
{var _emo_url=ipb.vars['emoticon_url']+"/"+emo_image;var _emo_html=' <img src="'+_emo_url+'" class="bbc_emoticon" alt="'+this.unhtmlspecialchars(emo_code)+'" />';this.wrap_tags_lite(" "+_emo_html," ");}
catch(error)
{Debug.write("#2 "+error);}},togglesource:function(e,update)
{Event.stop(e);if(this._showing_html)
{if(update)
{this.editor_document.initialized=false;this.editor_write_contents($(this.id+'_htmlsource').value,true);}
$(this.editor_box).show();$(this.items['controls']).show();$(this.id+'_htmlsource').remove();$(this.id+'_ts_controls').remove();this._showing_html=false;this.editor_check_focus();}
else
{this._showing_html=true;this.togglesource_pre_show_html();var textarea=new Element('textarea',{id:this.id+'_htmlsource',tabindex:3});textarea.className=this.items['text_obj'].className;var dims=this.items['text_obj'].getDimensions();textarea.value=this.clean_html(this.editor_get_contents());var controlbar=ipb.editor_values.get('templates')['togglesource'].evaluate({id:this.id});$(this.items['text_obj']).insert({after:textarea});$(textarea).insert({after:controlbar});$(this.id+'_ts_update').writeAttribute('cmd','togglesource').writeAttribute('editor_id',this.id).observe('click',this.togglesource.bindAsEventListener(this,1));$(this.id+'_ts_cancel').writeAttribute('cmd','togglesource').writeAttribute('editor_id',this.id).observe('click',this.togglesource.bindAsEventListener(this,0));$(this.items['controls']).hide();$(this.editor_box).hide();this.editor_check_focus();}},update_for_form_submit:function()
{Debug.write("Updating for submit");this.items['text_obj'].value=this.editor_get_contents();return true;}});_editor_std=Class.create({_identifyType:function()
{Debug.write("(Editor "+this.id+") This is the STD class");},editor_set_content:function(init_text)
{var iframe=this.items['text_obj'].up().down('iframe',0);if(!Object.isUndefined(iframe))
{var iframeDims=iframe.getDimensions();$(this.items['text_obj']).setStyle({'width':iframeDims.width,'height':iframeDims.height}).show();$(iframe).setStyle('width: 0px; height: 0px; border: none;');}
this.editor_window=this.items['text_obj'];this.editor_document=this.items['text_obj'];this.editor_box=this.items['text_obj'];if(!Object.isUndefined(init_text))
{this.editor_write_contents(init_text);}
this.editor_document.editor_id=this.id;this.editor_window.editor_id=this.id;if(!Prototype.Browser.IE&&$(this.id+'_cmd_spellcheck')){$(this.id+'_cmd_spellcheck').hide();}
if($(this.id+'_cmd_removeformat')){$(this.id+'_cmd_removeformat').hide();}
if($(this.id+'_cmd_togglesource')){$(this.id+'_cmd_togglesource').hide();}
if($(this.id+'_cmd_justifyfull')){$(this.id+'_cmd_justifyfull').hide();}
if($(this.id+'_cmd_outdent')){$(this.id+'_cmd_outdent').hide();}
if($(this.id+'_cmd_switcheditor')){$(this.id+'_cmd_switcheditor').hide();}},editor_write_contents:function(text)
{this.items['text_obj'].value=text;},editor_get_contents:function()
{return this.editor_document.value;},apply_formatting:function(cmd,dialog,argument)
{switch(cmd)
{case'bold':case'italic':case'underline':{this.wrap_tags(cmd.substr(0,1),false);return;}
case'justifyleft':case'justifycenter':case'justifyright':{this.wrap_tags(cmd.substr(7),false);return;}
case'indent':{this.wrap_tags(cmd,false);return;}
case'createlink':{var sel=this.get_selection();if(sel)
{this.wrap_tags('url',argument);}
else
{this.wrap_tags('url',argument,argument);}
return;}
case'fontname':{this.wrap_tags('font',argument);return;}
case'fontsize':{this.wrap_tags('size',argument);return;}
case'forecolor':{this.wrap_tags('color',argument);return;}
case'backcolor':{this.wrap_tags('background',argument);return;}
case'insertimage':{this.wrap_tags('img',false,argument);return;}
case'strikethrough':{this.wrap_tags('s',false);return;}
case'superscript':{this.wrap_tags('sup',false);return;}
case'subscript':{this.wrap_tags('sub',false);return;}
case'removeformat':return;}},editor_set_functions:function()
{Event.observe(this.editor_document,'keypress',this.events.editor_document_onkeypress.bindAsEventListener(this));Event.observe(this.editor_window,'focus',this.events.editor_window_onfocus.bindAsEventListener(this));Event.observe(this.editor_window,'blur',this.events.editor_window_onblur.bindAsEventListener(this));},set_context:function()
{},get_selection:function()
{if(!Object.isUndefined(this.editor_document.selectionStart))
{return this.editor_document.value.substr(this.editor_document.selectionStart,this.editor_document.selectionEnd-this.editor_document.selectionStart);}
else if((document.selection&&document.selection.createRange)||this._ie_cache)
{return this._ie_cache?this._ie_cache.text:document.selection.createRange().text;}
else if(window.getSelection)
{return window.getSelection()+'';}
else
{return false;}},insert_text:function(text)
{this.editor_check_focus();if(!Object.isUndefined(this.editor_document.selectionStart))
{var open=this.editor_document.selectionStart+0;var st=this.editor_document.scrollTop;var end=open+text.length;if(Prototype.Browser.Opera)
{var opera_len=text.match(/\n/g);try
{end+=parseInt(opera_len.length);}
catch(e)
{Debug.write("#3 "+e);}}
this.editor_document.value=this.editor_document.value.substr(0,this.editor_document.selectionStart)+text+this.editor_document.value.substr(this.editor_document.selectionEnd);if(!text.match(new RegExp("\\"+this.open_brace+"(\\S+?)"+"\\"+this.close_brace+"\\"+this.open_brace+"/(\\S+?)"+"\\"+this.close_brace)))
{this.editor_document.selectionStart=open;this.editor_document.selectionEnd=end;this.editor_document.scrollTop=st;}
else
{if(Prototype.Browser.Gecko){this.editor_document.scrollTop=st;}}
this.editor_document.setSelectionRange(end,end);Debug.write("Insert 1");}
else if((document.selection&&document.selection.createRange)||this._ie_cache)
{var sel=this._ie_cache?this._ie_cache:document.selection.createRange();sel.text=text.replace(/\r?\n/g,'\r\n');sel.select();Debug.write("Insert 2");}
else
{this.editor_document.value+=text;Debug.write("Insert 3");}
this._ie_cache=null;},insert_emoticon:function(emo_id,emo_image,emo_code,event)
{this.editor_check_focus();emo_code=this.unhtmlspecialchars(emo_code);this.wrap_tags_lite(" "+emo_code," ");},insertorderedlist:function(e)
{this.insertlist('ol');},insertunorderedlist:function(e)
{this.insertlist('ul');},insertlist:function(list_type)
{var open_tag;var close_tag;var item_open_tag='<li>';var item_close_tag='</li>';var regex='';var all_add='';if(this.use_bbcode)
{regex=new RegExp('([\r\n]+|^[\r\n]*)(?!\\[\\*\\]|\\[\\/?list)(?=[^\r\n])','gi');open_tag=list_type=='ol'?'[list=1]\n':'[list]\n';close_tag='[/list]';item_open_tag='[*]';item_close_tag='';}
else
{regex=new RegExp('([\r\n]+|^[\r\n]*)(?!<li>|<\\/?ol|ul)(?=[^\r\n])','gi');open_tag=list_type=='ol'?'<ol>\n':'<ul>\n';close_tag=list_type=='ol'?'</ol>\n':'</ul>\n';}
if(text=this.get_selection())
{text=open_tag+text.replace(regex,"\n"+item_open_tag+'$1'+item_close_tag)+'\n'+close_tag;if(this.use_bbcode)
{text=text.replace(new RegExp('\\[\\*\\][\r\n]+','gi'),item_open_tag);}
this.insert_text(text);}
else
{if(Prototype.Browser.Gecko)
{this.insert_text(open_tag);while(val=prompt(ipb.lang['editor_enter_list'],''))
{this.insert_text(item_open_tag+val+item_close_tag+'\n');}
this.insert_text(close_tag);}
else
{var to_insert=open_tag;while(val=prompt(ipb.lang['editor_enter_list'],''))
{to_insert+=item_open_tag+val+item_close_tag+'\n';}
to_insert+=close_tag;this.insert_text(to_insert);}}},removeformat:function()
{var text=this.get_selection();if(text)
{text=this.strip_html(text);this.insert_text(text);}},unlink:function()
{var text=this.get_selection();var link_regex='';var link_text='';if(text!==false)
{if(text.match(link_regex))
{text=(this.use_bbcode)?text.replace(/\[url=([^\]]+?)\]([^\[]+?)\[\/url\]/ig,"$2"):text.replace(/<a href=['\"]([^\"']+?)['\"]([^>]+?)?>(.+?)<\/a>/ig,"$3");}
this.insert_text(text);}},undo:function()
{this.history_record_state(this.editor_get_contents());this.history_time_shift(-1);if((text=this.history_fetch_recording())!==false)
{this.editor_document.value=text;}},redo:function()
{this.history_time_shift(1);if((text=this.history_fetch_recording())!==false)
{this.editor_document.value=text;}},update_for_form_submit:function(subjecttext,minchars)
{return true;}});if(USE_RTE&&!Prototype.Browser.WebKit){Debug.write("Extending with RTE")
_type=_editor_rte;}else{Debug.write("Extending with STD");_type=_editor_std;}
_editor.prototype.editor=Class.create(_type,{initialize:function(editor_id,mode,initial_content,options)
{this.id=editor_id;this.is_rte=mode;this.use_bbcode=!mode;this.events=null;this.options=[];this.items=[];this.settings={};this.open_brace='';this.close_brace='';this.allow_advanced=0;this.initialized=0;this.ips_frame_html='';this.forum_fix_ie_newlines=1;this.has_focus=null;this.history_recordings=[];this.history_pointer=-1;this._ie_cache=null;this._showing_html=false;this._loading=false;this.original=$H();this.hidden_objects=[];this.fontoptions=$A();this.sizeoptions=$A();this.font_state=null;this.size_state=null;this.palettes={};this.defaults={};this.key_handlers=[];this.options=Object.extend({file_path:'',forum_fix_ie_newlines:1,char_set:'UTF-8',ignore_controls:[],button_update:[]},arguments[3]||{});this.button_update=$A(["bold","italic","underline","justifyleft","justifycenter","justifyright","insertorderedlist","insertunorderedlist","superscript","subscript","strikethrough"].concat(this.options.button_update));this.values=ipb.editor_values;this.items['text_obj']=$(this.id+"_textarea");this.items['buttons']=$A();this.items['controls']=$(this.id+'_controls');this.open_brace=this.use_bbcode?'[':'<';this.close_brace=this.use_bbcode?']':'>';this.allow_advanced=this.use_bbcode?0:1;this.doc_body=$$('body')[0];this.events=new _editor_events();this._identifyType();if(this.values.get('bbcodes')&&$(this.id+'_cmd_otherstyles'))
{this.buildCustomStyles();}
if(this.items['text_obj'].up('form')){this.items['text_obj'].up('form').observe('submit',function(e){this.update_for_form_submit();}.bindAsEventListener(this));}
this.init(initial_content);Debug.write("All editor initialization complete");},init:function(initial_text)
{try{if(this.initialized){return;}
if($(this.id+'_wysiwyg_used')){$(this.id+'_wysiwyg_used').value=parseInt(this.is_rte);}
this.ips_frame_html=this.get_frame_html();this.editor_set_content(initial_text);this.editor_set_functions();this.editor_set_controls();this.initialized=true;}
catch(err){Debug.error("#4 "+err);}},buildCustomStyles:function()
{var buttons=false;var other_styles=false;var toolbar=ipb.editor_values.get('templates')['toolbar'].evaluate({'id':this.id,'toolbarid':'3'});$(this.id+'_toolbar_2').insert({after:toolbar});this.init_editor_menu($(this.id+'_cmd_otherstyles'));this.values.get('bbcodes').each(function(bbcode){if(!bbcode.value['image'].blank())
{$(this.id+'_toolbar_3').insert(ipb.editor_values.get('templates')['button'].evaluate({'id':this.id,'cmd':bbcode.key,'title':bbcode.value['title'],'img':bbcode.value['image']}));buttons=true;}
else
{$(this.id+'_popup_otherstyles_menu').insert(ipb.editor_values.get('templates')['menu_item'].evaluate({'id':this.id,'cmd':bbcode.key,'title':bbcode.value['title']}));other_styles=true;}
if(!(bbcode.value['useoption']=='0'&&bbcode.value['single_tag']=='1'))
{var item_wrap=new Element('div',{id:this.id+'_palette_otherstyles_'+bbcode.key});item_wrap.addClassName('ipb_palette').addClassName('extended');item_wrap.writeAttribute("styleid",bbcode.key);var _content=this.values.get('templates')['generic'].evaluate({id:this.id+'_'+bbcode.key,title:bbcode.value['title'],example:bbcode.value['example'],option_text:bbcode.value['menu_option_text']||'',value_text:bbcode.value['menu_content_text']||''});item_wrap.update(_content);this.doc_body.insert({top:item_wrap});if(bbcode.value['useoption']=='0'){item_wrap.select('.optional').invoke('remove');}
if(bbcode.value['single_tag']=='1'){item_wrap.select('.tagcontent').invoke('remove');}
this.palettes['otherstyles_'+bbcode.key]=new ipb.Menu($(this.id+'_cmd_custom_'+bbcode.key),item_wrap,{stopClose:true,offsetX:0,offsetY:42,positionSource:$(this.id+'_cmd_otherstyles')});item_wrap.down('input[type="submit"]').observe('click',this.events.handle_custom_onclick.bindAsEventListener(this));}
$(this.id+'_cmd_custom_'+bbcode.key).observe('click',this.events.handle_custom_command.bindAsEventListener(this,bbcode.key));}.bind(this));if(buttons){$(this.id+'_toolbar_3').show();}
if(other_styles){$(this.id+'_cmd_otherstyles').show();}},resize_to:function(size)
{try{if(this.is_rte)
{new Effect.Morph($(this.editor_box),{style:'height: '+size+'px',duration:0.3});$(this.items['text_obj']).setStyle('height: '+size+'px');}
else
{new Effect.Morph($(this.items['text_obj']),{style:'height: '+size+'px',duration:0.3});if($(this.editor_box)){$(this.editor_box).setStyle('height: '+size+'px');}}}catch(err){Debug.write("#5 "+err);}},get_frame_html:function()
{var ips_frame_html="";ips_frame_html+="<html id=\""+this.id+"_html\">\n";ips_frame_html+="<head>\n";ips_frame_html+="<meta http-equiv=\"content-type\" content=\"text/html; charset="+this.options.char_set+"\" />";ips_frame_html+="<style type='text/css' media='all'>\n";ips_frame_html+="body {\n";ips_frame_html+=" background: #FFFFFF;\n";ips_frame_html+=" margin: 0px;\n";ips_frame_html+=" padding: 4px;\n";ips_frame_html+=" font-family: Verdana, arial, sans-serif;\n";ips_frame_html+=" font-size: 9pt;\n";ips_frame_html+="}\n";ips_frame_html+="</style>\n";if(isRTL&&rtlFull)
{ips_frame_html+="<link rel='stylesheet' type='text/css' media='screen' href='"+rtlFull+"' />\n";if(rtlIe&&Prototype.Browser.IE)
{ips_frame_html+="<!--[if lte IE 7]>\n";ips_frame_html+="<link rel='stylesheet' type='text/css' media='screen' href='"+rtlIe+"' />\n";ips_frame_html+="<![endif]-->\n";}}
ips_frame_html+="</head>\n";ips_frame_html+="<body class='withRTL'>\n";ips_frame_html+="{:content:}\n";ips_frame_html+="</body>\n";ips_frame_html+="</html>";return ips_frame_html;},editor_check_focus:function()
{try{this.editor_window.focus();}catch(err){}},editor_set_controls:function()
{controls=$(this.id+'_controls').select('.rte_control').each(function(elem)
{if(!elem.id){return;}
if(this.options.ignore_controls.include(elem.id.toLowerCase())){return;}
if(elem.hasClassName('rte_button')){this.init_editor_button(elem);}else if(elem.hasClassName('rte_menu')&&!elem.hasClassName('rte_special')){this.init_editor_menu(elem);}else if(elem.hasClassName('rte_palette')){this.init_editor_palette(elem);}else{return;}
this.set_control_unselectable(elem);}.bind(this));if($(this.id+'_resizer')){this.init_editor_button($(this.id+'_cmd_r_small'));this.set_control_unselectable($(this.id+'_cmd_r_small'));this.init_editor_button($(this.id+'_cmd_r_big'));this.set_control_unselectable($(this.id+'_cmd_r_big'));}},set_button_context:function(obj,state,type)
{if(this._showing_html){return false;}
if(Object.isUndefined(type)){type='button';}
if(state=='mousedown'&&(obj.readAttribute('cmd')=='undo'||obj.readAttribute('cmd')=='redo')){return false;}
switch(obj.readAttribute('state'))
{case'true':{switch(state)
{case'mouseout':this.editor_set_ctl_style(obj,'button','selected');break;case'mouseover':case'mousedown':case'mouseup':this.editor_set_ctl_style(obj,type,'down');break;}
break;}
default:{switch(state)
{case'mouseout':this.editor_set_ctl_style(obj,type,'normal');break;case'mousedown':this.editor_set_ctl_style(obj,type,'down');break;case'mouseover':case'mouseup':this.editor_set_ctl_style(obj,type,'hover');break;}
break;}}},editor_set_ctl_style:function(obj,type,mode)
{if(obj.readAttribute('mode')==mode){return;}
var extra='';if(type=='menu'){extra='_menu';}else if(type=='menubutton'){extra='_menubutton';}
extra+=obj.readAttribute('colorname')?'_color':'';extra+=obj.readAttribute('emo_id')?'_emo':'';obj.writeAttribute('mode',mode);try
{switch(mode)
{case"normal":obj.addClassName('rte_normal'+extra).removeClassName('rte_hover').removeClassName('rte_selected');break;case"hover":obj.addClassName('rte_hover'+extra).removeClassName('rte_normal').removeClassName('rte_selected');break;case"selected":case"down":obj.addClassName('rte_selected'+extra).removeClassName('rte_normal').removeClassName('rte_hover');break;}}
catch(err)
{Debug.write("#6 "+err);}},set_control_unselectable:function(elem)
{if(!$(elem)){return;}
$(elem).descendants().each(function(dec){dec.writeAttribute('unselectable','on');});$(elem).writeAttribute('unselectable','on');},init_editor_button:function(elem)
{elem.writeAttribute('cmd',elem.id.replace(this.id+'_cmd_',''));elem.writeAttribute('editor_id',this.id);this.items['buttons'][elem.readAttribute('cmd')]=elem;elem.writeAttribute('state',false);elem.writeAttribute('mode','normal');elem.writeAttribute('real_type','button');elem.observe('click',this.events.button_onmouse_event.bindAsEventListener(this));elem.observe('mousedown',this.events.button_onmouse_event.bindAsEventListener(this));elem.observe('mouseover',this.events.button_onmouse_event.bindAsEventListener(this));elem.observe('mouseout',this.events.button_onmouse_event.bindAsEventListener(this));},init_editor_menu:function(elem)
{elem.writeAttribute('cmd',elem.id.replace(this.id+'_cmd_',''));elem.writeAttribute('editor_id',this.id);this.items['buttons'][elem.readAttribute('cmd')]=elem;var wrap=new Element('ul',{id:this.id+'_popup_'+elem.readAttribute('cmd')+'_menu'});wrap.writeAttribute('cmd',elem.readAttribute('cmd')).addClassName('ipbmenu_content');wrap.hide();if(elem.hasClassName('rte_font'))
{this.fontoptions['_default']=elem.innerHTML;ipb.editor_values.get('primary_fonts').each(function(font){var item=new Element('li',{'id':this.id+'_fontoption_'+font.key});item.setStyle('font-family: "'+font.value+'"; cursor: pointer').addClassName('fontitem');item.update(font.value);$(item).observe('click',this.events.font_format_option_onclick.bindAsEventListener(this));wrap.insert(item);this.fontoptions[font.key]=item;}.bind(this));elem.insert({after:wrap});}
else if(elem.hasClassName('rte_fontsize'))
{this.sizeoptions['_default']=elem.innerHTML;ipb.editor_values.get('font_sizes').each(function(size){var item=new Element('li',{id:this.id+'_sizeoption_'+size});item.setStyle('font-size: '+this.convert_size(size,1)+'pt; cursor: pointer').addClassName('fontitem');item.update(size);$(item).observe('click',this.events.font_format_option_onclick.bindAsEventListener(this));wrap.insert(item);wrap.addClassName("fontsizes");this.sizeoptions.push(size);}.bind(this));elem.insert({after:wrap});}
else if(elem.hasClassName('rte_special'))
{elem.insert({after:wrap});}
var beforeOpen=function(menu){this.preserve_ie_range();}.bind(this);new ipb.Menu($(elem),wrap,{},{beforeOpen:beforeOpen});},init_editor_palette:function(elem)
{elem.writeAttribute('cmd',elem.id.replace(this.id+'_cmd_',''));elem.writeAttribute('editor_id',this.id);this.items['buttons'][elem.readAttribute('cmd')]=elem;wrap=new Element('div',{id:this.id+'_palette_'+elem.readAttribute('cmd')});wrap.writeAttribute('cmd',elem.readAttribute('cmd')).addClassName('ipb_palette');wrap.hide();opt={};var handleReturn=false;switch(elem.readAttribute('cmd'))
{case'forecolor':case'backcolor':var table=new Element('table',{id:this.id+'_'+elem.readAttribute('cmd')+'_palette'}).addClassName('rte_colors');var tbody=new Element('tbody');table.insert(tbody);var tr=null;var td=null;var color='';for(i=0;i<ipb.editor_values.get('colors').length;i++)
{color=ipb.editor_values.get('colors')[i];if(i%ipb.editor_values.get('colors_perrow')==0){tr=new Element('tr');tbody.insert(tr);}
td=new Element('td',{id:this.id+'_'+elem.readAttribute('cmd')+'_color_'+color});td.setStyle('background-color: #'+color).writeAttribute('colorname',color);tr.insert(td);$(td).observe('click',this.events.color_cell_onclick.bindAsEventListener(this));}
wrap.insert(table).addClassName('color_palette');elem.insert({after:wrap});break;case'emoticons':if(Object.isUndefined(ipb.editor_values.get('emoticons')))
{elem.hide();return;}
var table=new Element('table',{id:this.id+'_emoticons_palette'}).addClassName('rte_emoticons');var tbody=new Element('tbody');table.insert(tbody);var tr=null;var td=null;var perrow=10;var i=0;ipb.editor_values.get('emoticons').each(function(emote){if(i%perrow==0)
{tr=new Element('tr');tbody.insert(tr);}
i++;var _tmp=emote.value.split(',');var img=new Element('img',{id:'smid_'+_tmp[0],src:ipb.vars['emoticon_url']+'/'+_tmp[1]});td=new Element('td',{id:this.id+'_emoticons_emote_'+_tmp[0]}).setStyle('cursor: pointer; text-align: center').addClassName('emote');td.writeAttribute('emo_id',_tmp[0]);td.writeAttribute('emo_img',_tmp[1]);td.writeAttribute('emo_code',emote.key);td.insert(img);tr.insert(td);$(td).observe('click',this.events.emoticon_onclick.bindAsEventListener(this));}.bind(this));if(Prototype.Browser.IE)
{var tmpdiv=new Element('div').setStyle('overflow-x: scroll');wrap.insert(tmpdiv.insert(table)).addClassName('emoticons_palette');elem.insert({after:wrap});}
else
{wrap.insert(table).addClassName('emoticons_palette');elem.insert({after:wrap});}
if(this.values.get('show_emoticon_link'))
{var emote_link=this.values.get('templates')['emoticons_showall'].evaluate({id:this.id});wrap.insert({bottom:emote_link});$(this.id+'_all_emoticons').observe('click',this.events.show_emoticon_sidebar.bindAsEventListener(this));}
break;case'link':case'image':case'email':case'media':if(Object.isUndefined(ipb.editor_values.get('templates')[elem.readAttribute('cmd')]))
{elem.hide();return;}
try{wrap.update(ipb.editor_values.get('templates')[elem.readAttribute('cmd')].evaluate({id:this.id}));wrap.down('input[type="submit"]').observe('click',this.events.palette_submit.bindAsEventListener(this));}catch(err){Debug.write("#7 "+err);}
this.doc_body.insert({top:wrap});if(elem.readAttribute('cmd')=='link')
{try{this.defaults['link_text']=$F(this.id+'_urltext');this.defaults['link_url']=$F(this.id+'_url');}catch(err){Debug.write("#8 "+err);}
$(elem).observe('click',this.events.link_onclick.bindAsEventListener(this));}
if(elem.readAttribute('cmd')=='image')
{try{this.defaults['img']=$F(this.id+'_img');}catch(err){Debug.write("#15 "+err);}
$(elem).observe('click',this.events.image_onclick.bindAsEventListener(this));}
if(elem.readAttribute('cmd')=='email')
{try{this.defaults['email_text']=$F(this.id+'_emailtext');this.defaults['email']=$F(this.id+'_email');}catch(err){Debug.write("#8 "+err);}
$(elem).observe('click',this.events.email_onclick.bindAsEventListener(this));}
if(elem.readAttribute('cmd')=='media')
{try{this.defaults['media']=$F(this.id+'_media');}catch(err){Debug.write("#17 "+err);}
$(elem).observe('click',this.events.media_onclick.bindAsEventListener(this));}
this.key_handlers[elem.readAttribute('cmd')]=false;break;default:this.items['buttons'][elem.readAttribute('cmd')]=null;elem.hide();wrap.remove();break;}
if(elem.readAttribute('title'))
{title=new Element('div');title.update(elem.readAttribute('title')).addClassName('rte_title');wrap.insert({top:title});}
if(!elem.readAttribute('cmd').endsWith('color')){opt={stopClose:true};}
$(elem).observe('mouseover',this.events.palette_button_onmouseover.bindAsEventListener(this));$(elem).observe('mouseover',this.events.palette_onmouse_event.bindAsEventListener(this));$(elem).observe('mouseout',this.events.palette_onmouse_event.bindAsEventListener(this));var beforeOpen=function(menu){this.preserve_ie_range();}.bind(this);this.palettes[elem.readAttribute('cmd')]=new ipb.Menu($(elem),wrap,opt,{beforeOpen:beforeOpen});},convert_size:function(size,type)
{if(type==1)
{switch(size)
{case 1:return 7.5;break;case 2:return 10;break;case 3:return 12;break;case 4:return 14;break;case 5:return 18;break;case 6:return 24;break;case 7:return 36;break;default:return 10;}}else{switch(size)
{case'7.5pt':case'10px':return 1;case'10pt':return 2;case'12pt':return 3;case'14pt':return 4;case'18pt':return 5;case'24pt':return 6;case'36pt':return 7;default:return'';}}},format_text:function(e,command,arg)
{if(command.startsWith('resize_')){}
if(command=='switcheditor'){try{ipb.switchEditor(this.id);}catch(err){Debug.error("#9 "+err);}}
if(!this.is_rte&&command!='redo'){this.history_record_state(this.editor_get_contents());}
this.editor_check_focus();if(this[command])
{var return_val=this[command](e);}
else
{try
{var return_val=this.apply_formatting(command,false,(typeof arg=='undefined'?true:arg));}
catch(e)
{Debug.warn("#10 "+e);var return_val=false;}}
if(!this.is_rte&&command!='undo'){this.history_record_state(this.editor_get_contents());}
this.set_context(command);this.editor_check_focus();return return_val;},spellcheck:function()
{if(!Prototype.Browser.IE){return;}
try{if(this.rte_mode){var tmpis=new ActiveXObject("ieSpell.ieSpellExtension").CheckDocumentNode(this.editor_document);}else{var tmpis=new ActiveXObject("ieSpell.ieSpellExtension").CheckAllLinkedDocuments(this.editor_document);}}catch(exception){if(exception.number==-2146827859){if(confirm(ipb.lang['js_rte_erroriespell']?ipb.lang['js_rte_erroriespell']:"ieSpell необнаружен. Нажмите Ок для сохранения страницы."))
{window.open("http://www.iespell.com/download.php","Download");}}
else
{alert(ipb.lang['js_rte_errorloadingiespell']?ipb.lang['js_rte_errorloadingiespell']:"Ошибка загрузки ieSpell: номер ошибки "+exception.number);}}},wrap_tags:function(tag_name,has_option,selected_text)
{var tag_close=tag_name;if(!this.use_bbcode)
{switch(tag_name)
{case'url':tag_name='a href';tag_close='a';break;case'email':tag_name='a href';tag_close='a';has_option='mailto:'+has_option;break;case'img':tag_name='img src';tag_close='';break;case'font':tag_name='font face';tag_close='font';break;case'size':tag_name='font size';tag_close='font';break;case'color':tag_name='font color';tag_close='font';break;case'background':tag_name='font bgcolor';tag_close='font';break;case'indent':tag_name=tag_close='blockquote';break;case'left':case'right':case'center':has_option=tag_name;tag_name='div align';tag_close='div';break;}}
if(Object.isUndefined(selected_text))
{selected_text=this.get_selection();selected_text=(selected_text===false)?'':new String(selected_text);}
if(has_option===true)
{var option=prompt(ips_language_arrayp['js_rte_optionals']?ips_language_arrayp['js_rte_optionals']:"Введите аттрибуты для данного тега",'');if(option)
{var opentag=this.open_brace+tag_name+'="'+option+'"'+this.close_brace;}
else
{return false;}}
else if(has_option!==false)
{var opentag=this.open_brace+tag_name+'="'+has_option+'"'+this.close_brace;}
else
{var opentag=this.open_brace+tag_name+this.close_brace;}
var closetag=(tag_close!='')?this.open_brace+'/'+tag_close+this.close_brace:'';var text=opentag+selected_text+closetag;this.insert_text(text);return false;},wrap_tags_lite:function(start_text,close_text,replace_selection)
{selected_text='';if(Object.isUndefined(replace_selection)||replace_selection==0)
{selected_text=this.get_selection();selected_text=(selected_text===false)?'':new String(selected_text);}
this.insert_text(start_text+selected_text+close_text);return false;},preserve_ie_range:function()
{if(Prototype.Browser.IE)
{this._ie_cache=this.is_rte?this.editor_document.selection.createRange():document.selection.createRange();}},clean_html:function(t)
{if(t.blank()||Object.isUndefined(t))
{return t;}
t=t.replace(/<br>/ig,"<br />");t=t.replace(/<p>(\s+?)?<\/p>/ig,"");t=t.replace(/<p><hr \/><\/p>/ig,"<hr />");t=t.replace(/<p>&nbsp;<\/p><hr \/><p>&nbsp;<\/p>/ig,"<hr />");t=t.replace(/<(p|div)([^&]*)>/ig,"\n<$1$2>\n");t=t.replace(/<\/(p|div)([^&]*)>/ig,"\n</$1$2>\n");t=t.replace(/<br \/>(?!<\/td)/ig,"<br />\n");t=t.replace(/<\/(td|tr|tbody|table)>/ig,"</$1>\n");t=t.replace(/<(tr|tbody|table(.+?)?)>/ig,"<$1>\n");t=t.replace(/<(td(.+?)?)>/ig,"\t<$1>");t=t.replace(/<p>&nbsp;<\/p>/ig,"<br />");t=t.replace(/<br \/>/ig,"<br />\n");t=t.replace(/<br>/ig,"<br />\n");t=t.replace(/<td><br \/>\n<\/td>/ig,"<td><br /></td>");t=t.replace(/<script/g,"&lt;script");t=t.replace(/<\/script>/g,"&lt;/script&gt;");t=t.replace(/^[\s\n\t]+/g,'');t=t.replace(/[\s\n\t]+$/g,'');t=t.replace(/<br \/>$/g,'');return t;},strip_empty_html:function(html)
{html=html.replace('<([^>]+?)></([^>]+?)>',"");return html;},strip_html:function(html)
{html=html.replace(/<\/?([^>]+?)>/ig,"");return html;},history_record_state:function(content)
{if(this.history_recordings[this.history_pointer]!=content)
{this.history_pointer++;this.history_recordings[this.history_pointer]=content;if(!Object.isUndefined(this.history_recordings[this.history_pointer+1]))
{this.history_recordings[this.history_pointer+1]=null;}}},unhtmlspecialchars:function(html)
{html=html.replace(/&quot;/g,'"');html=html.replace(/&lt;/g,'<');html=html.replace(/&gt;/g,'>');html=html.replace(/&amp;/g,'&');return html;},htmlspecialchars:function(html)
{html=html.replace(/&/g,"&amp;");html=html.replace(/"/g,"&quot;");html=html.replace(/</g,"&lt;");html=html.replace(/>/g,"&gt;");return html;},history_time_shift:function(inc)
{var i=this.history_pointer+inc;if(i>=0&&this.history_recordings[i]!=null&&typeof this.history_recordings[i]!='undefined')
{this.history_pointer+=inc;}},history_fetch_recording:function()
{if(!Object.isUndefined(this.history_recordings[this.history_pointer])&&this.history_recordings[this.history_pointer]!=null)
{return this.history_recordings[this.history_pointer];}
else
{return false;}},ipb_quote:function()
{this.wrap_tags_lite('[quote]','[/quote]',0);},ipb_code:function()
{this.wrap_tags_lite('[code]','[/code]',0);}});if(Prototype.Browser.Gecko&&USE_RTE){_editor.prototype.editor.prototype.ORIGINAL_editor_set_content=_editor.prototype.editor.prototype.editor_set_content;_editor.prototype.editor.prototype.ORIGINAL_apply_formatting=_editor.prototype.editor.prototype.apply_formatting;Debug.write("Adding mozilla-specific methods");_editor.prototype.editor.addMethods({_moz_test:function()
{return"Test: "+this.id;},togglesource_pre_show_html:function()
{this.editor_document.designMode='off';},togglesource_post_show_html:function()
{this.editor_document.designMode='on';},editor_set_content:function(initial_text)
{this.ORIGINAL_editor_set_content(initial_text);Event.observe(this.editor_document,'keypress',this.events.editor_document_onkeypress.bindAsEventListener(this));if($(this.id+'_cmd_spellcheck')){$(this.id+'_cmd_spellcheck').hide();this.hidden_objects[this.id+'_cmd_spellcheck']=1;}
if(this.use_bbcode&&$(this.id+'_cmd_justifyfull'))
{$(this.id+'_cmd_justifyfull').hide();this.hidden_objects[this.id+'_cmd_justifyfull']=1;}
try
{var _y=parseInt(window.pageYOffset);this.editor_document.execCommand("inserthtml",false," ");this.editor_document.execCommand("undo",false,null);scroll(0,_y);}
catch(error)
{Debug.write("#11 "+error);}},editor_set_functions:function()
{Event.observe(this.editor_document,'mouseup',this.events.editor_document_onmouseup.bindAsEventListener(this));Event.observe(this.editor_document,'keyup',this.events.editor_document_onkeyup.bindAsEventListener(this));Event.observe(this.editor_document,'keydown',this.events.editor_document_onkeydown.bindAsEventListener(this));Event.observe(this.editor_window,'focus',this.events.editor_window_onfocus.bindAsEventListener(this));Event.observe(this.editor_window,'blur',this.events.editor_window_onblur.bindAsEventListener(this));},apply_formatting:function(cmd,dialog,arg)
{if(cmd!='redo')
{this.editor_document.execCommand("inserthtml",false," ");this.editor_document.execCommand("undo",false,null);}
this.editor_document.execCommand('useCSS',false,true);return this.ORIGINAL_apply_formatting(cmd,dialog,arg);},get_selection:function()
{var selection=this.editor_window.getSelection();this.editor_check_focus();var range=selection?selection.getRangeAt(0):this.editor_document.createRange();return this.moz_read_nodes(range.cloneContents(),false);},moz_add_range:function(node,text_length)
{this.editor_check_focus();var sel=this.editor_window.getSelection();var range=this.editor_document.createRange();range.selectNodeContents(node);if(text_length)
{range.setEnd(node,text_length);range.setStart(node,text_length);}
sel.removeAllRanges();sel.addRange(range);},moz_read_nodes:function(root,toptag)
{var html="";var moz_check=/_moz/i;switch(root.nodeType)
{case Node.ELEMENT_NODE:case Node.DOCUMENT_FRAGMENT_NODE:{var closed;if(toptag)
{closed=!root.hasChildNodes();html='<'+root.tagName.toLowerCase();var attr=root.attributes;for(var i=0;i<attr.length;++i)
{var a=attr.item(i);if(!a.specified||a.name.match(moz_check)||a.value.match(moz_check))
{continue;}
html+=" "+a.name.toLowerCase()+'="'+a.value+'"';}
html+=closed?" />":">";}
for(var i=root.firstChild;i;i=i.nextSibling)
{html+=this.moz_read_nodes(i,true);}
if(toptag&&!closed)
{html+="</"+root.tagName.toLowerCase()+">";}}
break;case Node.TEXT_NODE:{html=this.htmlspecialchars(root.data);}
break;}
return html;},moz_goto_parent_then_body:function(n)
{var o=n;while(n.parentNode!=null&&n.parentNode.nodeName=='HTML')
{n=n.parentNode;}
if(n)
{for(var c=0;c<n.childNodes.length;c++)
{if(n.childNodes[c].nodeName=='BODY')
{return n.childNodes[c];}}}
return o;},moz_insert_node_at_selection:function(text,text_length)
{this.editor_check_focus();var sel=this.editor_window.getSelection();var range=sel?sel.getRangeAt(0):this.editor_document.createRange();sel.removeAllRanges();range.deleteContents();var node=range.startContainer;var pos=range.startOffset;text_length=text_length?text_length:0;if(node.nodeName=='HTML')
{node=this.moz_goto_parent_then_body(node);}
switch(node.nodeType)
{case Node.ELEMENT_NODE:{if(text.nodeType==Node.DOCUMENT_FRAGMENT_NODE)
{selNode=text.firstChild;}
else
{selNode=text;}
node.insertBefore(text,node.childNodes[pos]);this.moz_add_range(selNode,text_length);}
break;case Node.TEXT_NODE:{if(text.nodeType==Node.TEXT_NODE)
{var text_length=pos+text.length;node.insertData(pos,text.data);range=this.editor_document.createRange();range.setEnd(node,text_length);range.setStart(node,text_length);sel.addRange(range);}
else
{node=node.splitText(pos);var selNode;if(text.nodeType==Node.DOCUMENT_FRAGMENT_NODE)
{selNode=text.firstChild;}
else
{selNode=text;}
node.parentNode.insertBefore(text,node);this.moz_add_range(selNode,text_length);}}
break;}
sel.removeAllRanges();},insert_text:function(str,len)
{fragment=this.editor_document.createDocumentFragment();holder=this.editor_document.createElement('span');holder.innerHTML=str;while(holder.firstChild){fragment.appendChild(holder.firstChild);}
var my_length=parseInt(len)>0?len:0;this.moz_insert_node_at_selection(fragment,my_length);},insert_emoticon:function(emo_id,emo_image,emo_code,event)
{this.editor_check_focus();try
{var _emo_url=ipb.vars['emoticon_url']+"/"+emo_image;this.editor_document.execCommand('InsertImage',false,_emo_url);var images=this.editor_document.getElementsByTagName('img');if(images.length>0)
{for(var i=0;i<=images.length;i++)
{if(!Object.isUndefined(images[i])&&images[i].src.match(new RegExp(_emo_url+"$")))
{if(!images[i].getAttribute('alt'))
{images[i].setAttribute('alt',this.unhtmlspecialchars(emo_code));images[i].setAttribute('class','bbc_emoticon');}}}}}
catch(error)
{Debug.write("#12 "+error);}
if(this.emoticon_window_id!=''&&typeof(this.emoticon_window_id)!='undefined')
{this.emoticon_window_id.focus();}}})}
if(Prototype.Browser.Opera&&USE_RTE){_editor.prototype.editor.prototype.ORIGINAL_editor_set_content=_editor.prototype.editor.prototype.editor_set_content;_editor.prototype.editor.addMethods({editor_set_content:function(initial_text)
{this.ORIGINAL_editor_set_content(initial_text);this.editor_document.body.style.height='95%';Event.observe(this.editor_document,'keypress',this.events.editor_document_onkeypress.bindAsEventListener(this));$(this.id+'_cmd_spellcheck').hide();this.hidden_objects[this.id+'_cmd_spellcheck']=1;if(this.use_bbcode)
{$(this.id+'_cmd_justifyfull').hide();this.hidden_objects[this.id+'_cmd_justifyfull']=1;}
try
{var _y=parseInt(window.pageYOffset);this.editor_document.execCommand("inserthtml",false,"-");this.editor_document.execCommand("undo",false,null);scroll(0,_y);}
catch(error)
{Debug.write("#13 "+error);}},insert_text:function(str)
{this.editor_document.execCommand('insertHTML',false,str);},get_selection:function()
{var selection=this.editor_window.getSelection();this.editor_check_focus();var range=selection?selection.getRangeAt(0):this.editor_document.createRange();var lsserializer=document.implementation.createLSSerializer();return lsserializer.writeToString(range.cloneContents());},editor_set_functions:function()
{Event.observe(this.editor_document,'mouseup',this.events.editor_document_onmouseup.bindAsEventListener(this));Event.observe(this.editor_document,'keyup',this.events.editor_document_onkeyup.bindAsEventListener(this));Event.observe(this.editor_window,'focus',this.events.editor_window_onfocus.bindAsEventListener(this));Event.observe(this.editor_window,'blur',this.events.editor_window_onblur.bindAsEventListener(this));}});}
_editor_events=Class.create({handle_custom_command:function(e,cmd)
{Event.stop(e);var elem=($(Event.element(e)).hasClassName('specialitem'))?$(Event.element(e)):$(Event.element(e)).up('.specialitem');if(!$(elem)){return;}
var cmd=$(elem).id.replace(this.id+'_cmd_custom_','');var info=this.values.get('bbcodes').get(cmd);Debug.write(cmd);if(info['single_tag']=='1'&&info['useoption']=='0')
{this.wrap_tags_lite('['+info['tag']+']','',1);ipb.menus.registered.get(this.id+'_cmd_otherstyles').doClose();return;}
else
{var selection=this.get_selection();try{window.setTimeout(function()
{if(info['useoption']=='1'&&info['single_tag']=='1')
{if($(this.id+'_'+cmd+'_option')){$(this.id+'_'+cmd+'_option').focus();}}
else
{if(selection)
{$(this.id+'_'+cmd+'_text').value=selection;}
if($(this.id+'_'+cmd+'_option')){$(this.id+'_'+cmd+'_option').focus();}else{$(this.id+'_'+cmd+'_text').activate();}}}.bind(this),200);}catch(err){Debug.write(err);}}},handle_custom_onclick:function(e)
{Debug.write("Here 5");var elem=Event.element(e);if(!elem.hasClassName('ipb_palette')){elem=Event.findElement(e,'.ipb_palette');}
var styleid=elem.readAttribute("styleid");if(!styleid||Object.isUndefined(this.values.get('bbcodes').get(styleid))){return;}
var info=this.values.get('bbcodes').get(styleid);Debug.write("Here 4");if(info['useoption']=='1'&&info['optional_option']=='0'&&$F(this.id+'_'+styleid+'_option').blank())
{alert(ipb.lang['option_is_empty']);try{$(this.id+'_'+styleid+'_option').focus();}catch(err){}
return;}
Debug.write("Here 3");if(info['useoption']=='1'&&info['single_tag']=='1')
{var option=$F(this.id+'_'+styleid+'_option');if(info['optional_option']=='1'&&option.blank()){this.wrap_tags_lite('['+info['tag']+']','',1);}else{this.wrap_tags_lite('['+info['tag']+"='"+option+"']",'',1);}}
else
{Debug.write("Here 1");var value=$F(this.id+'_'+styleid+'_text');Debug.write("Here 2");var option=($(this.id+'_'+styleid+'_option'))?$F(this.id+'_'+styleid+'_option'):'';if((info['optional_option']=='1'&&option.blank())||info['useoption']=='0'){this.wrap_tags_lite('['+info['tag']+']'+value,'[/'+info['tag']+']',1);}else{this.wrap_tags_lite('['+info['tag']+"='"+option+"']"+value,'[/'+info['tag']+']',1);}}
this.palettes['otherstyles_'+styleid].doClose();},editor_document_onmouseup:function(e)
{Debug.write("Mouse up");ipb.menus.closeAll();this.set_context();},editor_document_onkeyup:function(e)
{this.set_context();},editor_document_onkeydown:function(e)
{if(this.forum_fix_ie_newlines&&Prototype.Browser.IE&&e.keyCode==Event.KEY_RETURN)
{var _test=['Indent','Outdent','JustifyLeft','JustifyCenter','JustifyRight','InsertOrderedList','InsertUnorderedList'];for(i=0;i<_test.length;i++)
{if(this.editor_document.queryCommandState(_test[i]))
{return true;}}
var sel=this.editor_document.selection;var ts=this.editor_document.selection.createRange();var t=ts.htmlText.replace(/<p([^>]*)>(.*)<\/p>/i,'$2');if((sel.type=="Text"||sel.type=="None"))
{ts.pasteHTML("<br />"+t+"\n");}
else
{this.editor_document.innerHTML+="<br />\n";}
this.editor_window.event.returnValue=false;ts.select();this.editor_check_focus();}},editor_document_onkeypress:function(e)
{if(e.ctrlKey)
{switch(String.fromCharCode(e.charCode).toLowerCase())
{case'b':cmd='bold';break;case'i':cmd='italic';break;case'u':cmd='underline';break;default:return;}
Event.stop(e);this.apply_formatting(cmd,false,null);return false;}},editor_window_onfocus:function(e)
{this.has_focus=true;},editor_window_onblur:function(e)
{this.has_focus=false;},button_onmouse_event:function(e)
{if(!Event.element(e).hasClassName('rte_control')){elem=$(Event.element(e)).up('.rte_control');}else{elem=Event.element(e);}
Debug.write(elem.readAttribute('cmd'));if(e.type=='click')
{if(elem.readAttribute('cmd').startsWith('custom_'))
{return;}
else if(elem.readAttribute('cmd')=='help')
{window.open(ipb.vars['base_url']+"&app=forums&module=extras&section=legends&do=bbcode","bbcode","status=0,toolbar=0,width=1024,height=800,scrollbars=1");Event.stop(e);return false;}
else if(elem.readAttribute('cmd').startsWith('r_'))
{var editorSize=$(this.id+'_textarea').getHeight();if(elem.readAttribute('cmd')=='r_small'){this.resize_to(editorSize-100);}else{this.resize_to(editorSize+100);}}
else
{this.format_text(e,elem.readAttribute('cmd'),false,true);}}
Event.stop(e);this.set_button_context(elem,e.type);},font_format_option_onclick:function(e)
{if(!Event.element(e).hasClassName('fontitem')){elem=Event.element(e).up('.fontitem');}else{elem=Event.element(e);}
cmd=$(elem).up('.ipbmenu_content').readAttribute('cmd');this.format_text(e,cmd,elem.innerHTML);},color_cell_onclick:function(e)
{elem=Event.element(e);cmd=$(elem).up('.ipb_palette').readAttribute('cmd');this.format_text(e,cmd,'#'+elem.readAttribute('colorname'));this.palettes[cmd].doClose();},palette_button_onmouseover:function(e)
{if(!Event.element(e).hasClassName('rte_palette')){elem=$(Event.element(e)).up('.rte_palette');}else{elem=Event.element(e);}
elem.setStyle('cursor: pointer;');},palette_onmouse_event:function(e)
{if(!Event.element(e).hasClassName('rte_control')){elem=$(Event.element(e)).up('.rte_control');}else{elem=Event.element(e);}
if(e.type=='mouseover'){$(elem).addClassName('rte_hover');}else{$(elem).removeClassName('rte_hover');}},palette_return_key:function(e)
{},palette_submit:function(e)
{elem=Event.element(e);palette=elem.up('.ipb_palette');if(!palette){return;}
cmd=palette.readAttribute('cmd');Debug.write($(elem).id+" "+$(palette).id+" "+cmd);switch(cmd)
{case'link':var url=$F(this.id+'_url');var text=$F(this.id+'_urltext');if(url=='http://'||url.blank()){return;};if(text.blank()){text=url;}
this.wrap_tags('url',url,text);break;case'image':var img=$F(this.id+'_img');if(img=='http://'||img.blank()){return;};if(!this.is_rte){this.wrap_tags('img',false,img);}else{this.wrap_tags('img',img,'');}
break;case'email':var email=$F(this.id+'_email');var text=$F(this.id+'_emailtext');if(email.blank()||email.indexOf('@')==-1){return;}
if(text.blank()){text=email;}
this.wrap_tags('email',email,text);break;case'media':var url=$F(this.id+'_media');if(url.blank()){return;}
this.wrap_tags_lite('[media]'+url,'[/media]');break;}
this.palettes[cmd].doClose();},emoticon_onclick:function(e)
{var elem=Event.element(e);var emo=elem.up('.emote');var palette=elem.up('.ipb_palette');if(!palette||!emo){return;}
var cmd=palette.readAttribute('cmd');this.insert_emoticon(emo.readAttribute('emo_id'),emo.readAttribute('emo_img'),emo.readAttribute('emo_code'),e);this.palettes[cmd].doClose();},link_onclick:function(e)
{var selection=this.get_selection();var _active=null;try{if(selection)
{Debug.write("**selection: "+selection);if(selection.match(/<img/)||selection.match(/\[img\]/))
{if(!this.is_rte)
{selection=selection.gsub(/<img src=['"]([^'"]+?)['"]\s+?\/>/,function(match){return"[img]"+match[1]+"[/img]";});}
$(this.id+'_url').value=this.defaults['link_url'];$(this.id+'_urltext').value=selection;}
else if(selection.match(/[A-Za-z]+:\/\/[A-Za-z0-9\.-]{3,}\.[A-Za-z]{3}/)){$(this.id+'_url').value=selection.strip();$(this.id+'_urltext').value=this.defaults['link_text'];_active=$(this.id+'_urltext');}else{$(this.id+'_urltext').value=selection.strip();$(this.id+'_url').value=this.defaults['link_url'];_active=$(this.id+'_url');}}
else
{$(this.id+'_urltext').value=this.defaults['link_text'];$(this.id+'_url').value=this.defaults['link_url'];_active=$(this.id+'_url');}
if(!this.key_handlers['url'])
{$(this.id+'_url').observe('keypress',this.events.palette_return_key.bindAsEventListener(this));$(this.id+'_urltext').observe('keypress',this.events.palette_return_key.bindAsEventListener(this));this.key_handlers['url']=true;}
window.setTimeout(function()
{$(_active).activate();}.bind(this),200);}catch(err){Debug.write("#13 "+err);}},image_onclick:function(e)
{var selection=this.get_selection();var msg=(selection&&!selection.startsWith('<IMG'))?selection:this.defaults['img'];try{$(this.id+'_img').value=msg;if(!this.key_handlers['image'])
{$(this.id+'_img').observe('keypress',this.events.palette_return_key.bindAsEventListener(this));this.key_handlers['image']=true;}
window.setTimeout(function()
{$(this.id+'_img').activate();}.bind(this),200);}catch(err){Debug.write("#14 "+err);}},media_onclick:function(e)
{var selection=this.get_selection();var msg=(selection)?selection:this.defaults['media'];try{$(this.id+'_media').value=msg;if(!this.key_handlers['media'])
{$(this.id+'_media').observe('keypress',this.events.palette_return_key.bindAsEventListener(this));this.key_handlers['media']=true;}
window.setTimeout(function()
{$(this.id+'_media').activate();}.bind(this),200);}catch(err){Debug.write("#18 "+err);}},email_onclick:function(e)
{var selection=this.get_selection();var _active=$(this.id+'_email');try{if(selection)
{if(selection.match(/([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+/))
{$(this.id+'_email').value=selection.strip();$(this.id+'_emailtext').value=this.defaults['email_text'];_active=$(this.id+'_emailtext');}
else
{$(this.id+'_emailtext').value=selection.strip();$(this.id+'_email').value=this.defaults['email'];}}
else
{$(this.id+'_emailtext').value=this.defaults['email_text'];$(this.id+'_email').value=this.defaults['email'];}
if(!this.key_handlers['email'])
{$(this.id+'_email').observe('keypress',this.events.palette_return_key.bindAsEventListener(this));$(this.id+'_emailtext').observe('keypress',this.events.palette_return_key.bindAsEventListener(this));this.key_handlers['email']=true;}
window.setTimeout(function()
{$(_active).activate();}.bind(this),200);}catch(err){Debug.write("#16 "+err);}},show_emoticon_sidebar:function(e)
{if(Object.isUndefined(inACP)||inACP==false){var url=ipb.vars['base_url'];}else{var url=ipb.vars['front_url'];}
url+="app=forums&amp;module=ajax&amp;section=emoticons&amp;editor_id="+this.id;new Ajax.Request(url.replace(/&amp;/g,'&'),{method:'get',onSuccess:function(t)
{$('editor_'+this.id).addClassName('with_sidebar');var div=$('editor_'+this.id).down('.sidebar');div.update(this.values.get('templates')['emoticon_wrapper'].evaluate({id:this.id}));$(this.id+'_emoticon_holder').update(t.responseText);div.show();this.palettes['emoticons'].doClose();}.bind(this)});},addEmoticon:function(code,id,img,editorid)
{try{this.insert_emoticon('',img,code,'');}
catch(err)
{Debug.error(err);}}});;ipb.lang['error_occured']="Возникла ошибка";ipb.lang['loading']="Загрузка";ipb.lang['no_permission']="У вас нет прав для совершения этого действия";ipb.lang['cannot_readd_friend']="В течение пяти минут вы не можете снова добавить только что удаленного пользователя в друзья.";ipb.lang['rtg_poor']="Плохо";ipb.lang['friend_already']="Пользователь уже ваш друг";ipb.lang['action_failed']="Действие не выполнено";ipb.lang['error']="Ошибка";ipb.lang['error_security']="Ошибка защиты";ipb.lang['delete_confirm']="Вы действительно хотите продолжить?";ipb.lang['rtg_ok']="Средне";ipb.lang['available']="&#10004; Доступно!";ipb.lang['rtg_nbad']="Не плохо";ipb.lang['rtg_good']="Хорошо";ipb.lang['rtg_awesome']="Замечательно!";ipb.lang['member_no_exist']="Пользователь не существует";ipb.lang['rtg_already']="Вы уже проголосовали за эту запись";ipb.lang['too_long']="&#10007; Введенное имя длинно";ipb.lang['invalid_chars']="&#10007;  Поле содержит недопустимые символы";ipb.lang['rtg_topic_locked']="Тема закрыта";ipb.lang['too_short']="&#10007; Введенное имя слишком короткое";ipb.lang['is_required']="&#10007; Поле является обязательным";ipb.lang['not_available']="&#10007; Имя уже занято!";ipb.lang['email_doesnt_match']="&#10007; Введенные адреса не совпадают";ipb.lang['email_in_use']="&#10007; E-mail адрес уже используется";ipb.lang['email_banned']="&#10007; E-mail адрес запрещен для использования";ipb.lang['invalid_email']="&#10007; E-mail адрес неправильный";ipb.lang['pass_doesnt_match']="&#10007; Введенные пароли не совпадают";ipb.lang['pass_too_short']="&#10007; Введенный пароль менее 3 символов";ipb.lang['pass_too_long']="&#10007; Введенный пароль больше 32 символов";ipb.lang['delete_post_confirm']="Вы уверены что хотите удалить это сообщение?";ipb.lang['copy_topic_link']="Прямая ссылка на сообщение";ipb.lang['set_as_spammer']="Вы уверены что хотите пометить пользователя как спамера?";ipb.lang['is_spammer']="Этот пользователь уже отмечен как спамер";ipb.lang['poll_not_enough_choices']="Один из вопросов не содержит достаточного количества вариантов выбора, вариантов должно быть не меньше двух!";ipb.lang['poll_no_more_choices']="Вы больше не можете добавлять варианты к вопросу.";ipb.lang['poll_no_more_q']="Вы больше не можете добавлять вопросы к опросу";ipb.lang['poll_stats']="Вам разрешено добавить еще [q] вопросов с [c] вариантами ответа на вопрос.";ipb.lang['editor_enter_list']="Введите пункт списка";ipb.lang['click_to_show_opts']="Нажмите для управления опциями сообщения";ipb.lang['delete_topic_confirm']="Вы действительно хотите удалить эту тему?";ipb.lang['with_selected']="С отмеченными ({num}) ";ipb.lang['click_to_attach']="Нажмите чтобы прикрепить файлы";ipb.lang['att_select_files']="Выберите файлы";ipb.lang['post_empty']="Ваше сообщение пусто";ipb.lang['upload_no_file']="Вы не выбрали файл для загрузки";ipb.lang['invalid_mime_type']="Вы не можете загружать файлы подобного типа";ipb.lang['upload_limit_hit']="Превышен лимит";ipb.lang['upload_failed']="Загрузка не удалась";ipb.lang['upload_too_big']="Размер файла превышает допустимый для загрузки размер";ipb.lang['silly_server']="Возникла ошибка при загрузке файла";ipb.lang['upload_done']="Готово (загружено [total])";ipb.lang['pending']="Ожидает";ipb.lang['upload_progress']="Загружено [done] из [total]";ipb.lang['uploading']="Загрузка...";ipb.lang['reached_max_folders']="Вы достигли лимита на количество папок";ipb.lang['upload_queue']="Вы попытались загрузить слишком много файлов. Допустимо одновременно загружать не более: ";ipb.lang['upload_skipped']="Загрузка пропущена";ipb.lang['delete_pm_many_confirm']="Вы действительно хотите удалить эти переписки?";ipb.lang['delete_pm_confirm']="Вы действительно хотите удалить эту переписку?";ipb.lang['delete_reply_confirm']="Вы действительно хотите удалить этот ответ?";ipb.lang['folder_not_found']="Не удалось найти папку";ipb.lang['folder_protected']="Не удалось совершить действие. Папка защищена.";ipb.lang['cant_delete_folder']="Вы не можете удалить защищенную папку.";ipb.lang['must_enter_name']="Необходимо ввести имя";ipb.lang['confirm_delete']="Вы действительно хотите удалить эту папку? Будут удалены ВСЕ сообщения, содержащиеся в ней. Данное действие НЕ ОБРАТИМО!";ipb.lang['confirm_empty']="Вы действительно хотите очистить эту папку?";ipb.lang['prof_comment_perm']="У вас не достаточно прав чтобы оставить комментарий в этом профиле";ipb.lang['prof_comment_empty']="Вы должны ввести текст комментария";ipb.lang['enter_unlimited_names']="Введите имена";ipb.lang['enter_x_names']="Введите до [x] имен пользователей";ipb.lang['prof_comment_mod']="Ваш комментарий был добавлен. Подождите пока владелец профиля, одобрит его, затем он появится в общем списке.";ipb.lang['fail_config']="Не удалось сохранить настройки";ipb.lang['fail_cblock']="Не удалось сохранить изменения внутри блока";ipb.lang['option_is_empty']="Данная настройка тега должна быть заполнена";ipb.lang['js_rte_errorloadingiespell']="Не удалось загрузить ieSpell. Ошибка: ";ipb.lang['js_rte_erroriespell']="ieSpell не обнаружен. Нажмите OK для перехода на страницу загрузки";ipb.lang['idm_msg_email']="Вы не ввели email адрес";ipb.lang['blog_revert_header']="Вы действительно хотите вернуть заголовок к прежнему виду?";ipb.lang['idm_msg_text']="Вы не ввели сообщение";ipb.lang['trouble_uploading']="Проблемы с загрузкой?";ipb.lang['switch_to_advanced']="Воспользуйтесь нашим новым менеджером для загрузки сразу нескольких файлов (требуется современный браузер)";ipb.lang['save_folder']=">";ipb.lang['invalid_folder_name']="Имя директории неверное";ipb.lang['idm_comment_empty']="Комментарий пуст";ipb.lang['idm_invalid_file']="Файл неверный";ipb.lang['prof_update_tooltip']="Обновить мой статус";ipb.lang['prof_update_button']="Обновить";ipb.lang['message_sent']="Сообщение отправлено";ipb.lang['unapprove']="Скрыть";ipb.lang['approve']="Показать";ipb.lang['vote_updated']="Голос обновлен!";ipb.lang['vote_success']="Голос сохранен!";ipb.lang['post_empty_post']="Нельзя отправлять пустое сообщение. Введите какой-либо текст в редакторе.";ipb.lang['post_empty_title']="Вы должны ввести название темы !";ipb.lang['post_empty_username']="Вы должны ввести имя пользователя";