
var taigaposthumanregex=new RegExp('<(?:div|DIV) id="?([^"]+\/([^"\/]+)\\.[^"]*)"? class="?post"?>');var taigaprofilefields=new Array();var splitstring='<!--taiga-->';var taigaattachments=[];var taiganumberofattachmentboxes=25;var taigacurrentlyuploadingattachments=0;var taigatemppostext='';var taigacurrentlyeditingpost=0;var taigainunreadview=false;var taigamessagequeue=new Array();var taigaredirecting='0';var taigaunreadhash='';var taigathisisthelastpage=false;var taigaautosaveinterval=10000;var taigainputext='  taigainitialvalue';var taigajumptopost='';var taigaselectedavatar='';var taigapollajaxtimeouti=0;var taigapollajaxtimeoutoriginal=(60*5);var taigapollajaxtimeout=taigapollajaxtimeoutoriginal;var taigagetnewpostsajax;var taigapollajax;var taigatitle=document.title.toString();var taigablurred=false;var taiganewposts=0;var taigaonbeforeunloadalreadysaved=false;var taiganewpostlinks=new Array();var taigaloggedinuid='0';var taigalastextarea='posttextarea';var taigamainbarorder='';var taigajustchangedorderbool=false;var taigafirsttimeinitialsetting=1;var taigafirsttime=taigafirsttimeinitialsetting;var taigafirstime='1';var taiganotalreadysaidyestooldthreadwarning=true;var taigaie=/MSIE (\d+\.\d+);/.test(navigator.userAgent);var taigachrome=navigator.userAgent.toLowerCase().indexOf('chrome')>-1;var taigalastpolleventid;var taigathreadsplitregexp=/class="?taiga_thread_(\w+)"?/i;var taigapathumanregex=/\/([^\/]+)\/([^\/]+)\.html#(.+?)-$/;var taigaattachmentuploadprogressbarupdateinterval=1000;if(!this.JSON){this.JSON={};}
(function(){function f(n){return n<10?'0'+n:n;}
if(typeof Date.prototype.toJSON!=='function'){Date.prototype.toJSON=function(key){return isFinite(this.valueOf())?this.getUTCFullYear()+'-'+
f(this.getUTCMonth()+1)+'-'+
f(this.getUTCDate())+'T'+
f(this.getUTCHours())+':'+
f(this.getUTCMinutes())+':'+
f(this.getUTCSeconds())+'Z':null;};String.prototype.toJSON=Number.prototype.toJSON=Boolean.prototype.toJSON=function(key){return this.valueOf();};}
var cx=/[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,escapable=/[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,gap,indent,meta={'\b':'\\b','\t':'\\t','\n':'\\n','\f':'\\f','\r':'\\r','"':'\\"','\\':'\\\\'},rep;function quote(string){escapable.lastIndex=0;return escapable.test(string)?'"'+string.replace(escapable,function(a){var c=meta[a];return typeof c==='string'?c:'\\u'+('0000'+a.charCodeAt(0).toString(16)).slice(-4);})+'"':'"'+string+'"';}
function str(key,holder){var i,k,v,length,mind=gap,partial,value=holder[key];if(value&&typeof value==='object'&&typeof value.toJSON==='function'){value=value.toJSON(key);}
if(typeof rep==='function'){value=rep.call(holder,key,value);}
switch(typeof value){case'string':return quote(value);case'number':return isFinite(value)?String(value):'null';case'boolean':case'null':return String(value);case'object':if(!value){return'null';}
gap+=indent;partial=[];if(Object.prototype.toString.apply(value)==='[object Array]'){length=value.length;for(i=0;i<length;i+=1){partial[i]=str(i,value)||'null';}
v=partial.length===0?'[]':gap?'[\n'+gap+
partial.join(',\n'+gap)+'\n'+
mind+']':'['+partial.join(',')+']';gap=mind;return v;}
if(rep&&typeof rep==='object'){length=rep.length;for(i=0;i<length;i+=1){k=rep[i];if(typeof k==='string'){v=str(k,value);if(v){partial.push(quote(k)+(gap?': ':':')+v);}}}}else{for(k in value){if(Object.hasOwnProperty.call(value,k)){v=str(k,value);if(v){partial.push(quote(k)+(gap?': ':':')+v);}}}}
v=partial.length===0?'{}':gap?'{\n'+gap+partial.join(',\n'+gap)+'\n'+
mind+'}':'{'+partial.join(',')+'}';gap=mind;return v;}}
if(typeof JSON.stringify!=='function'){JSON.stringify=function(value,replacer,space){var i;gap='';indent='';if(typeof space==='number'){for(i=0;i<space;i+=1){indent+=' ';}}else if(typeof space==='string'){indent=space;}
rep=replacer;if(replacer&&typeof replacer!=='function'&&(typeof replacer!=='object'||typeof replacer.length!=='number')){throw new Error('JSON.stringify');}
return str('',{'':value});};}
if(typeof JSON.parse!=='function'){JSON.parse=function(text,reviver){var j;function walk(holder,key){var k,v,value=holder[key];if(value&&typeof value==='object'){for(k in value){if(Object.hasOwnProperty.call(value,k)){v=walk(value,k);if(v!==undefined){value[k]=v;}else{delete value[k];}}}}
return reviver.call(holder,key,value);}
text=String(text);cx.lastIndex=0;if(cx.test(text)){text=text.replace(cx,function(a){return'\\u'+
('0000'+a.charCodeAt(0).toString(16)).slice(-4);});}
if(/^[\],:{}\s]*$/.test(text.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,'@').replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,']').replace(/(?:^|:|,)(?:\s*\[)+/g,''))){j=eval('('+text+')');return typeof reviver==='function'?walk({'':j},''):j;}
throw new SyntaxError('JSON.parse');};}}());function taigaNewAjax(){var xmlhttp=false;if(!xmlhttp&&typeof XMLHttpRequest!='undefined'){try{xmlhttp=new XMLHttpRequest();}catch(e){xmlhttp=false;}}
if(!xmlhttp&&window.createRequest){try{xmlhttp=window.createRequest();}catch(e){xmlhttp=false;}}
return xmlhttp;}
function f_clientWidth(){return f_filterResults(window.innerWidth?window.innerWidth:0,document.documentElement?document.documentElement.clientWidth:0,document.body?document.body.clientWidth:0);}
function f_clientHeight(){return f_filterResults(window.innerHeight?window.innerHeight:0,document.documentElement?document.documentElement.clientHeight:0,document.body?document.body.clientHeight:0);}
function f_scrollLeft(){return f_filterResults(window.pageXOffset?window.pageXOffset:0,document.documentElement?document.documentElement.scrollLeft:0,document.body?document.body.scrollLeft:0);}
function f_scrollTop(){return f_filterResults(window.pageYOffset?window.pageYOffset:0,document.documentElement?document.documentElement.scrollTop:0,document.body?document.body.scrollTop:0);}
function f_filterResults(n_win,n_docel,n_body){var n_result=n_win?n_win:0;if(n_docel&&(!n_result||(n_result>n_docel)))
n_result=n_docel;return n_body&&(!n_result||(n_result>n_body))?n_body:n_result;}
function urlencode(str){var histogram={},histogram_r={},code=0,tmp_arr=[];var ret=str.toString();var replacer=function(search,replace,str){var tmp_arr=[];tmp_arr=str.split(search);return tmp_arr.join(replace);};histogram['!']='%21';histogram['%20']='+';ret=encodeURIComponent(ret);for(search in histogram){replace=histogram[search];ret=replacer(search,replace,ret)}
return ret.replace(/(\%([a-z0-9]{2}))/g,function(full,m1,m2){return"%"+m2.toUpperCase();});return ret;}
function urldecode(taigatodecode){return decodeURIComponent(taigatodecode);}
function getElementsByClassName(classname,node){if(!node)node=document.getElementsByTagName("body")[0];var a=[];var re=new RegExp('\\b'+classname+'\\b');var els=node.getElementsByTagName("*");for(var i=0,j=els.length;i<j;i++)
if(re.test(els[i].className))a.push(els[i]);return a;}
function taigastyleswitchsupplicant(taigaclass,taigasourceclass,taigatargetclass){var taigatoswitch=getElementsByClassName(taigaclass+taigasourceclass);var taigathings=new Array();for(var i=0;i<taigatoswitch.length;i++){taigathings.push(taigatoswitch[i]);}
for(var i=0;i<taigathings.length;i++){taigathings[i].className=taigaclass+taigatargetclass;}}
function taigastyleswitch(){var taigaatbottom=taigaloc();for(var arg=0;arg<arguments.length;arg++){var taigaclass=arguments[arg];taigastyleswitchsupplicant(taigaclass,'_hide','taigaintermediateclass');taigastyleswitchsupplicant(taigaclass,'_show','_hide');taigastyleswitchsupplicant(taigaclass,'taigaintermediateclass','_show');}
taigascroll(taigaatbottom);}
function taigastyleswitchnoscroll(){for(var arg=0;arg<arguments.length;arg++){var taigaclass=arguments[arg];taigastyleswitchsupplicant(taigaclass,'_hide','taigaintermediateclass');taigastyleswitchsupplicant(taigaclass,'_show','_hide');taigastyleswitchsupplicant(taigaclass,'taigaintermediateclass','_show');}}
function taigastyleswitchid(taigaid){var taigapaneclassnames=['newcategory','newboard','addboardmod','adduser','addgroup','usergroup','groupperms'];for(var arg=1;arg<arguments.length;arg++){var taigaclass=arguments[arg];for(var c=0;c<taigapaneclassnames.length;c++){var taigaswitchclass=taigapaneclassnames[c];var taigathings=getElementsByClassName(taigaswitchclass+'_show');for(var i=0;i<taigathings.length;i++){if(taigathings[i].id!=taigaclass+'_'+taigaid){taigathings[i].className=taigaswitchclass+'_hide';}}}
taigastyleswitchidsupplicant(taigaid,taigaclass);}}
function taigastyleswitchidsupplicant(taigaid,taigaclass){var taigathing=document.getElementById(taigaclass+'_'+taigaid);if(!taigathing){}else{taigathing.className=(taigathing.className==taigaclass+'_hide'?taigaclass+'_show':taigaclass+'_hide');}}
function taigastyleswitchidshow(taigaid,taigaclass){var taigathing=document.getElementById(taigaclass+'_'+taigaid);if(!taigathing){}else{taigathing.className=taigaclass+'_show';}}
function taigastyleswitchidhide(taigaid,taigaclass){var taigathing=document.getElementById(taigaclass+'_'+taigaid);if(!taigathing){}else{taigathing.className=taigaclass+'_hide';}}
function taigastyleswitchid2(taigaid){for(var arg=1;arg<arguments.length;arg++){var taigaclass=arguments[arg];var taigathingtohide=document.getElementById(taigaclass+'_show_'+taigaid);var taigathingtoshow=document.getElementById(taigaclass+'_hide_'+taigaid);if(taigathingtohide){taigathingtohide.className=taigaclass+'_hide';taigathingtohide.id=taigaclass+'_hide_'+taigaid;}
if(taigathingtoshow){taigathingtoshow.className=taigaclass+'_show';taigathingtoshow.id=taigaclass+'_show_'+taigaid;}}}
function taigastyleswitchid2show(taigaid){for(var arg=1;arg<arguments.length;arg++){var taigaclass=arguments[arg];var taigathingtoshow=document.getElementById(taigaclass+'_hide_'+taigaid);if(taigathingtoshow){taigathingtoshow.className=taigaclass+'_show';taigathingtoshow.id=taigaclass+'_show_'+taigaid;}}}
function taigastyleswitchid2hide(taigaid){for(var arg=1;arg<arguments.length;arg++){var taigaclass=arguments[arg];var taigathingtoshow=document.getElementById(taigaclass+'_show_'+taigaid);if(taigathingtoshow){taigathingtoshow.className=taigaclass+'_hide';taigathingtoshow.id=taigaclass+'_hide_'+taigaid;}}}
function taiganewpmto(taiganewpmto){document.getElementById('ajaxposttarget').innerHTML='<form name="newpmto" action="/private/threads.html" method="POST"><input type="hidden" name="newpmto" value="'+taiganewpmto+'" /></form>';document.newpmto.submit();}
function taigadeletecatfor(taigaid){var taigacode=taigaid.substring(0,1);var catboard='board';if('c'==taigacode){catboard='category';}
if(confirm(lang__delete_category_or_forum_confirmation_warning)){var taigaParams='taiga=admin&adminparams='+urlencode('deletecatfor='+taigaid);var xmlhttp=taigaNewAjax();xmlhttp.open("POST",taigaurlencodeexceptslashesifie(document.location.pathname),true);xmlhttp.setRequestHeader("Content-type","application/x-www-form-urlencoded");xmlhttp.onreadystatechange=function(){if(xmlhttp.readyState==4){taigastyleswitch('ajaxloading');if(xmlhttp.status==200){if(xmlhttp.responseText=='OK'){taigareloadwithlastreceivedpost(true);}else{alert(xmlhttp.responseText);}}else{alert(lang__sorry_an_error_occurred_please_try_your_request_again);}}}
taigastyleswitch('ajaxloading');xmlhttp.send(taigaParams);}}
function taigaeditcatfor(taigaid,taigafunc){var taigacode=taigaid.substring(0,1);var catboard='board';if(('c'==taigacode)&&((taigafunc!='new')||(taigaid=='cnew'))){catboard='category';}
var taiganame=document.getElementById('new'+catboard+'nameinput_'+taigaid).value.replace(/\&/g,'&amp;');if(taiganame==''){alert(lang__please_enter_a_forum_name);return false;}
var taigaParams='taiga=admin&adminparams='+urlencode('editcatfor='+taigaid+'&name='+taiganame);if(!(('c'==taigacode)&&((taigafunc!='new')||(taigaid=='cnew')))){taigaParams+=urlencode('&desc='+document.getElementById('new'+catboard+'descriptioninput_'+taigaid).value.replace(/\&/g,'&amp;')
+'&subboard='+(document.getElementById('new'+catboard+'subboardinput_'+taigaid).checked==true?1:0));}
var xmlhttp=taigaNewAjax();xmlhttp.open("POST",taigaurlencodeexceptslashesifie(document.location.pathname),true);xmlhttp.setRequestHeader("Content-type","application/x-www-form-urlencoded");xmlhttp.onreadystatechange=function(){if(xmlhttp.readyState==4){taigastyleswitch('ajaxloading');if(xmlhttp.status==200){if(xmlhttp.responseText=='OK'){taigareloadwithlastreceivedpost(true);}else{alert(xmlhttp.responseText);}}else{alert(lang__sorry_an_error_occurred_please_try_your_request_again);}}}
taigastyleswitch('ajaxloading');xmlhttp.send(taigaParams);}
function taigastyleswitchshow(){var taigaatbottom=taigaloc();for(var arg=0;arg<arguments.length;arg++){var taigaclass=arguments[arg];taigastyleswitchsupplicant(taigaclass,'_hide','_show');}
taigascroll(taigaatbottom);}
function taigastyleswitchshownoscroll(){for(var arg=0;arg<arguments.length;arg++){var taigaclass=arguments[arg];taigastyleswitchsupplicant(taigaclass,'_hide','_show');}}
function taigastyleswitchhide(){var taigaatbottom=taigaloc();for(var arg=0;arg<arguments.length;arg++){var taigaclass=arguments[arg];taigastyleswitchsupplicant(taigaclass,'_show','_hide');}
taigascroll(taigaatbottom);}
function taigastyleswitchhidenoscroll(){for(var arg=0;arg<arguments.length;arg++){var taigaclass=arguments[arg];taigastyleswitchsupplicant(taigaclass,'_show','_hide');}}
function taigahideotherssupplicant(taigaclass,taigaclasses){var taigaatbottom=taigaloc();for(var i=0;i<taigaclasses.length;i++){var taigatochange=getElementsByClassName(taigaclasses[i]+"_show");for(var j=0;j<taigatochange.length;j++){taigatochange[j].className=taigaclasses[i]+"_hide";}}
taigastyleswitchnoscroll(taigaclass);}
function taigahideothersusers(taigaclass,taigasort){var taigaParams='taiga=view&usersclass='+taigaclass+'&usersort='+taigasort;var xmlhttp=taigaNewAjax();xmlhttp.open("POST",taigaurlencodeexceptslashesifie(document.location.pathname),true);xmlhttp.setRequestHeader("Content-type","application/x-www-form-urlencoded");xmlhttp.onreadystatechange=function(){if(xmlhttp.readyState==4){taigastyleswitchnoscroll('ajaxloading');if(xmlhttp.status==200){document.getElementById('users_content').innerHTML=xmlhttp.responseText;var taigaclasses=new Array('byusername','bydateregged','byposition','bypostcount');taigahideotherssupplicant(taigaclass,taigaclasses);taigastyleswitchhidenoscroll('asc','desc');if('topfirst'==taigasort){taigastyleswitchshownoscroll('desc');}else{taigastyleswitchshownoscroll('asc');}}else{alert(lang__sorry_an_error_occurred_please_try_your_request_again);}}}
taigastyleswitchnoscroll('ajaxloading');xmlhttp.send(taigaParams);}
function taigahideothersgroupscat(taigaclass){var taigaclasses=new Array('byusername','bydateregged','byposition','bypostcount');taigahideotherssupplicant(taigaclass,taigaclasses);}
function taigagetwindowheight(){var taigaheight=0;if(self.innerHeight){taigaheight=self.innerHeight;}else if(document.documentElement&&document.documentElement.clientHeight){taigaheight=document.documentElement.clientHeight;}else if(document.body){taigaheight=document.body.clientHeight;}
return taigaheight;}
function taigagetwindowwidth(){var taigawidth=0;if(self.innerHeight){taigawidth=self.innerWidth;}else if(document.documentElement&&document.documentElement.clientWidth){taigawidth=document.documentElement.clientWidth;}else if(document.body){taigawidth=document.body.clientWidth;}
return taigawidth;}
function taigaloc(){var taigawindowheight=taigagetwindowheight();if(document.getElementById('staticheader')){return(f_scrollTop()+taigawindowheight>=(document.getElementById('staticpostscontainer').scrollHeight-1));}else{return(f_scrollTop()+taigawindowheight>=(document.getElementById('wholepagecontainer').scrollHeight-1));}}
function taigascrolltobottom(){if(document.getElementById('staticpostscontainer')){window.scroll(0,document.getElementById('staticpostscontainer').scrollHeight);}else{window.scroll(0,document.getElementById('wholepagecontainer').scrollHeight);}}
function taigascroll(taigaatbottom){if(taigaatbottom){taigascrolltobottom();}}
function taigasubmitpost(){document.getElementById('posttextarea').focus();if(taigacurrentlyuploadingattachments){alert(lang__you_must_wait_until_your_attachments_finish_uploading_to_post);return false;}
var rm="post";var taigatopictitle='';if(document.getElementById('posttitlearea')){if(document.getElementById('posttitlearea').value==''){alert(lang__please_enter_a_topic_title);return false;}
var taigastickyannouncement='3';if(document.getElementById('normalnewtopic')&&(document.getElementById('normalnewtopic').checked==true)){taigastickyannouncement='3';}else if(document.getElementById('stickynewtopic')&&(document.getElementById('stickynewtopic').checked==true)){taigastickyannouncement='2';}else if(document.getElementById('announcenewtopic')&&(document.getElementById('announcenewtopic').checked==true)){taigastickyannouncement='1';}
taigatopictitle='&title='+urlencode(document.getElementById('posttitlearea').value)
+'&stickyannouncement='+taigastickyannouncement;if(document.getElementById('staticcheckbox')){taigatopictitle+='&statictopic='+urlencode(document.getElementById('staticcheckbox').checked?'1':'0');}
rm="topic";}
var taigaan='';if(document.getElementById('postrecipientarea')){if(document.getElementById('postrecipientarea').value==''){alert(lang__please_enter_a_recipient);return false;}
taigaan='&an='+urlencode(document.getElementById('postrecipientarea').value);}
var taigaPollQuestion='';if(document.getElementById('pollquestion')){if(document.getElementById('pollquestion').value!=''){taigaPollQuestion=document.getElementById('pollquestion').value;}}
var taigaPollMaxvotes='';if(document.getElementById('maxvotes')){if(document.getElementById('maxvotes').value!=''){taigaPollMaxvotes=document.getElementById('maxvotes').value;}}
var taigaPollParams='';var taigaNumberOfPollParams=0;for(var i=1;i<=100;i++){if(document.getElementById('polloption'+i)){if(document.getElementById('polloption'+i).value!=''){taigaNumberOfPollParams++;taigaPollParams+='&polloption'+i+'='+document.getElementById('polloption'+i).value;}}else{break;}}
if((taigaNumberOfPollParams>0)&&(parseInt(taigaPollMaxvotes)>taigaNumberOfPollParams)){alert(lang__you_have_allowed_users_to_select_more_options_than_exist_in_this_poll);return false;}
var taigaPollParamsFinal='';if((taigaPollQuestion=='')&&((document.getElementById('editpollarea')&&(document.getElementById('editpollarea').className=='editpollarea_show'))||((taigaPollParams!='')&&(!document.getElementById('polloption1'))))){alert(lang__please_enter_a_poll_question);return false;}else if((taigaPollQuestion!='')&&(taigaPollParams=='')){alert(lang__please_enter_at_least_one_poll_option);return false;}else if((taigaPollQuestion!='')&&((parseInt(taigaPollMaxvotes)>100)||(parseInt(taigaPollMaxvotes)<1))){alert(lang__please_enter_a_maximum_number_of_items_to_vote_for);return false;}else if((taigaPollQuestion!='')&&(taigaPollParams!='')){taigaPollParamsFinal='&pollparams='+urlencode('pollquestion='+taigaPollQuestion+'&maxvotes='+taigaPollMaxvotes+taigaPollParams);}
if((taigaPollParamsFinal=='')&&(document.getElementById('posttextarea').value=='')&&!taigaattachments.length){alert(lang__please_enter_text_in_the_post_area);return false;}
var taigaguestusernamepart='';if(document.getElementById('guestusername')){if(document.getElementById('guestusername').value==''){alert(lang__please_enter_a_username);return false;}
taigaguestusernamepart='&guestusername='+urlencode(document.getElementById('guestusername').value);}
var taigaParams;var taigaAddingPoll=false;if((taigaPollParamsFinal!='')&&(rm=='post')){taigaAddingPoll=true;taigaParams='taiga='+urlencode(rm)+
taigaPollParamsFinal;}else{taigaParams='taiga='+urlencode(rm)+'&newpost='+urlencode(document.getElementById('posttextarea').value)+'&attachments='+urlencode(taigaattachments.join(','))+
taigatopictitle+
taigaan+
taigaguestusernamepart+
taigaPollParamsFinal;}
var xmlhttp=taigaNewAjax();xmlhttp.open("POST",taigaurlencodeexceptslashesifie(document.location.pathname),true);xmlhttp.setRequestHeader("Content-type","application/x-www-form-urlencoded");xmlhttp.onreadystatechange=function(){if(xmlhttp.readyState==4){taigastyleswitch('ajaxloading');document.getElementById('submitpost').disabled=false;if(xmlhttp.status==200){var taigamessages=xmlhttp.responseText.split("\n");taigamessages.reverse();if(taigamessages[0]=='OK'){if(taigaAddingPoll==true){taigareloadwithlastreceivedpost(true);return;}
taigamessages.reverse();if(!taigathisisthelastpage&&rm=="post"){if(taigamessages[0]!=''){document.location=taigamessages[0];}else{taigareloadwithlastreceivedpost(true);}
return;}
if(rm=="topic"&&taigamessages[0]!=''){document.location=taigamessages[0];return;}
if(rm=="topic"){if(document.getElementById('posttextarea')){document.getElementById('posttextarea').value='';}
if(document.getElementById('posttitlearea')){document.getElementById('posttitlearea').value='';}
if(document.getElementById('postrecipientarea')){document.getElementById('postrecipientarea').value='';}
taigastyleswitchhide('editpollarea');if(document.getElementById('haspoll')){document.getElementById('haspoll').checked=false;}
if(document.getElementById('pollquestion')){document.getElementById('pollquestion').value='';}
for(var i=1;i<=100;i++){if(document.getElementById('polloption'+i)){document.getElementById('polloption'+i).value='';}else{break;}}
if(document.getElementById('maxvotes')){document.getElementById('maxvotes').selectedIndex=0;}}
taigaattachments=[];for(var taigaattachmentnumber=1;taigaattachmentnumber<=taiganumberofattachmentboxes;taigaattachmentnumber++){if(taigaattachmentnumber>1){taigastyleswitchidhide(taigaattachmentnumber,'attachuploadcontainer');}
taigastyleswitchid2show(taigaattachmentnumber,'attachouter');if(document.getElementById('attachmentcomplete'+taigaattachmentnumber)){document.getElementById('attachmentcomplete'+taigaattachmentnumber).innerHTML='';}
if(document.getElementById('attachment_file_input_'+taigaattachmentnumber)){document.getElementById('attachment_file_input_'+taigaattachmentnumber).value='';document.getElementById('attachment_file_input_'+taigaattachmentnumber).style.display='block';}
taigastyleswitchidshow(taigaattachmentnumber,'addattachment');taigastyleswitchid2hide(taigaattachmentnumber,'attachment_delete_button');}
taigastyleswitchhide('newattach');if(document.getElementById('postpreviewarea')){document.getElementById('postpreviewarea').innerHTML='';}
if(rm=="post"){taigascrolltobottom();}
taigatemppostext='';taigapollajaxtimeouti=0;taigapollajaxtimeout=10;}else{if(!(document.getElementById('posttitlearea'))){taigarestorepostext(taigatemppostext);}
alert(xmlhttp.responseText);}}else{if(!(document.getElementById('posttitlearea'))){taigarestorepostext(taigatemppostext);}
alert(lang__sorry_an_error_occurred_please_try_your_request_again);}}}
taigastyleswitch('ajaxloading');document.getElementById('submitpost').disabled=true;xmlhttp.send(taigaParams);taigatemppostext=document.getElementById('posttextarea').value;if(rm=="post"){document.getElementById('posttextarea').value='';}}
function taigarestorepostext(taigatemppostext){if(document.getElementById('posttextarea').value!=''){document.getElementById('posttextarea').value=taigatemppostext+"\n\n"+document.getElementById('posttextarea').value;}else{document.getElementById('posttextarea').value=taigatemppostext;}}
function taigaopenunreadintabs(){var taigalink=taiganewpostlinks.shift();var taigaopened=false;while(taigalink){taigaopened=true;window.open(taigalink,'_blank');taigalink=taiganewpostlinks.shift();}
if(taigaopened&&taigainunreadview){setTimeout(function(){taigareloadwithlastreceivedpost(true);},5000);}}
function taigalogin(){var xmlhttp=taigaNewAjax();var taigaParams='taiga=log_in'+'&sern='+urlencode(document.getElementById('loginusernameinput').value)+'&sabrac='+urlencode(document.getElementById('loginpasswordinput').value)+'&rememberme='+(document.getElementById('rememberme').checked==true?1:0);xmlhttp.open("POST",taigaurlencodeexceptslashesifie(document.location.pathname),true);xmlhttp.setRequestHeader("Content-type","application/x-www-form-urlencoded");xmlhttp.onreadystatechange=function(){if(xmlhttp.readyState==4){taigastyleswitch('ajaxloading');if(xmlhttp.status==200){if(xmlhttp.responseText=='OK'){taigareloadwithlastreceivedpost(true);}else{alert(xmlhttp.responseText);}}else{alert(lang__sorry_an_error_occurred_please_try_your_request_again);}}}
taigastyleswitch('ajaxloading');xmlhttp.send(taigaParams);}
function taigalogout(){if(confirm(lang__do_you_really_want_to_log_out)){var xmlhttp=taigaNewAjax();var taigaParams='taiga=log_out';xmlhttp.open("POST",taigaurlencodeexceptslashesifie(document.location.pathname),true);xmlhttp.setRequestHeader("Content-type","application/x-www-form-urlencoded");xmlhttp.onreadystatechange=function(){if(xmlhttp.readyState==4){taigastyleswitch('ajaxloading');if(xmlhttp.status==200){if(xmlhttp.responseText=='OK'){document.location='/';}else{alert(xmlhttp.responseText);}}else{alert(lang__sorry_an_error_occurred_please_try_your_request_again);}}}
taigastyleswitch('ajaxloading');xmlhttp.send(taigaParams);}}
function taigaregister(){if(document.getElementById('registerusernameinput').value==''){alert(lang__please_choose_a_username);return false;}
if(document.getElementById('registeremailinput').value==''){alert(lang__please_enter_an_email_address);return false;}
if(document.getElementById('registerpasswordinput').value.length<4){alert(lang__sorry_the_password_is_not_long_enough);return false;}
if(document.getElementById('registerpasswordinput').value!=document.getElementById('registerpasswordinputconfirm').value){alert(lang__password_fields_dont_match);return false;}
var taigaParams='taiga=register'+'&sern='+urlencode(document.getElementById('registerusernameinput').value)+'&sabrac='+urlencode(document.getElementById('registerpasswordinput').value)+'&email='+urlencode(document.getElementById('registeremailinput').value);var xmlhttp=taigaNewAjax();xmlhttp.open("POST",taigaurlencodeexceptslashesifie(document.location.pathname),true);xmlhttp.setRequestHeader("Content-type","application/x-www-form-urlencoded");xmlhttp.onreadystatechange=function(){if(xmlhttp.readyState==4){taigastyleswitch('ajaxloading');if(xmlhttp.status==200){var taigamessages=xmlhttp.responseText.split("\n");taigamessages.reverse();if(taigamessages[0]=='OK'){alert(lang__your_profile_has_been_created__you_can_now_customize_your_profile_or_just_start_posting);taigamessages.reverse();document.location=taigamessages[0];}else{alert(xmlhttp.responseText);}}else{alert(lang__sorry_an_error_occurred_please_try_your_request_again);}}}
taigastyleswitch('ajaxloading');xmlhttp.send(taigaParams);}
function taigachangepassword(taigaform){if(taigaform.password){if(taigaform.password.value==''){alert(lang__please_enter_your_current_password);return false;}}
if(taigaform.newpassword1.value!=taigaform.newpassword2.value){alert(lang__password_fields_dont_match);return false;}
if(taigaform.newpassword1.value.length<4){alert(lang__new_password_is_not_long_enough);return false;}
var taigaParams='taiga=changepassword'+'&newpassword1='+urlencode(taigaform.newpassword1.value)+'&newpassword2='+urlencode(taigaform.newpassword2.value);if(taigaform.password){taigaParams+='&password='+urlencode(taigaform.password.value);}
var xmlhttp=taigaNewAjax();xmlhttp.open("POST",taigaurlencodeexceptslashesifie(document.location.pathname),true);xmlhttp.setRequestHeader("Content-type","application/x-www-form-urlencoded");xmlhttp.onreadystatechange=function(){if(xmlhttp.readyState==4){taigastyleswitch('ajaxloading');if(xmlhttp.status==200){if(xmlhttp.responseText=='OK'){taigareloadwithlastreceivedpost(true);}else{alert(xmlhttp.responseText);}}else{alert(lang__sorry_an_error_occurred_please_try_your_request_again);}}}
taigastyleswitch('ajaxloading');xmlhttp.send(taigaParams);}
function taigapageselectchange(taigaselect){document.location=taigaselect.value;}
function taigalock(taigafunc,taigatarget){taigasticky(taigafunc,taigatarget);}
function taigastatic(taigafunc){taigasticky(taigafunc);}
function taigaannounce(taigafunc){taigasticky(taigafunc);}
function taigasticky(taigafunc,taigatarget){if(!taigatarget){taigatarget=document.location.pathname;}
var taigaParams='taiga='+taigafunc;var xmlhttp=taigaNewAjax();xmlhttp.open("POST",taigaurlencodeexceptslashesifie(taigatarget),true);xmlhttp.setRequestHeader("Content-type","application/x-www-form-urlencoded");xmlhttp.onreadystatechange=function(){if(xmlhttp.readyState==4){taigastyleswitch('ajaxloading');if(xmlhttp.status==200){var taigamessages=xmlhttp.responseText.split("\n");taigamessages.reverse();if(taigamessages[0]=='OK'){if(taigafunc=='lock'||taigafunc=='unlock'){taigastyleswitch('lockbutton');}else if(taigafunc=='sticky'||taigafunc=='unsticky'){taigastyleswitch('stickybutton');}else if(taigafunc=='announce'||taigafunc=='unannounce'){taigastyleswitch('announcebutton');}}else if(taigamessages[0]=='OKRELOAD'){taigareloadwithlastreceivedpost(true);}else{alert(xmlhttp.responseText);}}else{alert(lang__sorry_an_error_occurred_please_try_your_request_again);}}}
taigastyleswitch('ajaxloading');xmlhttp.send(taigaParams);}
function taigamodmultiple(taigafunc,taigadest){var taigapostboxes=getElementsByClassName('modbox');var taigaposts=new Array();for(var i=0;i<taigapostboxes.length;i++){if(taigapostboxes[i].checked==true){taigaposts.push(taigapostboxes[i].name);}}
taigamod(taigafunc,taigaposts,taigadest);}
function taigamod(taigafunc,taigaposts,taigadest){var taigaParams='taiga='+taigafunc;if('merge'==taigafunc){var taigamergetopicappend='';var mergefunc=taigafunc;if(taigaposts===undefined){taigaposts=[];mergefunc='mergetopic';taigamergetopicappend='single';taigaParams+='&type=mergewholetopic';}
if(!document.getElementById('mergefromchecked')){mergefunc='mergetopic';taigaParams+='&type=mergewholetopic';if(document.getElementById('mergedtopictitleinput'+taigamergetopicappend).value==''){alert(lang__please_enter_a_new_title);return;}
taigaParams+='&newtitle='+urlencode(document.getElementById('mergedtopictitleinput'+taigamergetopicappend).value)
+'&title=mergenewtitle';}
taigaParams+='&taigafunc='+mergefunc;if((document.getElementById('mergedtopictitleinput'+taigamergetopicappend)&&(document.getElementById('mergedtopictitleinput'+taigamergetopicappend).value==''))&&((document.getElementById('mergenewtitle'+taigamergetopicappend))&&(document.getElementById('mergenewtitle'+taigamergetopicappend).checked==true))){alert(lang__please_enter_a_new_title);return;}
if((taigaposts.length>1)&&document.getElementById('mergefromchecked')&&(document.getElementById('mergefromchecked').checked==true)){alert(lang__please_check_only_one_post_from_which_to_start_merging_away_posts);return;}
if((taigaposts.length==0)&&(mergefunc!='mergetopic')){alert(lang__to_use_this_function_please_select_some_posts_by_clicking_their_checkboxes);return;}
if(((document.getElementById('destinationtopictitleinput'+taigamergetopicappend))&&(document.getElementById('destinationtopictitleinput'+taigamergetopicappend).value==''))){alert(lang__please_enter_the_url_of_the_destination_topic);return;}
if(taigaposts.length==0){var taigapostboxes=getElementsByClassName('modbox');for(var i=0;i<taigapostboxes.length;i++){taigaposts.push(taigapostboxes[i].name);}}
if(document.getElementById('destinationtopictitleinput'+taigamergetopicappend)){taigaParams+='&dest='+urlencode(document.getElementById('destinationtopictitleinput'+taigamergetopicappend).value);}else{taigaParams+='&dest='+urlencode(taigaposts.shift());if(taigaposts.length==0){alert(lang__please_select_more_than_one_topic_to_merge);return;}}
var taigamergeradiostype=['mergefromchecked','mergeallchecked','mergewholetopic'];for(var i=0;i<taigamergeradiostype.length;i++){if(document.getElementById(taigamergeradiostype[i])){if(document.getElementById(taigamergeradiostype[i]).checked==true){taigaParams+='&type='+urlencode(taigamergeradiostype[i]);}}}
var taigamergeradiostitle=['mergedestinationtitle','mergethistitle','mergenewtitle'];for(var i=0;i<taigamergeradiostitle.length;i++){if(document.getElementById(taigamergeradiostitle[i]+taigamergetopicappend)){if(document.getElementById(taigamergeradiostitle[i]+taigamergetopicappend).checked==true){taigaParams+='&title='+urlencode(taigamergeradiostitle[i]);if(taigamergeradiostitle[i]=='mergenewtitle'){if(document.getElementById('mergedtopictitleinput'+taigamergetopicappend)){taigaParams+='&newtitle='+urlencode(document.getElementById('mergedtopictitleinput'+taigamergetopicappend).value);}}}}}
taigaParams+='&posts='+urlencode(taigaposts.join(','));taigamodsupplicant(taigafunc,taigaParams,document.location,true);}else if('split'==taigafunc){taigaParams='taiga=merge';taigaParams+='&taigafunc='+taigafunc;if(document.getElementById('splittopictitleinput').value==''){alert(lang__please_enter_a_new_title);return;}
if((taigaposts.length>1)&&(document.getElementById('splitfromchecked').checked==true)){alert(lang__please_check_only_one_post_from_which_to_start_merging_away_posts);return;}
if(taigaposts.length==0){alert(lang__to_use_this_function_please_select_some_posts_by_clicking_their_checkboxes);return;}
taigaParams+='&dest='+urlencode(document.getElementById('splitdestselect').value);var taigamergeradiostype=['splitfromchecked','splitallchecked'];for(var i=0;i<taigamergeradiostype.length;i++){if(document.getElementById(taigamergeradiostype[i])){if(document.getElementById(taigamergeradiostype[i]).checked==true){taigaParams+='&type='+urlencode(taigamergeradiostype[i]);}}}
if(document.getElementById('splittopictitleinput')){taigaParams+='&newtitle='+urlencode(document.getElementById('splittopictitleinput').value);}
taigaParams+='&posts='+urlencode(taigaposts.join(','));taigamodsupplicant(taigafunc,taigaParams,document.location,true);}else if('move'==taigafunc){taigaParams+='&dest='+taigadest;if(document.getElementById('movetopicsarea2')){if(taigaposts.length==0){alert(lang__to_use_this_function_please_select_some_posts_by_clicking_their_checkboxes);return;}}else{taigaposts.push(document.location.toString());}
for(var i=0;i<taigaposts.length;i++){taigamodsupplicant(taigafunc,taigaParams,taigaposts[i],(i==(taigaposts.length-1)));}}else{if(taigaposts.length==0){alert(lang__to_use_this_function_please_select_some_posts_by_clicking_their_checkboxes);return;}
if(typeof taigaposts=="string"){if(!confirm(lang__really_delete_post)){return false;}}
taigamodsupplicant(taigafunc,taigaParams,taigaposts,true,false);}}
function taigamodsupplicant(taigafunc,taigaParams,taigapost,taigalast,taigareloadwhendone){if(typeof taigapost!="string"&&(taigafunc=='deletepost'||taigafunc=='deletetopic')){taigareloadwhendone=true;taigaParams+='&posts='+taigapost.join('-');taigapost=taigapost[0];}
var xmlhttp=taigaNewAjax();xmlhttp.open("POST",taigaurlencodeexceptslashesifie(taigapost),true);xmlhttp.setRequestHeader("Content-type","application/x-www-form-urlencoded");xmlhttp.onreadystatechange=function(){if(xmlhttp.readyState==4){if(taigafunc!='deletepost'){taigastyleswitch('ajaxloading');}else{}
if(xmlhttp.status==200){var taigamessages=xmlhttp.responseText.split("\n");taigamessages.reverse();if(taigamessages[0]=='OK'){taigamessages.reverse();if(taigalast==true){if(taigafunc!='deletepost'){alert(lang__success);}
if(taigafunc!='deletepost'){if(taigamessages[0]!=''){document.location=taigamessages[0];}else{document.location='/';}}
if(taigareloadwhendone){taigareloadwithlastreceivedpost(true);}
taigastyleswitchhide('deleteposts');}}else{if(taigafunc=='deletepost'){taigastyleswitchid2(taigapost,'deletepostloading');}
alert(taigamessages[0]);}}else{alert(lang__sorry_an_error_occurred_please_try_your_request_again);}}}
if(taigafunc!='deletepost'){taigastyleswitch('ajaxloading');}else{taigastyleswitchid2(taigapost,'deletepostloading');}
xmlhttp.send(taigaParams);}
function taigacheckall(taigabox){var taigaboxes=getElementsByClassName(taigabox.name);for(var i=0;i<taigaboxes.length;i++){taigaboxes[i].checked=taigabox.checked;}}
function taigaviewsettings(taigachanged){var taigaParams='taiga=setprefs';var taigachangedvalue=taigachanged.value;if(taigachanged.type=='checkbox'){taigachangedvalue=(taigachanged.checked==true)?1:0;if(taigachanged.name=='ipbasedsessions'){taigachangedvalue=(taigachangedvalue==0?1:0);}}
taigaParams+='&'+taigachanged.name+'='+taigachangedvalue;var xmlhttp=taigaNewAjax();xmlhttp.open("POST",taigaurlencodeexceptslashesifie(document.location.pathname),true);xmlhttp.setRequestHeader("Content-type","application/x-www-form-urlencoded");xmlhttp.onreadystatechange=function(){if(xmlhttp.readyState==4){if(xmlhttp.status==200){if(xmlhttp.responseText=='OK'){if(/^(?:ipbasedsessions|autoshowpostbox)/.test(taigachanged.name)){}else{taigareloadwithlastreceivedpost(true);}}else{alert(xmlhttp.responseText);return false;}}else{alert(lang__sorry_an_error_occurred_please_try_your_request_again);return false;}}}
xmlhttp.send(taigaParams);}
function taigachangestyle(taigastyle){var taigaParams='taiga=setprefs&style='+taigastyle;var xmlhttp=taigaNewAjax();xmlhttp.open("POST",taigaurlencodeexceptslashesifie(document.location.pathname),true);xmlhttp.setRequestHeader("Content-type","application/x-www-form-urlencoded");xmlhttp.onreadystatechange=function(){if(xmlhttp.readyState==4){if(xmlhttp.status==200){if(xmlhttp.responseText=='OK'){taigareloadwithlastreceivedpost(true);}else{alert(xmlhttp.responseText);return false;}}else{alert(lang__sorry_an_error_occurred_please_try_your_request_again);return false;}}}
xmlhttp.send(taigaParams);}
function taigajsonmessagevent(taigamessages){for(var i=0;i<taigamessages.length;i++){var taigamessage=taigamessages[i];if(taigamessage.postviewevent){taigamessagequeue.push(taigamessage.payload);continue;}
switch(taigamessage.event){case'unreadpost':if(taigainunreadview==true){if(taigafirsttime<=0){if(taigaunreadhash!=taigamessage.hash){}}else{taigafirsttime--;}
taigaunreadhash=taigamessage.hash;taigatitle=taigamessage.payload+' '+(taigamessage.payload!=1?lang__threads_with_unread_posts:lang__thread_with_unread_posts);taigasetwindowtitle(taigatitle);}
taiganewpostlinks=taigamessage.urls;break;case'threadupdatedforboardview':if(taigamessage.injectionfield&&!document.getElementById(taigamessage.injectionfield)&&taigamessage.threadtype&&document.getElementById('taiga_boardview_threads_container')&&taigamessage.text=='last page '){var taigathreads=document.getElementById('taiga_boardview_threads_container').innerHTML;var taigainjectpoint=0;var taigasplitstring='<!--taigathread-->';if(taigamessage.threadtype!='announcement'){var taigathreadsarr=taigathreads.split(taigasplitstring);taigainjectpoint+=taigathreadsarr[0].length;for(var taigathread=1;taigathread<taigathreadsarr.length;taigathread++){var taigamatches=taigathreadsplitregexp.exec(taigathreadsarr[taigathread]);if(taigamatches.length!=null&&taigamessage.threadtype==taigamatches[1]){break;}else{taigainjectpoint+=taigasplitstring.length+taigathreadsarr[taigathread].length;}}}
document.getElementById('taiga_boardview_threads_container').innerHTML=taigathreads.substring(0,taigainjectpoint)
+taigasplitstring
+'<div id="threadcontainer_'+taigamessage.tid+'" class="taiga_thread_'+taigamessage.threadtype+'">'+taigamessage.payload+'</div>'
+taigathreads.substring(taigainjectpoint);continue;}else if(taigamessage.injectionfield&&document.getElementById(taigamessage.injectionfield)&&!taigamessage.threadtype){document.getElementById('threadcontainer_'+taigamessage.tid).style.display='none';continue;}
break;}
if(taigamessage.injectionfield&&document.getElementById(taigamessage.injectionfield)){document.getElementById(taigamessage.injectionfield).innerHTML=taigamessage.payload;}
switch(taigamessage.event){case'usersonline':taigauserlistonlineheightset();break;}}}
function taigapoll(){taigapollajaxtimeouti=0;taigapollajaxtimeout=taigapollajaxtimeoutoriginal;var taigaParams='taiga=poll&lastpolleventid='+taigalastpolleventid.toString()+'&lastpage='+(taigathisisthelastpage?'1':'0')+'&firstime='+taigafirstime;taigafirstime='0';taigapollajax=taigaNewAjax();var taigaposto=document.location.pathname;var taigamatches=taigapathumanregex.exec(document.location);if(taigamatches!=null){taigaposto='/'+taigamatches[1]+'/'+taigamatches[3]+'.html';}
taigapollajax.open("POST",taigaurlencodeexceptslashesifie(taigaposto),true);taigapollajax.setRequestHeader("Content-type","application/x-www-form-urlencoded");taigapollajax.onreadystatechange=function(){if(taigapollajax.readyState==4){if(taigapollajax.status==200&&taigapollajax.responseText){if('taigakillswitch'==taigapollajax.responseText){return;}else if('taigareload'==taigapollajax.responseText){taigareloadwithlastreceivedpost(true);return;}else if('error: human data not found!'==taigapollajax.responseText){taigaredirecting='1';alert(lang__all_posts_on_this_page_have_disappeared__redirecting_you_to_the_index);document.location='/';}
var taigaresponsetext=taigapollajax.responseText;var taigaresponsearr=taigaresponsetext.split("\n");var oldtaigalastpolleventid=taigalastpolleventid;taigalastpolleventid=parseInt(taigaresponsearr[0]);if(!taigalastpolleventid){taigalastpolleventid=oldtaigalastpolleventid;}
taigaresponsetext=taigaresponsetext.substring(taigaresponsearr[0].length+1);var taigajson;try{taigajson=JSON.parse(taigaresponsetext);}catch(e){}
if(taigajson){taigajsonmessagevent(taigajson);}
if(taigaredirecting!='1'){setTimeout("taigapoll()",500);}}else{setTimeout("taigapoll()",5000);}}}
taigapollajax.send(taigaParams);}
function taigapollajaxtimeoutinc(){taigapollajaxtimeouti++;if(taigapollajaxtimeouti>taigapollajaxtimeout){taigapollajaxtimeouti=0;taigapollajaxtimeout=taigapollajaxtimeoutoriginal;if(taigapollajax){taigapollajax.abort();}}
setTimeout("taigapollajaxtimeoutinc()",1000);}
var taigasavedkillinc=0;function taigaprocessmessages(){if(!taigacurrentlyeditingpost){if(taigamessagequeue.length){while(taigamessagequeue.length){var xmlhttpresponseText=taigamessagequeue.shift();var taigamessages=xmlhttpresponseText.split('<!--message-->');taigamessages.sort();taigamessages.reverse();for(var taigamessage=0;taigamessage<taigamessages.length;taigamessage++){var taigaresponsearr=taigamessages[taigamessage].split("\n");var firstfield=parseInt(taigaresponsearr[1]);var secondfield=parseInt(taigaresponsearr[2]);var thirdfield=parseInt(taigaresponsearr[3]);if((firstfield==0)&&(secondfield>0)){var taigaatbottom=taigaloc();taigastyleswitchhidenoscroll('postcheckboxes','postcheckboxfuncs');var taigakillinc=taigasavedkillinc-1;while(++taigakillinc<1000){if(document.getElementById('postdivnum'+taigakillinc).className!='blank'){break;}}
if(taigakillinc==1000){taigakillinc=0;}
taigasavedkillinc=taigakillinc;if(getElementsByClassName('filled').length>=thirdfield){var taigatoscroll=f_scrollTop();for(var taigapostskilled=0;taigapostskilled<secondfield;taigapostskilled++){taigatoscroll-=document.getElementById('postdivnum'+taigakillinc).offsetHeight;document.getElementById('postdivnum'+taigakillinc).className='blank';document.getElementById('postdivnum'+taigakillinc).innerHTML='';taigakillinc++;}
if(taigatoscroll&&taigatoscroll>0&&!taigaatbottom){window.scroll(0,taigatoscroll);}
while((document.getElementById('postdivnum'+taigakillinc).className=='blank')&&(taigakillinc<1000)){taigakillinc++;}
document.getElementById('postdivnum'+taigakillinc).innerHTML=document.getElementById('postdivnum'+taigakillinc).innerHTML.replace(/<(?:div|DIV) class="newpagemarker"><\/(?:div|DIV)>/g,'');}
while(document.getElementById('postdivnum'+taigakillinc).className!='blank'){if(taigakillinc>=(1000-secondfield)){taigareloadwithlastreceivedpost(true);}
taigakillinc++;}
var taigapostmessages=taigamessages[taigamessage].split('<!--taiga-->');taigapostmessages.shift();var taigapostsreplaced=0;while(taigapostsreplaced<taigapostmessages.length){if(taigakillinc>=(1000-secondfield)){taigareloadwithlastreceivedpost(true);}
document.getElementById('postdivnum'+taigakillinc).className='filled';document.getElementById('postdivnum'+taigakillinc).innerHTML=taigapostmessages[taigapostsreplaced];taigakillinc++;taigapostsreplaced++;}
if(taigaresponsearr[5]!=taigaloggedinuid){taiganewposts+=secondfield;taigasetitle();}
var taigapostsonpage=getElementsByClassName('taiga_postview_human');taigapostsonpage.reverse();document.location.hash=taigapostsonpage[0].name+'-';taigascroll(taigaatbottom);if(taigaatbottom){setTimeout('taigascrolltobottom()',200);}
taigastaticpostspaddingset();}else if(firstfield==1){document.getElementById('pages').innerHTML=taigamessages[taigamessage];}else if(firstfield==2){document.getElementById('userssection').innerHTML=taigamessages[taigamessage];var taigauserlistusernames=getElementsByClassName('entering');for(var i=0;i<taigauserlistusernames.length;i++){taiganimate('fadein',taigauserlistusernames[i],0,2000);}
taigauserlistusernames=getElementsByClassName('leaving');for(var i=0;i<taigauserlistusernames.length;i++){taiganimate('fadeout',taigauserlistusernames[i],0,2000);}
taigauserlistonlineheightset();}else if(firstfield==3){document.getElementById('viewsettingscontainer').innerHTML=taigamessages[taigamessage];}else if(firstfield==4){var taigahumantodel=taigaresponsearr.slice(6).join('');if(document.getElementById('edittextlargebox_'+taigahumantodel+'editbox')){var taigafounditanddeletedit=false;var taigaposts=getElementsByClassName('filled');for(var i=0;i<taigaposts.length;i++){var taigamatches=taigaposthumanregex.exec(taigaposts[i].innerHTML);if(taigamatches!=null){var posthuman=taigamatches[2];if(posthuman==taigahumantodel){taigafounditanddeletedit=true;taigaposts[i].className='deleted';taigaposts[i].innerHTML='';i=taigaposts.length;}}}
if(!taigafounditanddeletedit){taigareloadwithlastreceivedpost(true);}}}else if(firstfield==5){var taigaatbottom=taigaloc();var taigahumantoedit=taigaresponsearr[2];var taigabbencodedpostext=taigaresponsearr[3];var taigarawpostext=taigaresponsearr.slice(6).join("\n");if(document.getElementById('edittextlargebox_'+taigahumantoedit+'editbox')){var taigaeditbox=document.getElementById('edittextlargebox_'+taigahumantoedit+'editbox');if(taigaie){taigarawpostext=taigaunescapehtml(taigarawpostext);taigaeditbox.value=taigarawpostext;}else{taigaeditbox.innerHTML=taigarawpostext;}
var taigabbcodetarget=document.getElementById('edit_hide_'+taigahumantoedit);if(taigaeditbox.parentNode==taigabbcodetarget){taigabbcodetarget=document.getElementById('edit_show_'+taigahumantoedit);}
taigabbcodetarget.innerHTML=taigabbencodedpostext;}
taigascroll(taigaatbottom);}else if(firstfield==6){var taigaatbottom=taigaloc();var taigahumantoedit=taigaresponsearr[2];var taigaedithistory=taigaresponsearr.slice(6).join('');if(document.getElementById('edithistoryparent_'+taigahumantoedit)){var taigaeditbox=document.getElementById('edithistoryparent_'+taigahumantoedit).innerHTML=taigaedithistory;}
taigascroll(taigaatbottom);}}}
var taigafoundpost='0';for(var p=0;p<1000;p++){if(document.getElementById('postdivnum'+p).className=='filled'){taigafoundpost='1';break;}}
if((taigafoundpost!='1')&&(!document.getElementById('staticfirstpost'))){taigaredirecting='1';alert(lang__all_posts_on_this_page_have_disappeared__redirecting_you_to_the_index);document.location='/';}}}
if(taigaredirecting=='0'){setTimeout('taigaprocessmessages()',100);}}
function taigatest(taigathing){for(var i=0;i<taigathing.parentNode.parentNode.childNodes.length;i++){alert(taigathing.parentNode.parentNode.childNodes[i].tagName);}}
function taigadelay(taigadelay,taigafunc,taigaarg){setTimeout(taigafunc+'("'+taigaarg+'")',taigadelay*1000);}
function taigastyleswitchsetpref(taigatoswitch,taigapref){taigastyleswitch(taigatoswitch);var taigaParams='taiga=setprefs';var taigachangedvalue=(getElementsByClassName(taigatoswitch+'_show').length>getElementsByClassName(taigatoswitch+'_hide').length)?1:0;taigaParams+='&'+taigapref+'='+taigachangedvalue;var xmlhttp=taigaNewAjax();xmlhttp.open("POST",taigaurlencodeexceptslashesifie(document.location.pathname),true);xmlhttp.setRequestHeader("Content-type","application/x-www-form-urlencoded");xmlhttp.send(taigaParams);taigastaticheightset();taigastaticpostmaxheightset();taigastaticpostspaddingset();}
function taigastyleswitchsetprefnoscroll(taigatoswitch,taigapref){taigastyleswitchnoscroll(taigatoswitch);var taigaParams='taiga=setprefs';var taigachangedvalue=(getElementsByClassName(taigatoswitch+'_show').length>getElementsByClassName(taigatoswitch+'_hide').length)?1:0;taigaParams+='&'+taigapref+'='+taigachangedvalue;var xmlhttp=taigaNewAjax();xmlhttp.open("POST",taigaurlencodeexceptslashesifie(document.location.pathname),true);xmlhttp.setRequestHeader("Content-type","application/x-www-form-urlencoded");xmlhttp.send(taigaParams);taigastaticheightset();taigastaticpostmaxheightset();taigastaticpostspaddingset();}
function taigaautosave(taigadoitagain){if(!document.getElementById('posttextarea')||document.getElementById('posttitlearea')){return false;}
if(taigainputext==document.getElementById('posttextarea').value){if(taigadoitagain){setTimeout("taigaautosave(true)",taigaautosaveinterval);}
return false;}
taigainputext=document.getElementById('posttextarea').value;var taigaParams='taiga=autosave&mode=newpost&data='+urlencode(taigainputext);var xmlhttp=taigaNewAjax();xmlhttp.open("POST",taigaurlencodeexceptslashesifie(document.location.pathname),true);xmlhttp.setRequestHeader("Content-type","application/x-www-form-urlencoded");xmlhttp.send(taigaParams);if(taigadoitagain){setTimeout("taigaautosave(true)",taigaautosaveinterval);}}
function taigaadminpane(taigapanename){if(taigapanename==''){return false;}
var taigaclasses=new Array('globalcat','tapcat','boardscat','groupscat','stylescat');taigahideotherssupplicant(taigapanename,taigaclasses);var taigaParams='taiga=setprefs&adminpane='+taigapanename;var xmlhttp=taigaNewAjax();xmlhttp.open("POST",taigaurlencodeexceptslashesifie(document.location.pathname),true);xmlhttp.setRequestHeader("Content-type","application/x-www-form-urlencoded");xmlhttp.send(taigaParams);}
function taigagotoadminpane(taigapanename){document.getElementById('ajaxposttarget').innerHTML='<form name="newpmto" action="/admin/admin.html" method="POST"><input type="hidden" name="newpmto" value="'+taigapanename+'" /></form>';document.newpmto.submit();}
function taigamarkallread(taigatime,taigafid){var taigaParams='taiga=markallread&time='+urlencode(taigatime)+'&fid='+urlencode(taigafid);var xmlhttp=taigaNewAjax();xmlhttp.open("POST",taigaurlencodeexceptslashesifie(document.location.pathname),true);xmlhttp.setRequestHeader("Content-type","application/x-www-form-urlencoded");xmlhttp.onreadystatechange=function(){if(xmlhttp.readyState==4){taigastyleswitch('ajaxloading');if(xmlhttp.status==200){var taigamessages=xmlhttp.responseText.split("\n");if(taigamessages[0]=='OK'){taigareloadwithlastreceivedpost(true);}else{alert(xmlhttp.responseText);}}else{alert(lang__sorry_an_error_occurred_please_try_your_request_again);}}}
taigastyleswitch('ajaxloading');xmlhttp.send(taigaParams);}
function taigaeditthispost(taigahuman,taigaclass){if(taigacheckparentsforid(document.getElementById('edittextlargebox_'+taigahuman+'editbox'),'edit_show_'+taigahuman)){taigacurrentlyeditingpost++;taigalastextarea='edittextlargebox_'+taigahuman+'editbox';}else{taigacurrentlyeditingpost--;taigalastextarea='posttextarea';}
var taigaatbottom=taigaloc();taigastyleswitchid2(taigahuman,taigaclass);taigascroll(taigaatbottom);taigastaticheightset();}
function taigacheckparentsforid(taigaobject,taigaid){while(taigaobject.parentNode){if(taigaobject==document.getElementById(taigaid)){return true;}
taigaobject=taigaobject.parentNode}
return false;}
function taigaeditpost(taigaid){var taigatext=document.getElementById('edittextlargebox_'+taigaid+'editbox').value;if(taigatext==''){alert(lang__please_enter_text_in_the_post_area);return false;}
var taigaParams='taiga=editpost&human='+urlencode(taigaid)+'&postext='+urlencode(taigatext);if(document.getElementById(taigaid+'posttitlearea')){if(document.getElementById(taigaid+'posttitlearea').value==''){alert(lang__please_enter_a_topic_title);return false;}
taigaParams+='&title='+urlencode(document.getElementById(taigaid+'posttitlearea').value);if(document.getElementById(taigaid+'defaultlitecheckbox')){taigaParams+='&defaultlite='+urlencode(document.getElementById(taigaid+'defaultlitecheckbox').checked?'1':'0');}}
if(document.getElementById('editpostusername_'+taigaid)&&document.getElementById('editpostusername_'+taigaid).value!=''){taigaParams+='&editpostusername='+urlencode(document.getElementById('editpostusername_'+taigaid).value);}
var xmlhttp=taigaNewAjax();xmlhttp.open("POST",taigaurlencodeexceptslashesifie(document.location.pathname),true);xmlhttp.setRequestHeader("Content-type","application/x-www-form-urlencoded");xmlhttp.onreadystatechange=function(){if(xmlhttp.readyState==4){taigastyleswitch('ajaxloading');if(xmlhttp.status==200){var taigamessages=xmlhttp.responseText.split("\n");taigamessages.reverse();if(taigamessages[0]=='OKRELOAD'){if(taigamessages[1]){document.location=taigamessages[1];}else{taigareloadwithlastreceivedpost(true);}}else if(taigamessages[0]=='OK'){taigastyleswitchid2(taigaid,'edit');taigastyleswitchid2(taigaid,'editusername');taigacurrentlyeditingpost--;taigalastextarea='posttextarea';}else{alert(xmlhttp.responseText);}}else{alert(lang__sorry_an_error_occurred_please_try_your_request_again);}}}
taigastyleswitch('ajaxloading');xmlhttp.send(taigaParams);}
function taigatimezonedateformatchange(taigatochange){var taigaParams='taiga=setprefs&'+taigatochange+'='+urlencode(document.getElementById(taigatochange+'entry').value);var xmlhttp=taigaNewAjax();xmlhttp.open("POST",taigaurlencodeexceptslashesifie(document.location.pathname),true);xmlhttp.setRequestHeader("Content-type","application/x-www-form-urlencoded");xmlhttp.onreadystatechange=function(){if(xmlhttp.readyState==4){taigastyleswitch('ajaxloading');if(xmlhttp.status==200){var taigamessages=xmlhttp.responseText.split("\n");taigamessages.reverse();if(taigamessages[0]=='OK'){document.getElementById('currentdatetimeformat').innerHTML=taigamessages[2];document.getElementById('currenttimeformat').innerHTML=taigamessages[1];}else{alert(xmlhttp.responseText);}}else{alert(lang__sorry_an_error_occurred_please_try_your_request_again);}}}
taigastyleswitch('ajaxloading');xmlhttp.send(taigaParams);}
function taigagroupcolorchange(taigagid,taigacolor){var taigaParams='taiga=admin&adminparams='+urlencode('groupcolor='+taigacolor+'&gid='+taigagid);var xmlhttp=taigaNewAjax();xmlhttp.open("POST",taigaurlencodeexceptslashesifie(document.location.pathname),true);xmlhttp.setRequestHeader("Content-type","application/x-www-form-urlencoded");xmlhttp.send(taigaParams);}
function taiganotification(taigahuman,taigaonoff){if(document.getElementById('notifypostview_'+taigahuman)){taigaonoff=(document.getElementById('notifypostview_'+taigahuman).checked)?'1':'0';}
var taigaParams='taiga=notify&human='+urlencode(taigahuman)+'&onoff='+taigaonoff;var xmlhttp=taigaNewAjax();xmlhttp.open("POST",taigaurlencodeexceptslashesifie(document.location.pathname),true);xmlhttp.setRequestHeader("Content-type","application/x-www-form-urlencoded");xmlhttp.onreadystatechange=function(){if(xmlhttp.readyState==4){taigastyleswitch('ajaxloading');if(xmlhttp.status==200){if(xmlhttp.responseText=='OK'){if(taigaonoff=='0'){if(document.getElementById('notify'+taigahuman)){document.getElementById('notify'+taigahuman).innerHTML='';}}}else{alert(xmlhttp.responseText);document.getElementById('notifypostview_'+taigahuman).checked=(!(taigaonoff=='1'));return false;}}else{alert(lang__sorry_an_error_occurred_please_try_your_request_again);document.getElementById('notifypostview_'+taigahuman).checked=(!(taigaonoff=='1'));return false;}}}
taigastyleswitch('ajaxloading');xmlhttp.send(taigaParams);}
function taigaignore(taigahuman,taigaonoff,taigatype){if(document.getElementById('ignore_'+taigahuman)){taigaonoff=(document.getElementById('ignore_'+taigahuman).checked)?'1':'0';}
var taigaParams='taiga=ignore&ignoretype='+taigatype+'&human='+urlencode(taigahuman)+'&onoff='+taigaonoff;var xmlhttp=taigaNewAjax();xmlhttp.open("POST",taigaurlencodeexceptslashesifie(document.location.pathname),true);xmlhttp.setRequestHeader("Content-type","application/x-www-form-urlencoded");xmlhttp.onreadystatechange=function(){if(xmlhttp.readyState==4){taigastyleswitch('ajaxloading');if(xmlhttp.status==200){if(xmlhttp.responseText=='OK'){if(taigaonoff=='0'){if(document.getElementById('profileignore_'+taigatype+'_'+taigahuman)){document.getElementById('profileignore_'+taigatype+'_'+taigahuman).innerHTML='';}}}else{alert(xmlhttp.responseText);document.getElementById('ignore_'+taigahuman).checked=(!(taigaonoff=='1'));return false;}}else{alert(lang__sorry_an_error_occurred_please_try_your_request_again);document.getElementById('ignore_'+taigahuman).checked=(!(taigaonoff=='1'));return false;}}}
taigastyleswitch('ajaxloading');xmlhttp.send(taigaParams);}
function taigaeditprofile(){var editprofileparams='';for(var i=0;i<taigaprofilefields.length;i++){var taigachanged=document.getElementById(taigaprofilefields[i]+'entry');if(taigachanged){var taigavalue;if(taigachanged.type=='checkbox'){taigavalue=(taigachanged.checked==true)?1:0;}else{taigavalue=taigachanged.value.replace(/\&/g,'&amp;');}
editprofileparams+='&'+taigaprofilefields[i]+'entry'+'='+taigavalue;}}
editprofileparams+='&birthdateentry=';if((document.getElementById('birthdateyearentry')&&document.getElementById('birthdateyearentry').value)&&(document.getElementById('birthdatemonthentry')&&document.getElementById('birthdatemonthentry').value)&&(document.getElementById('birthdatedayentry')&&document.getElementById('birthdatedayentry').value)){var birthdateyear=document.getElementById('birthdateyearentry').value;var birthdatemonth=document.getElementById('birthdatemonthentry').value;var birthdateday=document.getElementById('birthdatedayentry').value;if(((parseInt(birthdateyear,10)<100)||(parseInt(birthdateyear,10)>3000))||((parseInt(birthdatemonth,10)<1)||(parseInt(birthdatemonth,10)>12))||((parseInt(birthdateday,10)<1)||(parseInt(birthdateday,10)>31))){alert(lang__if_you_are_going_to_enter_a_birthdate_please_enter_a_correct_one);return false;}
editprofileparams+=birthdateyear+'-'+birthdatemonth+'-'+birthdateday;}
if(document.getElementById('genderentry')){editprofileparams+='&genderempty='+document.getElementById('genderentry').value;}
var taigaParams='taiga=editprofile&editprofileparams='+urlencode(editprofileparams);var xmlhttp=taigaNewAjax();xmlhttp.open("POST",taigaurlencodeexceptslashesifie(document.location.pathname),true);xmlhttp.setRequestHeader("Content-type","application/x-www-form-urlencoded");xmlhttp.onreadystatechange=function(){if(xmlhttp.readyState==4){taigastyleswitch('ajaxloading');if(xmlhttp.status==200){var taigamessages=xmlhttp.responseText.split("\n");taigamessages.reverse();if(taigamessages[0]=='OK'){taigamessages.reverse();document.location=taigamessages[0];}else{alert(xmlhttp.responseText);}}else{alert(lang__sorry_an_error_occurred_please_try_your_request_again);}}}
taigastyleswitch('ajaxloading');xmlhttp.send(taigaParams);}
function taigapostpreview(){var taigaParams='taiga=previewpost';if(document.getElementById('posttextarea')){document.getElementById('posttextarea').focus();if(document.getElementById('posttextarea').value==''){return false;}
taigaParams+='&newpost='+urlencode(document.getElementById('posttextarea').value);}else{alert(lang__error_posttextarea_not_found);return false;}
if(document.getElementById('guestusername')){if(document.getElementById('guestusername').value==''){alert(lang__please_enter_a_username);return false;}
taigaParams+='&guestusername='+urlencode(document.getElementById('guestusername').value);}
var xmlhttp=taigaNewAjax();xmlhttp.open("POST",taigaurlencodeexceptslashesifie(document.location.pathname),true);xmlhttp.setRequestHeader("Content-type","application/x-www-form-urlencoded");xmlhttp.onreadystatechange=function(){if(xmlhttp.readyState==4){taigastyleswitch('ajaxloading');if(xmlhttp.status==200){var taigamessages=xmlhttp.responseText.split("\n");taigamessages.reverse();if(taigamessages[0]=='OK'){taigamessages.reverse();document.getElementById('postpreviewarea').innerHTML=taigamessages[0];taigascrolltobottom();taigaautosave(false);}else{alert(xmlhttp.responseText);}}else{alert(lang__sorry_an_error_occurred_please_try_your_request_again);}}}
taigastyleswitch('ajaxloading');xmlhttp.send(taigaParams);}
function taigahidepostpreview(){document.getElementById('postpreviewarea').innerHTML='';}
function taigachangeavatar(taigaavatar){var taigaParams='taiga=editprofile&editprofileparams='+urlencode('avatar='+taigaavatar);var xmlhttp=taigaNewAjax();xmlhttp.open("POST",taigaurlencodeexceptslashesifie(document.location.pathname),true);xmlhttp.setRequestHeader("Content-type","application/x-www-form-urlencoded");xmlhttp.send(taigaParams);}
function taigareloadavatargallery(){var taigaParams='taiga=avatargallery';var xmlhttp=taigaNewAjax();xmlhttp.open("POST",taigaurlencodeexceptslashesifie(document.location.pathname),true);xmlhttp.setRequestHeader("Content-type","application/x-www-form-urlencoded");xmlhttp.onreadystatechange=function(){if(xmlhttp.readyState==4){taigastyleswitch('ajaxloading');if(xmlhttp.status==200){document.getElementById('avatargallery').innerHTML=xmlhttp.responseText;if(!getElementsByClassName('f3_show').length&&!getElementsByClassName('f3_hide').length){taigastyleswitchhide('avataroptionsarea');}else{taigastyleswitchshow('avataroptionsarea');}
taigaavatargalleryinitializesortable();}else{alert(lang__sorry_an_error_occurred_please_try_your_request_again);}}}
taigastyleswitch('ajaxloading');xmlhttp.send(taigaParams);}
function taigaavatargalleryinitializesortable(){Sortable.create('avatargallery',{elements:$$('#avatargallery div.galleryentry'),overlap:'horizontal',constraint:undefined,onUpdate:function(sortable){taigaorderavatars(Sortable.serialize(sortable));}});Sortable.serialize('avatargallery',{tag:'div'});}
function taigasetselectedav(){if(taigaselectedavatar){taigachangeavatar(taigaselectedavatar);}else{var taigaselectedguys=getElementsByClassName('f3_show');if(taigaselectedguys.length){taigaselectedavatar=taigaselectedguys[0].id;taigaselectedavatar.replace(/galleryavatar_/,'');}
if(taigaselectedavatar){taigachangeavatar(taigaselectedavatar);}else{alert(lang__to_use_this_feature_please_click_on_an_avatar_from_your_avatar_gallery_or_upload_a_new_avatar);}}}
function taigasetrandomav(){taigahideallf3();taigachangeavatar('random');}
function taigasetnoav(){document.getElementById('selectedavatarinner').innerHTML='(none)';taigahideallf3();taigachangeavatar('kill');taigaselectedavatar='';}
function taigaavatardelete(taigaavatar){var taigaParams='taiga=editprofile&editprofileparams='+urlencode('deleteavatar='+taigaavatar);var xmlhttp=taigaNewAjax();xmlhttp.open("POST",taigaurlencodeexceptslashesifie(document.location.pathname),true);xmlhttp.setRequestHeader("Content-type","application/x-www-form-urlencoded");xmlhttp.onreadystatechange=function(){if(xmlhttp.readyState==4){taigastyleswitch('ajaxloading');if(xmlhttp.status==200){if(taigaavatar==taigaselectedavatar){taigareloadwithlastreceivedpost(true);}else{taigareloadavatargallery();}}else{alert(lang__sorry_an_error_occurred_please_try_your_request_again);}}}
taigastyleswitch('ajaxloading');xmlhttp.send(taigaParams);}
function taigaavatarupload(taigaform){if(document.getElementById('uploadavatarbutton')){document.getElementById('uploadavatarbutton').checked=true;}
document.getElementById('selectedavatarinner').innerHTML=lang__please_wait_dotdotdot;taigaform.submit();}
function taigaavatardownload(taigaform){if(document.getElementById('avatarurlentryinput').value!=''){if(document.getElementById('linkavatarbutton')){document.getElementById('linkavatarbutton').checked=true;}
document.getElementById('selectedavatarinner').innerHTML=lang__please_wait_dotdotdot;taigaform.submit();}else{alert(lang__please_enter_a_valid_url);}}
function taigaavatarcomplete(taigaavatar){if(document.getElementById('noavbutton').checked&&!getElementsByClassName('f3_show').length&&!getElementsByClassName('f3_hide').length){document.getElementById('selectedavbutton').checked=true;}
document.getElementById('selectedavatarinner').innerHTML='<img class="avatarimage" src="/file/'+urlencode(taigaavatar)+'" />';taigaselectedavatar=taigaavatar;taigareloadavatargallery();document.location.hash='avatargallerybottom';if(!taigaloc()){window.scrollBy(f_scrollLeft(),(-document.getElementById('mainbarcontainer').scrollHeight));}}
function taigahideallf3(){var taigatoswitch=getElementsByClassName('f3_show');var taigathings=new Array();for(var i=0;i<taigatoswitch.length;i++){taigathings.push(taigatoswitch[i]);}
for(var i=0;i<taigathings.length;i++){taigathings[i].className='f3_hide';}}
function taigachangetoavataringallery(taigaavatar){if(taigajustchangedorderbool){return false;}
taigahideallf3();document.getElementById('galleryavatar_'+taigaavatar).className='f3_show';document.getElementById('selectedavbutton').checked=true;document.getElementById('selectedavatarinner').innerHTML='<img class="avatarimage" src="/file/'+urlencode(taigaavatar)+'" />';taigaselectedavatar=taigaavatar;taigachangeavatar(taigaavatar);}
function taigaremoveattachmentbeforeposting(taigaattachmentnumber){taigaattachments[taigaattachmentnumber]='';taigastyleswitchid2show(taigaattachmentnumber,'attachouter');if(document.getElementById('attachmentcomplete'+taigaattachmentnumber)){document.getElementById('attachmentcomplete'+taigaattachmentnumber).innerHTML='';}
if(document.getElementById('attachment_file_input_'+taigaattachmentnumber)){document.getElementById('attachment_file_input_'+taigaattachmentnumber).value='';document.getElementById('attachment_file_input_'+taigaattachmentnumber).style.display='block';}
taigastyleswitchid2(taigaattachmentnumber,'attachment_delete_button');}
function taigaattachmenterror(taigaattachmentnumber,taigaerrortext){if(taigaerrortext){alert(taigaerrortext);}else{alert(lang__sorry_an_error_occurred_with_the_attachment_data);}
taigacurrentlyuploadingattachments--;taigastyleswitchid2(taigaattachmentnumber,'attachuploadstuff');if(document.getElementById('attachment_file_input_'+taigaattachmentnumber)){document.getElementById('attachment_file_input_'+taigaattachmentnumber).value='';}}
function taigaattachmentuploadfetch(uuid,taigaattachmentnumber){var req=new XMLHttpRequest();req.open("GET","/attachmentuploadprogress",1);req.setRequestHeader("X-Progress-ID",uuid);req.onreadystatechange=function(){if(req.readyState==4){if(req.status==200){var upload=eval(req.responseText);if(upload.state=='done'||upload.state=='uploading'){var bar=document.getElementById('attachmentprogressbar_'+taigaattachmentnumber);if(bar){var w=200*upload.received/upload.size;if(w){bar.style.width=w+'px';}}}
if(upload.state=='error'){if(upload.status=='413'){taigaattachmenterror(taigaattachmentnumber,lang__sorry_this_file_is_too_large);}else{taigaattachmenterror(taigaattachmentnumber);}}
if(!(upload.state=='done'||upload.state=='error'||!upload.state)){setTimeout(function(){taigaattachmentuploadfetch(uuid,taigaattachmentnumber);},taigaattachmentuploadprogressbarupdateinterval);}}}}
req.send(null);}
function taigaattachmentupload(taigaform,taigaattachmentnumber){var uuid="";for(var i=0;i<32;i++){uuid+=Math.floor(Math.random()*16).toString(16);}
taigaform.action="/attachmentupload?X-Progress-ID="+uuid;setTimeout(function(){taigaattachmentuploadfetch(uuid,taigaattachmentnumber);},taigaattachmentuploadprogressbarupdateinterval);taigacurrentlyuploadingattachments++;taigastyleswitchid2(taigaattachmentnumber,'attachuploadstuff');taigaform.submit();}
function taigalogoupload(taigaform){taigacurrentlyuploadingattachments++;document.getElementById('logofilenameentry').value=document.getElementById('attachmentpathentry').value;taigaform.submit();}
function taigafaviconupload(taigaform){taigacurrentlyuploadingattachments++;document.getElementById('faviconfilenameentry').value=document.getElementById('faviconpathentry').value;taigaform.submit();}
function taigaattachmentcomplete(taigafileid,taigaattachmentfilename,taigaattachmentnumber){taigastyleswitchid2(taigaattachmentnumber,'attachuploadstuff');taigastyleswitchid2hide(taigaattachmentnumber,'attachouter');document.getElementById('attachmentcomplete'+taigaattachmentnumber).innerHTML='<i>'+taigaattachmentfilename+'</i>';taigaattachments[taigaattachmentnumber]=taigafileid;taigastyleswitchid2(taigaattachmentnumber,'attachment_delete_button');if(document.getElementById('attachment_file_input_'+taigaattachmentnumber)){document.getElementById('attachment_file_input_'+taigaattachmentnumber).style.display='none';}
taigacurrentlyuploadingattachments--;}
function taigalogocomplete(taigafileid,taigaattachmentfilename,taigaattachmentnumber){document.getElementById('logoentry').value=taigafileid;document.getElementById('logofilenameentry').value=taigaattachmentfilename;taigacurrentlyuploadingattachments--;taigaadmin();}
function taigafaviconcomplete(taigafileid,taigaattachmentfilename,taigaattachmentnumber){document.getElementById('faviconentry').value=taigafileid;document.getElementById('faviconfilenameentry').value=taigaattachmentfilename;taigacurrentlyuploadingattachments--;taigaadmin();}
function taigacheckotherinfolength(taigaotherinfoentry){document.getElementById('charsremaininginotherinfo').innerHTML=(500-document.getElementById('otherinfoentry').value.length);}
var linkarray=new Array();function disablelinks(){var divlinks=document.getElementById('wholepagecontainer').getElementsByTagName('a');for(var i=0;i<divlinks.length;i++){linkarray[i]=divlinks[i].href.toString();if(divlinks[i].id=='ssomething')
{}
else{divlinks[i].disabled=true;divlinks[i].onclick=new Function("return false;");}}}
function enablelinks(){var divlinks=document.getElementById('wholepagecontainer').getElementsByTagName('a');for(var i=0;i<divlinks.length;i++){divlinks[i].disabled=false;divlinks[i].href=linkarray[i];divlinks[i].onclick=linkarray[i];}}
function taigamainbar(taigamode,taigaid,taigasortable){var taigaitems=new Array;if((taigamode=='delete')&&(taigaid==undefined)){taigaitems.push('revert=1');}else if((taigamode=='delete')||(taigamode=='save')){for(var i=1;i<=1000;i++){if(!document.getElementById('mainbarurl'+i)){continue;}
var taigaurl=document.getElementById('mainbarurl'+i);var taigatext=document.getElementById('mainbartext'+i);if((taigaurl.value=='')||(taigatext.value=='')){continue;}
var taigarealmainbarid=taigaurl.name;if((taigamode=='delete')&&(taigaid==taigarealmainbarid)){continue;}
taigaitems.push('save'+taigarealmainbarid+'='+urlencode('url='+urlencode(taigaurl.value)+'&text='+urlencode(taigatext.value)));}}else if(taigamode=='cancel'){taigareloadwithlastreceivedpost(true);return;}
var taigaParams='taiga=mainbar&mainbarparams='+urlencode(taigaitems.join('&'));var xmlhttp=taigaNewAjax();xmlhttp.open("POST",taigaurlencodeexceptslashesifie(document.location.pathname),true);xmlhttp.setRequestHeader("Content-type","application/x-www-form-urlencoded");xmlhttp.onreadystatechange=function(){if(xmlhttp.readyState==4){taigastyleswitch('ajaxloading');if(xmlhttp.status==200){taigaorder(taigamainbarorder,'editmainbarlinkcontainers','mainbar','mainbarparams','order');}else{alert(lang__sorry_an_error_occurred_please_try_your_request_again);}}}
taigastyleswitch('ajaxloading');xmlhttp.send(taigaParams);}
function taigaorder(taigasortable,taigasep,taigarm,taigaparamskey,taigaparamname){taigasortable=taigasortable.substring((taigasep+'[]=').length);var taigaforums=taigasortable.split('&'+taigasep+'[]=');var taigaParams='taiga='+taigarm+'&'+taigaparamskey+'='+urlencode(taigaparamname+'='+taigaforums.join(','));var xmlhttp=taigaNewAjax();xmlhttp.open("POST",taigaurlencodeexceptslashesifie(document.location.pathname),true);xmlhttp.setRequestHeader("Content-type","application/x-www-form-urlencoded");xmlhttp.onreadystatechange=function(){if(xmlhttp.readyState==4){taigastyleswitch('ajaxloading');if(xmlhttp.status==200){if(!(/OK$/.test(xmlhttp.responseText))){taigareloadwithlastreceivedpost(true);}}else{alert(lang__sorry_an_error_occurred_please_try_your_request_again);}}}
taigastyleswitch('ajaxloading');xmlhttp.send(taigaParams);}
function taigaorderforums(taigasortable){taigaorder(taigasortable,'categoriescontainer','admin','adminparams','forumorder');}
function taigaordermainbar(taigasortable){taigamainbarorder=taigasortable;}
function taigaorderavatars(taigasortable){taigaorder(taigasortable,'avatargallery','editprofile','editprofileparams','avorder');taigajustchangedorder();}
function taigajustchangedorder(taigacallback){if(!taigacallback){taigajustchangedorderbool=true;setTimeout("taigajustchangedorder(true)",1000);}else{taigajustchangedorderbool=false;}}
function taigaadmin(){if(taigacurrentlyuploadingattachments){alert(lang__you_must_wait_until_your_logo_finishes_uploading_to_save_your_settings);return false;}
var adminparams='';for(var i=0;i<taigasettings.length;i++){if(document.getElementById(taigasettings[i]+'entry')){var taigainput=document.getElementById(taigasettings[i]+'entry');var taigavalue=taigainput.value.replace(/\&/g,'&amp;');if(taigainput.type=='checkbox'){taigavalue=(taigainput.checked?'1':'0');}
adminparams+='&'+taigasettings[i]+'entry'+'='+taigavalue;}}
var taigaParams='taiga=admin&adminparams='+urlencode(adminparams);var xmlhttp=taigaNewAjax();xmlhttp.open("POST",taigaurlencodeexceptslashesifie(document.location.pathname),true);xmlhttp.setRequestHeader("Content-type","application/x-www-form-urlencoded");xmlhttp.onreadystatechange=function(){if(xmlhttp.readyState==4){taigastyleswitch('ajaxloading');if(xmlhttp.status==200){if(xmlhttp.responseText=='OK'){taigareloadwithlastreceivedpost(true);}else{alert(xmlhttp.responseText);}}else{alert(lang__sorry_an_error_occurred_please_try_your_request_again);}}}
taigastyleswitch('ajaxloading');xmlhttp.send(taigaParams);}
function taigaperm(taigacheckboxid,taigagid,taigapermname,taigalabelclick){if(document.getElementById(taigacheckboxid).disabled==true){return false;}
var taigachecked=document.getElementById(taigacheckboxid).checked;if(taigalabelclick==true){taigachecked=!taigachecked;}
var adminparams;(taigachecked==true)?(adminparams='givegroupglobalpermission'):(adminparams='removegroupglobalpermission');var taigaParams='taiga=admin&adminparams='+urlencode(adminparams+'='+taigagid+'&name='+taigapermname);var xmlhttp=taigaNewAjax();xmlhttp.open("POST",taigaurlencodeexceptslashesifie(document.location.pathname),true);xmlhttp.setRequestHeader("Content-type","application/x-www-form-urlencoded");xmlhttp.onreadystatechange=function(){if(xmlhttp.readyState==4){taigastyleswitch('ajaxloading');if(xmlhttp.status==200){if(xmlhttp.responseText=='OK'){if(taigalabelclick==true){document.getElementById(taigacheckboxid).checked=!document.getElementById(taigacheckboxid).checked;}}else{alert(xmlhttp.responseText);document.getElementById(taigacheckboxid).checked=!document.getElementById(taigacheckboxid).checked;}}else{alert(lang__sorry_an_error_occurred_please_try_your_request_again);document.getElementById(taigacheckboxid).checked=!document.getElementById(taigacheckboxid).checked;}}}
taigastyleswitch('ajaxloading');xmlhttp.send(taigaParams);}
function taigagroupvisibility(taigacheckboxid,taigagid,taigafid,taigalabelclick){if(document.getElementById(taigacheckboxid).disabled==true){return false;}
var taigachecked=document.getElementById(taigacheckboxid).checked;if(taigalabelclick==true){taigachecked=!taigachecked;}
var adminparams;(taigachecked==true)?(adminparams='addgroupvisibility'):(adminparams='removegroupvisibility');var taigaParams='taiga=admin&adminparams='+urlencode(adminparams+'='+taigagid+'&name='+taigafid);var xmlhttp=taigaNewAjax();xmlhttp.open("POST",taigaurlencodeexceptslashesifie(document.location.pathname),true);xmlhttp.setRequestHeader("Content-type","application/x-www-form-urlencoded");xmlhttp.onreadystatechange=function(){if(xmlhttp.readyState==4){taigastyleswitch('ajaxloading');if(xmlhttp.status==200){if(xmlhttp.responseText=='OK'){if(taigalabelclick==true){document.getElementById(taigacheckboxid).checked=!document.getElementById(taigacheckboxid).checked;}}else{alert(xmlhttp.responseText);document.getElementById(taigacheckboxid).checked=!document.getElementById(taigacheckboxid).checked;}}else{alert(lang__sorry_an_error_occurred_please_try_your_request_again);document.getElementById(taigacheckboxid).checked=!document.getElementById(taigacheckboxid).checked;}}}
taigastyleswitch('ajaxloading');xmlhttp.send(taigaParams);}
function taigauseraddremove(taigaadminparam,taigagid,taigainput){var taigauid=taigainput;if((taigaadminparam=='removefromgroup')&&(taigagid=='0')&&(taigauid==myuid)){if(!(confirm(lang__you_are_about_to_remove_yourself_as_an_administrator__this_will_lock_you_out_of_the_admin_panel_forever__really_remove_yourself_as_administrator))){return false;}}
if((taigaadminparam=='addtogroup')||(taigaadminparam=='addforummod')){taigauid=document.getElementById(taigainput).value;if(taigauid==''){taigauid=document.getElementById('group'+taigainput).value;if(taigauid==''){alert(lang__please_enter_a_user_or_group_name);return false;}
taigaadminparam+='group';}}
var taigaParams='taiga=admin&adminparams='+urlencode(taigaadminparam+'='+taigagid+'&name='+taigauid);var xmlhttp=taigaNewAjax();xmlhttp.open("POST",taigaurlencodeexceptslashesifie(document.location.pathname),true);xmlhttp.setRequestHeader("Content-type","application/x-www-form-urlencoded");xmlhttp.onreadystatechange=function(){if(xmlhttp.readyState==4){taigastyleswitch('ajaxloading');if(xmlhttp.status==200){if(xmlhttp.responseText=='OK'){if((taigaadminparam=='removefromgroup')&&(taigagid=='0')&&(taigauid==myuid)){document.location='/';}else{taigareloadwithlastreceivedpost(true);}}else{alert(xmlhttp.responseText);}}else{alert(lang__sorry_an_error_occurred_please_try_your_request_again);}}}
taigastyleswitch('ajaxloading');xmlhttp.send(taigaParams);}
function taigagroupcreatedestroy(taigaadminparam,taigainput){var taigagid=taigainput;if(taigaadminparam=='deletegroup'){if(!(confirm(lang__you_are_about_to_delete_an_enter_usergroup__you_cannot_undo_this_action__really_delete_this_group))){return false;}}
if(taigaadminparam=='newgroup'){taigagid=document.getElementById(taigainput).value;if(taigagid==''){alert(lang__please_enter_a_name);return false;}}
var taigaParams='taiga=admin&adminparams='+urlencode(taigaadminparam+'='+taigagid+'&name='+taigagid);var xmlhttp=taigaNewAjax();xmlhttp.open("POST",taigaurlencodeexceptslashesifie(document.location.pathname),true);xmlhttp.setRequestHeader("Content-type","application/x-www-form-urlencoded");xmlhttp.onreadystatechange=function(){if(xmlhttp.readyState==4){taigastyleswitch('ajaxloading');if(xmlhttp.status==200){if(xmlhttp.responseText=='OK'){taigareloadwithlastreceivedpost(true);}else{alert(xmlhttp.responseText);}}else{alert(lang__sorry_an_error_occurred_please_try_your_request_again);}}}
taigastyleswitch('ajaxloading');xmlhttp.send(taigaParams);}
function taigavote(taigapolloptionid){var taigaParams='taiga=vote&polloptionid='+taigapolloptionid;var xmlhttp=taigaNewAjax();xmlhttp.open("POST",taigaurlencodeexceptslashesifie(document.location.pathname),true);xmlhttp.setRequestHeader("Content-type","application/x-www-form-urlencoded");xmlhttp.onreadystatechange=function(){if(xmlhttp.readyState==4){if(xmlhttp.status==200){var taigamessages=xmlhttp.responseText.split("\n");if(taigamessages[0]=='OK'){taigamessages.shift();document.getElementById('pollarea').innerHTML=taigamessages.join("\n");}else{alert(xmlhttp.responseText);}}else{alert(lang__sorry_an_error_occurred_please_try_your_request_again);}}}
xmlhttp.send(taigaParams);}
function taigabanunban(taigakey,taigavalue,taigatobanornottoban,taigaswitch){var taigaParams='taiga=banunban&'+taigakey+'toban='+taigavalue+'&tobanornottoban='+taigatobanornottoban;var xmlhttp=taigaNewAjax();xmlhttp.open("POST",taigaurlencodeexceptslashesifie(document.location.pathname),true);xmlhttp.setRequestHeader("Content-type","application/x-www-form-urlencoded");xmlhttp.onreadystatechange=function(){if(xmlhttp.readyState==4){taigastyleswitch('ajaxloading');if(xmlhttp.status==200){if(xmlhttp.responseText=='OK'){if(taigaswitch){taigaswitch();}}else{alert(xmlhttp.responseText);}}else{alert(lang__sorry_an_error_occurred_please_try_your_request_again);}}}
taigastyleswitch('ajaxloading');xmlhttp.send(taigaParams);}
function taigadeleteuser(taigauid){var taigaParams='taiga=deleteuser&uidtodelete='+taigauid+'&deleteallposts='+(document.getElementById('deleteuserdeleteallposts'+taigauid).checked?'1':'0');var xmlhttp=taigaNewAjax();xmlhttp.open("POST",taigaurlencodeexceptslashesifie(document.location.pathname),true);xmlhttp.setRequestHeader("Content-type","application/x-www-form-urlencoded");xmlhttp.onreadystatechange=function(){if(xmlhttp.readyState==4){taigastyleswitch('ajaxloading');if(xmlhttp.status==200){if(xmlhttp.responseText=='OK'){alert(lang__success);document.location='/';}else{alert(xmlhttp.responseText);}}else{alert(lang__sorry_an_error_occurred_please_try_your_request_again);}}}
taigastyleswitch('ajaxloading');xmlhttp.send(taigaParams);}
function taigadeleteattachment(taigahumanform,taigafileid){var taigaParams='taiga=deleteattachment&fileid='+taigafileid;var xmlhttp=taigaNewAjax();xmlhttp.open("POST",taigaurlencodeexceptslashesifie(taigahumanform),true);xmlhttp.setRequestHeader("Content-type","application/x-www-form-urlencoded");xmlhttp.onreadystatechange=function(){if(xmlhttp.readyState==4){taigastyleswitch('ajaxloading');if(xmlhttp.status==200){if(xmlhttp.responseText=='OK'){taigareloadwithlastreceivedpost(true);}else{alert(xmlhttp.responseText);}}else{alert(lang__sorry_an_error_occurred_please_try_your_request_again);}}}
taigastyleswitch('ajaxloading');xmlhttp.send(taigaParams);}
function taigasavecaret(taigatextarea){if(taigatextarea.isTextEdit){taigatextarea.caretPos=document.selection.createRange();}
taigalastextarea=taigatextarea.id;}
function taigabbcodeinsert(taigaid,taigatextareaid,taigadefault,taigasmiley,taigaquotetext){var taigatextarea=document.getElementById(taigatextareaid);var taigafirsttag='['+taigaid+']';var taigalasttag='[/'+taigaid+']';if(taigasmiley==true){taigafirsttag=taigaid;taigalasttag='';}else if(taigadefault!=null){taigafirsttag='['+taigaid+'="'+taigadefault+'"]';}
if(taigaquotetext!=null){taigafirsttag='['+taigaid+'="'+taigadefault+'"]';taigafirsttag=taigafirsttag+taigaquotetext+taigalasttag+"\n";taigalasttag='';}
if(taigatextarea.createTextRange&&(taigatextarea.isTextEdit&&taigatextarea.caretPos)){var taigaloc=taigatextarea.caretPos;var taigalength=taigaloc.text.length;var taigatoinsert=taigaloc.text.charAt(taigaloc.text.length-1)==' '?taigafirsttag+taigaloc.text+taigalasttag+' ':taigafirsttag+taigaloc.text+taigalasttag;taigaloc.text=taigatoinsert;if(taigalength==0){taigaloc.moveStart("character",-taigalasttag.length);taigaloc.moveEnd("character",-taigalasttag.length);}else{taigaloc.moveStart("character",-taigatoinsert.length);}
taigaloc.select();}else if(taigatextarea.createTextRange&&(taigatextarea.selectionStart||(taigatextarea.selectionStart=='0'))){var before=taigatextarea.value.substring(0,taigatextarea.selectionStart);var after=taigatextarea.value.substring(taigatextarea.selectionEnd,taigatextarea.value.length);var selText=taigatextarea.value.substring(taigatextarea.selectionStart,taigatextarea.selectionEnd);taigatextarea.value=before+taigafirsttag+selText+taigalasttag+after;}else if(typeof(taigatextarea.selectionStart)!="undefined"){var taigaselection=taigatextarea.value.substr(taigatextarea.selectionStart,taigatextarea.selectionEnd-taigatextarea.selectionStart);var taigaloc=taigatextarea.selectionStart;var taigascroll=taigatextarea.scrollTop;taigatextarea.value=taigatextarea.value.substr(0,taigatextarea.selectionStart)+taigafirsttag+taigaselection+taigalasttag+taigatextarea.value.substr(taigatextarea.selectionEnd);if(taigatextarea.setSelectionRange){if(taigaselection.length==0){taigatextarea.setSelectionRange(taigaloc+taigafirsttag.length,taigaloc+taigafirsttag.length);}else{taigatextarea.setSelectionRange(taigaloc,taigaloc+taigafirsttag.length+taigaselection.length+taigalasttag.length);}
taigatextarea.focus();}
taigatextarea.scrollTop=taigascroll;}else{taigatextarea.value+=taigafirsttag+taigalasttag;taigatextarea.focus(taigatextarea.value.length-1);}}
function taigaquote(taigahuman,taigausername){var taigatextarea=taigalastextarea?taigalastextarea:'posttextarea';if(taigatextarea=='posttextarea'){taigastyleswitchshow('postbox');}
taigabbcodeinsert('quote',taigatextarea,document.getElementById('postusername_'+taigahuman).name,null,document.getElementById('edittextlargebox_'+taigahuman+'editbox').value);document.getElementById(taigatextarea).focus();taigastyleswitchhide('editpollarea');}
function taigasearchsubmit(){if(document.getElementById('searchinput').value==''){return false;}}
function taigarecoverpassword(){var taigausername;if(document.getElementById('loginusernameinput')){taigausername=document.getElementById('loginusernameinput').value;}else{alert(lang__error__username_element_not_found);return false;}
if(taigausername==''){alert(lang__please_type_in_your_username);return false;}
var taigaParams='taiga=recoverpassword&sern='+taigausername;var xmlhttp=taigaNewAjax();xmlhttp.open("POST",taigaurlencodeexceptslashesifie(document.location.pathname),true);xmlhttp.setRequestHeader("Content-type","application/x-www-form-urlencoded");xmlhttp.onreadystatechange=function(){if(xmlhttp.readyState==4){taigastyleswitch('ajaxloading');if(xmlhttp.status==200){if(xmlhttp.responseText=='OK'){alert(lang__weve_sent_an_email_to_the_address_in_your_profile_with_a_new_password_for_you);}else{alert(xmlhttp.responseText);}}else{alert(lang__sorry_an_error_occurred_please_try_your_request_again);}}}
taigastyleswitch('ajaxloading');xmlhttp.send(taigaParams);}
function taigadeletepoll(){var taigaParams='taiga=deletepoll';var xmlhttp=taigaNewAjax();xmlhttp.open("POST",taigaurlencodeexceptslashesifie(document.location.pathname),true);xmlhttp.setRequestHeader("Content-type","application/x-www-form-urlencoded");xmlhttp.onreadystatechange=function(){if(xmlhttp.readyState==4){taigastyleswitch('ajaxloading');if(xmlhttp.status==200){if(xmlhttp.responseText=='OK'){taigareloadwithlastreceivedpost(true);}else{alert(xmlhttp.responseText);}}else{alert(lang__sorry_an_error_occurred_please_try_your_request_again);}}}
taigastyleswitch('ajaxloading');xmlhttp.send(taigaParams);}
function nodigits(e){var keynum;var keychar;var numcheck;if(window.event){keynum=e.keyCode;}
else if(e.which){keynum=e.which;}
keychar=String.fromCharCode(keynum);numcheck=/\d/;return!numcheck.test(keychar);}
function onlydigits(e)
{var charcode=(e.which)?e.which:event.keyCode;if(charcode==32||charcode==9||charcode>57)
return false;return true;}
function toggle(boxid)
{if(document.getElementById(boxid).checked==false)
document.getElementById(boxid).checked=true;else
document.getElementById(boxid).checked=false;}
function clearpassfields()
{if(document.getElementById('password')){document.getElementById('password').value="";}
document.getElementById('newpassword1').value="";document.getElementById('newpassword2').value="";}
function taigasetwindowtitle(taiganewtitle){if(taigachrome){document.title='';for(var i=0;i<100;i++){document.title+='|';}}
document.title=taiganewtitle;}
function taigasetitle(taigaforce){if((taigaforce&&!taiganewposts)||taigablurred){if(taiganewposts>0){taigasetwindowtitle('('+taiganewposts+') '+taigatitle);}else{taigasetwindowtitle(taigatitle);}}}
function taigacancelnewpost(){document.getElementById('posttextarea').value='';if(document.getElementById('posttitlearea')){document.getElementById('posttitlearea').value='';}
if(document.getElementById('postrecipientarea')){document.getElementById('postrecipientarea').value='';}
if(document.getElementById('postpreviewarea')){document.getElementById('postpreviewarea').innerHTML='';}
taigaautosave(false);taigastyleswitchhide('postbox');}
function taigaimageresize(taigaimage){if(taigaimage.className=='imgimage'){taigaimage.className='imgimagenomaxwidth';}else{taigaimage.className='imgimage';}}
function taigaurlencodeexceptslashesifie(taigastring){if(taigaie){taigastring=urldecode(taigastring);taigastring=urlencode(taigastring);taigastring=taigastring.replace(/%2F/ig,'/');taigastring=taigastring.replace(/%3A/ig,':');taigastring=taigastring.replace(/%23.*/i,'');}
return taigastring;}
function taigareloadtolastpost(){var taigahash=document.location.hash.substring(1);var taigaParams='taiga=lastpost&param='+taigahash;var xmlhttp=taigaNewAjax();xmlhttp.open("POST",taigaurlencodeexceptslashesifie(document.location.pathname),true);xmlhttp.setRequestHeader("Content-type","application/x-www-form-urlencoded");xmlhttp.onreadystatechange=function(){if(xmlhttp.readyState==4){taigastyleswitch('ajaxloading');if(xmlhttp.status==200){var taigamessages=xmlhttp.responseText.split("\n");if(taigamessages[1]=='OK'){document.location=taigamessages[0];}}}}
taigastyleswitch('ajaxloading');xmlhttp.send(taigaParams);}
function taigareloadwithlastreceivedpost(taigareloadanyway){if(document.location.hash){if(document.location.hash=='#last'||document.location.hash=='#unread'){taigareloadtolastpost();return;}
var taigamatches=taigapathumanregex.exec(document.location);if(taigamatches!=null&&(taigamatches[1]=='post'||taigamatches[1]=='private')&&taigamatches[2]!=taigamatches[3]){document.location=taigamatches[3]+'.html';return;}}
if(taigareloadanyway){document.location=document.location.pathname;}}
window.onload=function(){taigareloadwithlastreceivedpost();taigastaticheightset();taigastaticpostmaxheightset();taigastaticpostspaddingset();taigauserlistonlineheightset();if(taigajumptopost){document.location.hash=taigajumptopost;if(!taigaloc()){var taigatopheight;if(document.getElementById('staticheader')){taigatopheight=document.getElementById('staticheader').scrollHeight;taigatopheight+=document.getElementById('mainbarcontainer').scrollHeight;}
else{taigatopheight=document.getElementById('mainbarcontainer').scrollHeight;}
window.scrollBy(f_scrollLeft(),(-taigatopheight));}}
taigapoll();taigapollajaxtimeoutinc();taigaprocessmessages();setTimeout("taigaautosave(true)",taigaautosaveinterval);};window.onbeforeunload=function(){if(taigagetnewpostsajax){taigagetnewpostsajax.abort();}
if(taigapollajax){taigapollajax.abort();}
if(document.getElementById('posttextarea')&&!document.getElementById('posttitlearea')){if(document.getElementById('posttextarea').value!=''){taigaonbeforeunloadalreadysaved=true;taigaautosave(false);}}}
window.onunload=function(){if(taigagetnewpostsajax){taigagetnewpostsajax.abort();}
if(taigapollajax){taigapollajax.abort();}
if(document.getElementById('posttextarea')&&!document.getElementById('posttitlearea')&&!taigaonbeforeunloadalreadysaved){if(document.getElementById('posttextarea').value!=''){taigaautosave(false);}}};window.onblur=function(){taigablurred=true;taiganewposts=0;};window.onfocus=function(){taiganewposts=0;taigasetitle();taigablurred=false;};function taigachrometitlesetloop(){if(!taigablurred){taigasetitle(true);}
setTimeout(taigachrometitlesetloop,1000);}
if(taigachrome){setTimeout(taigachrometitlesetloop,1000);}
var taigaclickprefixes=['viewsettings','undosettings','topicinfo','boardinfo','advancedsearchsettings','unreadinfo'];var taigaclickprefixesid=['moreinfo','edithistory'];document.onclick=taigacheckpopups;function taigacheckpopups(e){var taigatarget=(e&&e.target)||(event&&event.srcElement);for(var i=0;i<taigaclickprefixes.length;i++){var taigaprefix=taigaclickprefixes[i];if(checkpopupParentView(taigatarget,taigaprefix)){taigastyleswitchnoscroll(taigaprefix);}}
for(var i=0;i<taigaclickprefixesid.length;i++){var taigatargetnew=taigatarget;var taigaprefix=taigaclickprefixesid[i];var taigaregex=new RegExp('^'+taigaprefix+'(?:button)?');var taigastop=false;while(taigatargetnew.parentNode){if(taigaregex.test(taigatargetnew.id)){taigastop=true;break;}
taigatargetnew=taigatargetnew.parentNode}
if(taigastop){continue;}
var taigashown=getElementsByClassName(taigaprefix+'_show');if(!taigashown.length){taigashown=getElementsByClassName(taigaprefix+'_hide');}
var taigaregex2=new RegExp('^'+taigaprefix+'_(?:show|hide)_');for(var j=0;j<taigashown.length;j++){var taigaid=taigashown[j].id;taigaid=taigaid.replace(taigaregex2,'');taigastyleswitchid3hide(taigaid,taigaprefix);taigastyleswitchid3hide(taigaid,taigaprefix+'button');}}}
function checkpopupParentView(taigatarget,taigaprefix){if((getElementsByClassName(taigaprefix+'_show').length==0)||(getElementsByClassName(taigaprefix+'_hide').length>getElementsByClassName(taigaprefix+'_show').length)){return false;}
var taigaprefixnosettings=taigaprefix.replace(/settings$/,'');while(taigatarget.parentNode){if(((taigatarget==document.getElementById(taigaprefix+'container'))||(taigatarget==document.getElementById(taigaprefixnosettings+'container'))||(taigatarget==document.getElementById(taigaprefix)))||((taigaprefix=='advancedsearchsettings')&&((document.getElementById('searcharea')&&taigatarget==document.getElementById('searcharea'))||(document.getElementById('togglesearch')&&taigatarget==document.getElementById('togglesearch'))||(document.getElementById('newsearch')&&taigatarget==document.getElementById('newsearch'))))){return false;}
taigatarget=taigatarget.parentNode;}
return true;}
function taigastyleswitchid3show(taigaid){for(var arg=1;arg<arguments.length;arg++){var taigaclass=arguments[arg];var taigathingtoshow=document.getElementById(taigaclass+'_hide_'+taigaid);var taigathingtohide=document.getElementById(taigaclass+'_show_'+taigaid);if(taigathingtoshow){taigathingtoshow.className=taigaclass+'_show';}
if(taigathingtohide){taigathingtohide.className=taigaclass+'_hide';}}}
function taigastyleswitchid3hide(taigaid){for(var arg=1;arg<arguments.length;arg++){var taigaclass=arguments[arg];var taigathingtoshow=document.getElementById(taigaclass+'_show_'+taigaid);var taigathingtohide=document.getElementById(taigaclass+'_hide_'+taigaid);if(taigathingtoshow){taigathingtoshow.className=taigaclass+'_show';}
if(taigathingtohide){taigathingtohide.className=taigaclass+'_hide';}}}
function taiganimate(taigacommand,taigaobject,taigastartime,taigaduration){if(taigastartime>0){var taigacoderef=function(){taiganimate(taigacommand,taigaobject,0,taigaduration);}
setTimeout(taigacoderef,taigastartime);return;}
if(!taigaobject){return;}
if(('fadein'==taigacommand)||('fadeout'==taigacommand)){var taigasteps=Math.round((taigaduration/(1000/30)));var taigastep=taigasteps;while(taigastep>=0){var taigaopacity=(taigastep/taigasteps)*100;if('fadeout'==taigacommand){taigaopacity=(100-taigaopacity);}
var taigacoderef=taiganimatesupplicant(taigaobject,taigaopacity,(('fadeout'==taigacommand)&&(taigastep==taigasteps)));var taigatimeinc=(taigastep/taigasteps)*taigaduration;setTimeout(taigacoderef,taigatimeinc);taigastep--;}
if(navigator.userAgent.indexOf('iPhone')!=-1){var taigacoderef=taiganimatesupplicant(taigaobject,99);setTimeout(taigacoderef,taigaduration+10);}}}
function taiganimatesupplicant(taigaobject,taigaopacity,taigakill){return(function(){if(taigaobject){if(taigaopacity!=0){var taigadecimalopacity=taigaopacity/100;if(taigadecimalopacity==1){taigadecimalopacity=1;}
taigaobject.style.opacity=taigadecimalopacity.toString();taigaobject.style.filter='alpha(opacity='+taigaopacity.toString()+')';}
if(taigakill){taigaobject.className='hidden';}}});}
function taigastaticheightset(){if(document.getElementById('staticheader')){var taigatopheight=document.getElementById('staticheader').offsetHeight;var taigastaticpostpadding=taigatopheight+document.getElementById('mainbarcontainer').offsetHeight;var taigapostspadding=taigatopheight-3;var taigatoswitch=document.getElementById('staticfirstpost');taigatoswitch.style.top=taigastaticpostpadding+'px';var taigatoswitch2=document.getElementById('staticpostscontainer');taigatoswitch2.style.paddingTop=taigapostspadding+'px';}}
function taigalite(taigathing){var taigaonoff=taigathing.checked?'1':'0';var taigaParams='taiga=notify&command=lite&human='+urlencode(taigathing.name)+'&onoff='+taigaonoff;var xmlhttp=taigaNewAjax();xmlhttp.open("POST",taigaurlencodeexceptslashesifie(document.location.pathname),true);xmlhttp.setRequestHeader("Content-type","application/x-www-form-urlencoded");xmlhttp.onreadystatechange=function(){if(xmlhttp.readyState==4){taigastyleswitch('ajaxloading');if(xmlhttp.status==200){if(xmlhttp.responseText=='OK'){taigareloadwithlastreceivedpost(true);}else{alert(xmlhttp.responseText);taigathing.checked=(!(taigaonoff=='1'));return false;}}else{alert(lang__sorry_an_error_occurred_please_try_your_request_again);taigathing.checked=(!(taigaonoff=='1'));return false;}}}
taigastyleswitch('ajaxloading');xmlhttp.send(taigaParams);}
function taigauserlistonlineheightset(){if(document.getElementById('mainbarcontainer')&&document.getElementById('mainbarcontainer').className=='userlist_show'){var taigawindowheight=taigagetwindowheight();var taigapushdownheight=document.getElementById('usersheading').offsetHeight;if(document.getElementById('usersviewing')){taigapushdownheight+=document.getElementById('viewingheader').offsetHeight;taigapushdownheight+=document.getElementById('usersviewing').offsetHeight;taigapushdownheight+=document.getElementById('onlineheader').offsetHeight;taigapushdownheight+=14;}
else{if(document.getElementById('onlineheadernoviewing')){taigapushdownheight+=document.getElementById('onlineheadernoviewing').offsetHeight;}}
var taigausersonlineheight=taigawindowheight-taigapushdownheight;if(document.getElementById('usersonline')){document.getElementById('usersonline').style.maxHeight=taigausersonlineheight-14+'px';}}}
function taigastaticpostmaxheightset(){if(document.getElementById('staticheader')){var taigatopheight=document.getElementById('staticheader').offsetHeight;var taigabottomheight=document.getElementById('bottomarea').offsetHeight;var taigastaticpostpadding=taigatopheight+document.getElementById('mainbarcontainer').offsetHeight;var taigawindowheight=taigagetwindowheight();var taigastaticmaxheight=taigawindowheight-taigastaticpostpadding-taigabottomheight;document.getElementById('staticfirstpost').style.maxHeight=taigastaticmaxheight+'px';}}
function taigastaticpostspaddingset(){if(document.getElementById('staticfirstpost')){var taigastaticpostwidth=document.getElementById('staticfirstpost').offsetWidth;var taigapadding=taigastaticpostwidth+3;var taigapagewidth=document.getElementById('wholepagecontainer').offsetWidth;var taiganonstaticpostswidth=taigapagewidth-taigapadding;var taigatoswitch=document.getElementById('staticpostscontainer');taigatoswitch.style.left=taigapadding+'px';taigatoswitch.style.width=taiganonstaticpostswidth+'px';}}
window.onresize=function(){taigastaticpostmaxheightset();taigastaticpostspaddingset();taigauserlistonlineheightset();}
function taigaswapsearchfids(taigaon){var taigathings=getElementsByClassName('searchfidbox');for(var i=0;i<taigathings.length;i++){taigathings[i].checked=false;}}
function taigaswapsearchdays(taigaon){var taigathings=getElementsByClassName('searchdateinput');for(var i=0;i<taigathings.length;i++){if(taigaon){if(i==0){taigathings[i].focus();}}else{taigathings[i].value='';}}}
function taigaswapsearchusernames(taigathing){if(taigathing.checked){document.getElementById('searchusernames').focus();}else{document.getElementById('searchusernames').value='';}}
function taigacheckcheckbox(taigathing){document.getElementById(taigathing).checked='checked';}
function taigadisableelement(taigathing){document.getElementById(taigathing).disabled='disabled';}
function taigaenableelement(taigathing){document.getElementById(taigathing).disabled=false;}
function handlesearchtypecheckboxes(){return;if(document.getElementById('searchtext').checked&&!document.getElementById('searchsubject').checked){taigadisableelement('searchtext');}else if(!document.getElementById('searchtext').checked&&document.getElementById('searchsubject').checked){taigadisableelement('searchsubject');}else if(document.getElementById('searchtext').checked&&document.getElementById('searchsubject').checked){taigaenableelement('searchtext');taigaenableelement('searchsubject');}}
function taigapmaddremoveuser(taigaddremove,taigatid,taigauid,taigawarn,taigahuman){if(taigawarn){if(!confirm(lang__really_remove_yourself_from_pm)){return;}}
if(taigaddremove=='add'){taigauid=document.getElementById('usernameinput_'+taigahuman).value;}
if(!taigauid){return;}
var taigaParams='taiga=pmaddremoveuser&addremove='+taigaddremove+'&uid='+taigauid+'&tid='+taigatid;var xmlhttp=taigaNewAjax();xmlhttp.open("POST",taigaurlencodeexceptslashesifie(document.location.pathname),true);xmlhttp.setRequestHeader("Content-type","application/x-www-form-urlencoded");xmlhttp.onreadystatechange=function(){if(xmlhttp.readyState==4){taigastyleswitch('ajaxloading');if(xmlhttp.status==200){if(xmlhttp.responseText!='OK'){alert(xmlhttp.responseText);}else{if(taigaddremove=='add'&&document.getElementById('usernameinput_'+taigahuman)){document.getElementById('usernameinput_'+taigahuman).value='';}}}else{alert(lang__sorry_an_error_occurred_please_try_your_request_again);}}}
taigastyleswitch('ajaxloading');xmlhttp.send(taigaParams);}
function taigatogglewebdeveloperapiinputs(){if(document.getElementById('usewebdeveloperapientry').checked==true){document.getElementById('sessioncookienameentry').disabled=false;document.getElementById('customregistrationurlentry').disabled=false;document.getElementById('customloginurlentry').disabled=false;document.getElementById('customlogouturlentry').disabled=false;}else{document.getElementById('sessioncookienameentry').disabled='disabled';document.getElementById('customregistrationurlentry').disabled='disabled';document.getElementById('customloginurlentry').disabled='disabled';document.getElementById('customlogouturlentry').disabled='disabled';}}
function taigaunescapehtml(taigastring){taigastring=taigastring.replace(/&#39;/g,"'");taigastring=taigastring.replace(/&quot;/g,'"');taigastring=taigastring.replace(/&lt;/g,'<');taigastring=taigastring.replace(/&gt;/g,'>');taigastring=taigastring.replace(/&amp;/g,'&');return taigastring;}
