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_26d28bce217d21c9cf9695fbc1602d18
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 IPBACP=Class.create({autocompleteWrap:new Template("<ul id='#{id}' class='ipbmenu_content' style='width: 250px;'></ul>"),autocompleteItem:new Template("<li id='#{id}'>#{itemvalue}</li>"),autocompleteUrl:'',initialize:function()
{document.observe("dom:loaded",function(){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});},onSuccess:function(t){if(t.responseText=='logout')
{alert("Сессия истекла. Нажмите OK для перехода к форме входа.");window.location.href=ipb.vars['base_url'];}}});this.autocompleteUrl=ipb.vars['front_url']+'app=core&module=ajax&section=findnames&do=get-member-names&name=';}.bind(this));},confirmDelete:function(url,msg)
{url=url.replace(/&amp;/g,'&');if(!msg)
{msg='ПОДТВЕРЖДЕНИЕ:\nНажмите OK для продолжения удаления';}
if(confirm(msg))
{window.location.href=url;}
else
{return false;}},openWindow:function(url,width,height,name)
{if(!name)
{var mydate=new Date();name=mydate.getTime();}
var Win=window.open(url,name,'width='+width+',height='+height+',resizable=1,scrollbars=1,location=no,directories=no,status=no,menubar=no,toolbar=no');return false;},redirect:function(url,full)
{url=url.replace(/&amp;/g,'&');if(!full)
{url=ipb.vars['base_url']+url;}
window.location.href=url;},pageJump:function(url_bit,total_posts,per_page)
{pages=1;cur_st=ipb.vars['st'];cur_page=1;if(total_posts%per_page==0)
{pages=total_posts/per_page;}
else
{pages=Math.ceil(total_posts/per_page);}
msg="Введите номер страницы от 1 до"+" "+pages;if(cur_st>0)
{cur_page=cur_st/per_page;cur_page=cur_page-1;}
show_page=1;if(cur_page<pages)
{show_page=cur_page+1;}
if(cur_page>=pages)
{show_page=cur_page-1;}
else
{show_page=cur_page+1;}
userPage=prompt(msg,show_page);if(userPage>0)
{if(userPage<1){userPage=1;}
if(userPage>pages){userPage=pages;}
if(userPage==1){start=0;}
else{start=(userPage-1)*per_page;}
window.location=url_bit+"&st="+start;}},ajaxRefresh:function(url,text,addtotext)
{new Ajax.Request(url+'&__notabsave=1',{method:'post',onSuccess:function(t)
{var html=t.responseText;eval(html);},onFailure:function()
{},onException:function()
{}});if(text)
{if(addtotext)
{$('refreshbox').innerHTML=text+'<br />'+$('refreshbox').innerHTML;}
else
{$('refreshbox').innerHTML=text;}}},location_jump:function(url,full)
{url=url.replace(/&amp;/g,'&');if(full){window.location.href=url;}else{window.location.href=ipb.vars['base_url']+url;}}});;var _menu=window.IPBoard;_menu.prototype.menus={registered:$H(),readyForMoving:false,init:function()
{Debug.write("Initializing acp.menu.js");document.observe("dom:loaded",function(){ipb.menus.readyForMoving=true;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((except&&menu.key!=except))
{menu.value.doClose();}});}}
ipb.menus.init();_menu.prototype.Menu=Class.create({initialize:function(source,target,options){if(!$(source)||!$(target)){return;}
if(!$(source).id){$(source).identify();}
this.id=$(source).id+'_menu';this.source=$(source);this.target=$(target);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));if(this.options.callback)
{this.options.callback.each(function(c){$(source).observe(c.key,c.value);});}
if(ipb.menus.readyForMoving){$$('body')[0].insert({bottom:$(this.target)});}else{document.observe("dom:loaded",function(){$$('body')[0].insert({bottom:$(this.target)});}.bind(this));}
$(this.target).setStyle('position: absolute;').hide().setStyle({zIndex:20000});$(this.target).descendants().each(function(elem){$(elem).setStyle({zIndex:20000});});ipb.menus.register($(source).id,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+" x "+menuDim.width);Debug.write("screenDim: "+screenDim.height);Debug.write("manual ofset: "+this.options.offsetX+" x "+this.options.offsetY);_a=_getOffsetParent(_source);_b=_getOffsetParent(this.target);if(_a!=_b)
{Debug.write("a unequal to b");if((realSourcePos.left+menuDim.width)>screenDim.width){diff=menuDim.width-sourceDim.width;if(Prototype.Browser.IE7)
{pos.left=(sourcePos.left-diff)+this.options.offsetX;}
else
{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;}}
else
{Debug.write("a equal to b");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});},doClose:function()
{new Effect.Fade($(this.target),{duration:0.3});},targetClick:function(e)
{if(this.options.stopClose)
{Event.stop(e);}},eventClick:function(e)
{Event.stop(e);if($(this.target).visible()){this.doClose();}else{ipb.menus.closeAll($(this.source).id);this.doOpen();}},eventOver:function()
{}});;ACPLiveSearch={searchTimer:[],searchLastQuery:'',hasCleared:false,init:function()
{Debug.write("Initializing acp.livesearch.js");document.observe("dom:loaded",function(){ACPLiveSearch.initEvents();});},initEvents:function()
{if(!$('acpSearchKeyword'))
{return false;}
$('acpSearchKeyword').observe("focus",ACPLiveSearch.timer_liveSearch);$('acpSearchKeyword').observe("blur",ACPLiveSearch.timer_hideLiveSearch);$('acpSearchKeyword').writeAttribute({autocomplete:"off"});},timer_liveSearch:function(e)
{if(!ACPLiveSearch.hasCleared)
{$('acpSearchKeyword').value='';ACPLiveSearch.hasCleared=true;}
ACPLiveSearch.searchTimer['show']=setTimeout(ACPLiveSearch.liveSearch,400);},timer_hideLiveSearch:function(e)
{ACPLiveSearch.searchTimer['hide']=setTimeout(ACPLiveSearch.hideLiveSearch,800);},hideLiveSearch:function(e)
{new Effect.Fade($('live_search_popup'),{duration:0.4,afterFinish:function(){$('ajax_result').update('');}});ACPLiveSearch.searchLastQuery='';clearTimeout(ACPLiveSearch.searchTimer['show']);clearTimeout(ACPLiveSearch.searchTimer['hide']);},liveSearch:function(e)
{ACPLiveSearch.timer_liveSearch();var val=$F('acpSearchKeyword').strip();if(val.length<3){return;}
if(!$('live_search_popup'))
{Debug.write("Creating popup");ACPLiveSearch.buildSearchPopup();}
else if(!$('live_search_popup').visible())
{new Effect.Appear($('live_search_popup'),{duration:0.4});}
if($F('acpSearchKeyword')==ACPLiveSearch.searchLastQuery){return;}
new Ajax.Request(ipb.vars['base_url']+"app=core&module=ajax&section=livesearch&do=search&secure_key="+ipb.vars['md5_hash']+"&search_term="+val,{method:'get',onSuccess:function(t){if(t.responseText=='logout')
{ACPLiveSearch.searchLastQuery=val;ACPLiveSearch.hideLiveSearch();return false;}
$('ajax_result').update(t.responseText);}});ACPLiveSearch.searchLastQuery=$F('acpSearchKeyword');},buildSearchPopup:function(e)
{pos=$('acpSearchKeyword').cumulativeOffset();finalPos={top:pos.top+$('acpSearchKeyword').getHeight(),left:(pos.left+45)};popup=new Element('div',{id:'live_search_popup'}).hide().setStyle('top: '+finalPos.top+'px; left: '+finalPos.left+'px');$('ipboard_body').insert({bottom:popup});new Ajax.Request(ipb.vars['base_url']+"app=core&module=ajax&section=livesearch&do=template&secure_key="+ipb.vars['md5_hash'],{method:'get',onSuccess:function(t){popup.update(t.responseText);}});new Effect.Appear($('live_search_popup'),{duration:0.3});}}
ACPLiveSearch.init();;document.observe("dom:loaded",function()
{doStriping();resizeContent.defer();});function doStriping()
{var TBL_ALT_ON='acp-row-on';var TBL_ALT_OFF='acp-row-off';var TBL_ALT_RED='acp-row-red';var TBL_ALT_AMB='acp-row-amber';var ROW_ON_OFF=true;$$('#main_content table.alternate_rows > tr, #main_content table.alternate_rows tbody > tr, .alternate_rows > li, .alternate_rows_force').each(function(tblRow)
{$(tblRow).removeClassName(TBL_ALT_ON);$(tblRow).removeClassName(TBL_ALT_OFF);if(ROW_ON_OFF)
{ROW_ON_OFF=false;$(tblRow).addClassName(TBL_ALT_ON);}
else
{ROW_ON_OFF=true;$(tblRow).addClassName(TBL_ALT_OFF);}
if($(tblRow).hasClassName('_red'))
{$(tblRow).removeClassName(TBL_ALT_AMB);$(tblRow).removeClassName(TBL_ALT_ON);$(tblRow).removeClassName(TBL_ALT_OFF);$(tblRow).addClassName(TBL_ALT_RED);}
else if($(tblRow).hasClassName('_amber'))
{$(tblRow).removeClassName(TBL_ALT_RED);$(tblRow).removeClassName(TBL_ALT_ON);$(tblRow).removeClassName(TBL_ALT_OFF);$(tblRow).addClassName(TBL_ALT_AMB);}});}
function resizeContent()
{if($('section_navigation')&&$('main_content'))
{var navSize=$('section_navigation').getHeight();var contentSize=$('main_content').getHeight();if(navSize>contentSize)
{var height=navSize+50;$('main_content').setStyle('min-height: '+height+'px;');if($('copyright'))
{$('copyright').setStyle('bottom: 0px;');}}}};var Ipb3AcpTabStrip=Class.create();Ipb3AcpTabStrip.prototype={tabstrips:$H(),initialize:function()
{Debug.write('IPB3 ACP Tabs: Initialize');},register:function(tabstripId)
{Debug.write('IPB3 ACP Tabs: Register '+tabstripId);try{if(Object.isUndefined(_go_go_gadget_editor_hack)){fix_hack=true;}else{fix_hack=false;}}catch(err){fix_hack=false;}
Debug.write("Fix hack is "+fix_hack);var first=true;var firsttab=null;this.tabstrips[tabstripId]=$(tabstripId);this.tabstrips[tabstripId].tabs=new Array();var tabitems=$$('#main_content #'+tabstripId+' li');for(var i=0;i<tabitems.length;i++)
{var tabId=tabitems[i].id.replace(/^(.*)-(\S+)$/,"$2");Debug.write('IPB3 ACP Tabs: Adding '+tabId+' to tabstrip '+this.tabstrips[tabstripId].id);this.tabstrips[tabstripId].tabs[i]=tabitems[i];this.tabstrips[tabstripId].tabs[i].tabStrip=this.tabstrips[tabstripId];this.tabstrips[tabstripId].tabs[i].tabPane=$('tabpane-'+tabId);this.tabstrips[tabstripId].tabs[i].style.cursor='normal';Event.observe(this.tabstrips[tabstripId].tabs[i],'click',this.toggle.bindAsEventListener(this));if(first){first=false;firsttab=this.tabstrips[tabstripId].tabs[i];}
this.tabstrips[tabstripId].tabs[i].initSizeVals={'width':this.tabstrips[tabstripId].tabs[i].tabPane.getWidth(),'height':this.tabstrips[tabstripId].tabs[i].tabPane.getHeight()};}
Debug.write('IPB3 ACP Tabs: Registered '+this.tabstrips[tabstripId].tabs.length+' tabs');this.doToggle(firsttab);},toggle:function(e)
{var clickedTab=$(Event.findElement(e,'li'));this.doToggle(clickedTab);},doToggle:function(clickedTab)
{Debug.write('IPB3 ACP Tabs: Toggling tab strip '+clickedTab.tabStrip.id+' - '+clickedTab.id);if(Prototype.Browser.Gecko&&fix_hack)
{_paneWrap=$(clickedTab.tabPane).up();_paneWrap.style.height='auto';_paneWrap.down('div.acp-actionbar').relativize();_paneWrap.down('div.acp-actionbar').setStyle({top:'0px',left:'0px',width:'auto',height:'auto'});}
for(var i=0;i<clickedTab.tabStrip.tabs.length;i++)
{var tabitm=clickedTab.tabStrip.tabs[i];if(typeof(tabitm)!='undefined'&&typeof(tabitm)!='function')
{if(clickedTab.id==tabitm.id)
{tabitm.className='active';if(tabitm.tabPane!=null)
{if(tabitm.tabPane.hasClassName('has_editor')&&Prototype.Browser.Gecko&&fix_hack)
{tabitm.tabPane.style.visibility='visible';tabitm.tabPane.style.height=tabitm.initSizeVals['height']+'px';tabitm.tabPane.style.width=tabitm.initSizeVals['width']+'px';tabitm.tabPane.style.clip="auto";tabitm.tabPane.down('div.editor').style.height=tabitm.initSizeVals['height']+'px';tabitm.tabPane.up('div.acp-box').style.height=tabitm.initSizeVals['height']+50+'px';buttonEl=tabitm.tabPane.up().down('div.acp-actionbar');buttonEl.absolutize();buttonEl.style.width=parseInt(buttonEl.style.width)-20+'px';buttonEl.style.height=parseInt(buttonEl.style.height)-20+'px';buttonEl.style.top=parseInt($('tab_member').positionedOffset()[1])+tabitm.initSizeVals['height']+75+'px';}
else
{tabitm.tabPane.style.display='block';}}}
else
{tabitm.className='';if(tabitm.tabPane!=null)
{if(tabitm.tabPane.hasClassName('has_editor')&&Prototype.Browser.Gecko&&fix_hack)
{tabitm.tabPane.style.visibility='hidden';tabitm.tabPane.style.height='0px';tabitm.tabPane.style.width='0px';tabitm.tabPane.style.position='absolute';tabitm.tabPane.style.clip="rect(0px,0px,0px,0px)";}
else
{tabitm.tabPane.style.display='none';}}}}}}};var ipbAcpTabStrips=new Ipb3AcpTabStrip;;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);}}});