var _d=document;var _w=window;var d=document;var w=window;var siteurl="/";var disable_animations=false;var window_loaded=false;if(d.addEventListener){d.addEventListener("load",window_onload,false);w.addEventListener("load",window_onload,false);}
else if(d.attachEvent){d.attachEvent("onload",window_onload);w.attachEvent("onload",window_onload);}
function window_onload(){if(window_loaded){return;}
window_loaded=true;setInterval(keep_session,300000);if(posts_synchronize){setTimeout(posts_synchronize,15000);}
if(dbrd_check_tabs){if(w.location.pathname&&w.location.pathname.match("/dashboard")){setTimeout(dbrd_check_tabs,10000);}}}
function keep_session()
{var req=ajax_init();if(!req){return;}
req.onreadystatechange=function(){};req.open("POST",siteurl+"ajax/keepsession/r:"+Math.round(Math.random()*1000),true);req.setRequestHeader("Content-type","application/x-www-form-urlencoded");req.send(null);}
function ajax_init(is_xml)
{var req=false;if(w.XMLHttpRequest){req=new XMLHttpRequest();if(req.overrideMimeType){if(is_xml){req.overrideMimeType("application/xml");}
else{req.overrideMimeType("text/plain");}}}else if(w.ActiveXObject){try{req=new w.ActiveXObject("MSXML3.XMLHTTP");}catch(exptn){try{req=new w.ActiveXObject("MSXML2.XMLHTTP.3.0");}catch(exptn){try{req=new w.ActiveXObject("Msxml2.XMLHTTP");}catch(exptn){try{req=new w.ActiveXObject("Microsoft.XMLHTTP");}catch(exptn){}}}}}
return req;}
function obj_find_coords(obj)
{var X=0,Y=0;if(obj.offsetParent){X=obj.offsetLeft;Y=obj.offsetTop;if(obj.offsetParent){do{obj=obj.offsetParent;X+=obj.offsetLeft;Y+=obj.offsetTop;}
while(obj.offsetParent);}}
return[X,Y];}
function get_screen_preview_size()
{var w=0,h=0;if(typeof(window.innerWidth)=='number'){w=window.innerWidth;h=window.innerHeight;}
else if(document.documentElement&&(document.documentElement.clientWidth||document.documentElement.clientHeight)){w=document.documentElement.clientWidth;h=document.documentElement.clientHeight;}
else if(document.body&&(document.body.clientWidth||document.body.clientHeight)){w=document.body.clientWidth;h=document.body.clientHeight;}
return[w,h];}
function get_screen_scroll()
{var x=0,y=0;if(typeof(window.pageYOffset)=='number'){x=window.pageXOffset;y=window.pageYOffset;}else if(document.body&&(document.body.scrollLeft||document.body.scrollTop)){x=document.body.scrollLeft;y=document.body.scrollTop;}else if(document.documentElement&&(document.documentElement.scrollLeft||document.documentElement.scrollTop)){y=document.documentElement.scrollTop;x=document.documentElement.scrollLeft;}
return[x,y];}
function preload_img()
{var tmp=[];for(var i=0;i<arguments.length;i++){tmp[i]=new Image();tmp[i].src=arguments[i];}}
var dropdivs={};var dropdiv_dropstep_px=10;var dropdiv_dropstep_tm=1;function dropdiv_open(div_id,height_offset)
{if(dropdivs[div_id]==1){return dropdiv_close(div_id);}
if(dropdivs[div_id]==2){return false;}
var div=_d.getElementById(div_id);if(!div){return false;}
if(disable_animations){dropdivs[div_id]=1;div.style.display="block";if(_d.addEventListener){_d.addEventListener("mouseup",function(){dropdiv_close(div_id);},false);}
else if(_d.attachEvent){_d.attachEvent("onmouseup",function(){dropdiv_close(div_id);});}
return true;}
var height=parseInt(div.style.height,10);if(!height){div.style.visiblity="hidden";div.style.display="block";height=parseInt(div.clientHeight,10);div.style.display="none";div.style.visiblity="visible";if(height_offset){height+=height_offset;}}
if(!height){return false;}
var h=0;var func=function(){div.style.height=h+"px";if(h>=height){dropdivs[div_id]=1;div.style.height=height+"px";div.style.overflow=div.getAttribute("orig_overflow");if(_d.addEventListener){_d.addEventListener("mouseup",function(){dropdiv_close(div_id);},false);}
else if(_d.attachEvent){_d.attachEvent("onmouseup",function(){dropdiv_close(div_id);});}
return true;}
h+=dropdiv_dropstep_px;setTimeout(func,dropdiv_dropstep_tm);};var tmp=div.getAttribute("orig_overflow");if(!tmp){tmp=div.style.overflow?div.style.overflow:"visible";}
div.setAttribute("orig_overflow",tmp);div.style.overflow="hidden";div.style.display="block";dropdivs[div_id]=2;func();}
function dropdiv_close(div_id,do_it_fast)
{if(dropdivs[div_id]==0){return true;}
if(dropdivs[div_id]==2){return false;}
var div=_d.getElementById(div_id);if(!div){return false;}
if(disable_animations||do_it_fast){div.style.display="none";dropdivs[div_id]=0;return;}
var h=parseInt(div.style.height,10);var orig_h=h;var func=function(){div.style.height=Math.max(0,h)+"px";if(h<=0){div.style.display="none";div.style.height=orig_h+"px";dropdivs[div_id]=0;return true;}
h-=dropdiv_dropstep_px;setTimeout(func,dropdiv_dropstep_tm);};div.style.overflow="hidden";dropdivs[div_id]=2;func();}
function hdr_search_settype(val,txt)
{_d.getElementById("search_drop_lnk").innerHTML=txt;_d.search_form.lookin.value=val;_d.search_form.lookfor.focus();}
function trim(str)
{if(typeof(str)!="string"){return str;}
str=str.replace(/^\s+/,"");str=str.replace(/\s+$/,"");return str;}
function ltrim(str)
{if(typeof(str)!="string"){return str;}
str=str.replace(/^\s+/,"");return str;}
function userpage_top_tooltip(txt)
{var dv=d.getElementById("usrpg_top_tooltip");if(!dv||!dv.firstChild){return;}
if(txt==""){dv.style.display="none";dv.firstChild.innerHTML="";}
else{dv.firstChild.innerHTML=txt;dv.style.display="block";}}
function user_follow(username,thislink,unfollow_linkid,msg_after)
{var req=ajax_init(false);if(!req){return;}
req.onreadystatechange=function(){if(req.readyState!=4){return;}
if(req.responseText!="OK"){return;}
thislink.style.cursor="pointer";thislink.style.display="none";if(unfollow_linkid){d.getElementById(unfollow_linkid).style.display="block";}
if(msg_after){slim_msgbox(msg_after);}}
req.open("POST",siteurl+"ajax/follow/r:"+Math.round(Math.random()*1000),true);req.setRequestHeader("Content-type","application/x-www-form-urlencoded");req.send("type=on&username="+encodeURIComponent(username));thislink.style.cursor="wait";}
function user_unfollow(username,thislink,follow_linkid,confirm_msg,msg_after)
{var req=ajax_init(false);if(!req){return;}
if(!confirm(confirm_msg)){return;}
req.onreadystatechange=function(){if(req.readyState!=4){return;}
if(req.responseText!="OK"){return;}
thislink.style.cursor="pointer";thislink.style.display="none";d.getElementById(follow_linkid).style.display="block";if(msg_after){slim_msgbox(msg_after);}}
req.open("POST",siteurl+"ajax/follow/r:"+Math.round(Math.random()*1000),true);req.setRequestHeader("Content-type","application/x-www-form-urlencoded");req.send("type=off&username="+encodeURIComponent(username));thislink.style.cursor="wait";}
function group_follow(groupname,thislink,unfollow_linkid,msg_after)
{var req=ajax_init(false);if(!req){return;}
req.onreadystatechange=function(){if(req.readyState!=4){return;}
if(req.responseText!="OK"){return;}
thislink.style.cursor="pointer";thislink.style.display="none";d.getElementById(unfollow_linkid).style.display="block";if(msg_after){slim_msgbox(msg_after);}}
req.open("POST",siteurl+"ajax/follow/r:"+Math.round(Math.random()*1000),true);req.setRequestHeader("Content-type","application/x-www-form-urlencoded");req.send("type=on&groupname="+encodeURIComponent(groupname));thislink.style.cursor="wait";}
function group_unfollow(groupname,thislink,follow_linkid,confirm_msg,msg_after)
{var req=ajax_init(false);if(!req){return;}
if(!confirm(confirm_msg)){return;}
req.onreadystatechange=function(){if(req.readyState!=4){return;}
if(req.responseText!="OK"){return;}
thislink.style.cursor="pointer";thislink.style.display="none";d.getElementById(follow_linkid).style.display="block";if(msg_after){slim_msgbox(msg_after);}}
req.open("POST",siteurl+"ajax/follow/r:"+Math.round(Math.random()*1000),true);req.setRequestHeader("Content-type","application/x-www-form-urlencoded");req.send("type=off&groupname="+encodeURIComponent(groupname));thislink.style.cursor="wait";}
var msgbox_to_close={};function msgbox_close(which){if(which){if(msgbox_to_close[which]==true){pf_htmlobjects_shown[which]=1;postform_htmlobject_hide(which);}
msgbox_to_close[which]=null;return;}
for(var i in msgbox_to_close){if(msgbox_to_close[i]!=true){continue;}
msgbox_close(i);}}
function slim_msgbox(msg)
{var dv=d.getElementById("slim_msgbox");if(!dv){return;}
if(pf_htmlobjects_shown["slim_msgbox"]==1){postform_htmlobject_hide("slim_msgbox",function(){slim_msgbox(msg);});return;}
d.getElementById("slim_msgbox_msg").innerHTML=msg;postform_htmlobject_show("slim_msgbox",36,function(){msgbox_to_close.slim_msgbox=true;});}
var dbrd_tabs_to_check=["all","@me","private","commented","feeds","tweets"];var dbrd_tabs_timeout=false;function dbrd_check_tabs()
{if(dbrd_tabs_to_check.length==0){return;}
var req=ajax_init(false);if(!req){return;}
req.onreadystatechange=function(){if(req.readyState!=4){return;}
if(!req.responseText){return;}
var txt=ltrim(req.responseText);if(txt.substr(0,3)!="OK:"){return;}
txt=trim(txt.substr(3));txt=txt.split("\n");if(txt.length>0){var i,j,tb,nm,dv;for(i=0;i<txt.length;i++){txt[i]=txt[i].split(":");if(txt[i].length!=2){continue;}
tb=trim(txt[i][0]);nm=parseInt(txt[i][1],10);if(tb!="all"&&tb!="@me"&&tb!="private"&&tb!="commented"&&tb!="feeds"&&tb!="tweets"){continue;}
dv=d.getElementById(tb=="@me"?"dbrd_tab_mention":("dbrd_tab_"+tb));if(dv&&nm>0&&dv.parentNode.parentNode.className.indexOf("onitem")==-1){dv.innerHTML=nm;dv.style.display="block";}
else if(dv&&nm==0){dv.innerHTML="";dv.style.display="none";}}}
dbrd_tabs_timeout=setTimeout(dbrd_check_tabs,180000);};req.open("POST",siteurl+"ajax/checktabs/r:"+Math.round(Math.random()*1000),true);req.setRequestHeader("Content-type","application/x-www-form-urlencoded");req.send("checktabs="+encodeURIComponent(dbrd_tabs_to_check.join(",")));if(dbrd_tabs_timeout){clearTimeout(dbrd_tabs_timeout);dbrd_tabs_timeout=false;}}
var dbrd_box_height=false;function dbrd_whattodo_show()
{if(!dbrd_box_height){var dv=d.getElementById("greentodo");dv.style.visibility="hidden";dv.style.display="block";dbrd_box_height=parseInt(dv.clientHeight,10);dv.style.display="none";dv.style.visibility="visible";}
d.cookie="dbrd_whattodo_mnm=0;expires="+(new Date(new Date().getTime()+61*24*60*60*1000).toGMTString())+";path=/";pf_htmlobjects_shown["closedgtd"]=1;postform_htmlobject_hide("closedgtd",function(){postform_htmlobject_show("greentodo",dbrd_box_height)});var req=ajax_init(false);if(req){req.onreadystatechange=function(){}
req.open("POST",siteurl+"dashboard/from:ajax/r:"+Math.round(Math.random()*1000),true);req.setRequestHeader("Content-type","application/x-www-form-urlencoded");req.send("toggle_whattodo=1");}}
function dbrd_whattodo_hide()
{dbrd_box_height=parseInt(d.getElementById("greentodo").clientHeight,10);pf_htmlobjects_shown["greentodo"]=1;postform_htmlobject_hide("greentodo",function(){postform_htmlobject_show("closedgtd",25)});var req=ajax_init(false);if(req){req.onreadystatechange=function(){}
req.open("POST",siteurl+"dashboard/from:ajax/r:"+Math.round(Math.random()*1000),true);req.setRequestHeader("Content-type","application/x-www-form-urlencoded");req.send("toggle_whattodo=0");}}
function dbrd_hide_wrongaddr_warning()
{var h=parseInt(d.getElementById("dbrd_wrongaddr_warning").clientHeight,10);pf_htmlobjects_shown["dbrd_wrongaddr_warning"]=1;postform_htmlobject_hide("dbrd_wrongaddr_warning");var req=ajax_init(false);if(req){req.onreadystatechange=function(){}
req.open("POST",siteurl+"dashboard/from:ajax/r:"+Math.round(Math.random()*1000),true);req.setRequestHeader("Content-type","application/x-www-form-urlencoded");req.send("hide_wrongaddr_warning=1");}}
var dbrd_grpmenu_height=false;var dbrd_grpmenu_showst=0;function dbrd_groupmenu_toggle()
{if(dbrd_grpmenu_showst==2){return;}
if(!dbrd_grpmenu_height){var dv=d.getElementById("dbrd_menu_groups");if(dv.style.display!="none"){dbrd_grpmenu_height=parseInt(dv.clientHeight,10);}
else{dv.style.visibility="hidden";dv.style.display="block";dbrd_grpmenu_height=parseInt(dv.clientHeight,10);dv.style.display="none";dv.style.visibility="visible";}}
if(dbrd_grpmenu_showst==0){dbrd_grpmenu_showst=2;pf_htmlobjects_shown["dbrd_menu_groups"]=0;postform_htmlobject_show("dbrd_menu_groups",dbrd_grpmenu_height,function(){dbrd_grpmenu_showst=1;});d.getElementById("dbrd_menu_groupsbtn").className="dropio dropped";var req=ajax_init(false);if(req){req.onreadystatechange=function(){}
req.open("POST",siteurl+"dashboard/from:ajax/r:"+Math.round(Math.random()*1000),true);req.setRequestHeader("Content-type","application/x-www-form-urlencoded");req.send("toggle_grpmenu=1");}}
else{dbrd_grpmenu_showst=2;pf_htmlobjects_shown["dbrd_menu_groups"]=1;postform_htmlobject_hide("dbrd_menu_groups",function(){dbrd_grpmenu_showst=0;});d.getElementById("dbrd_menu_groupsbtn").className="dropio";var req=ajax_init(false);if(req){req.onreadystatechange=function(){}
req.open("POST",siteurl+"dashboard/from:ajax/r:"+Math.round(Math.random()*1000),true);req.setRequestHeader("Content-type","application/x-www-form-urlencoded");req.send("toggle_grpmenu=0");}}}
function srchposts_togglefilt(which)
{var lnk=d.getElementById("srchposts_droplnk_"+which);var box=d.getElementById("srchposts_dropbox_"+which);var ison=box.style.display=="block";if(ison){lnk.className="sdropper";box.style.display="none"}
else{lnk.className="sdropper dropppped";box.style.display="block"}}
function save_search_on(ajax_url)
{var req=ajax_init(false);if(!req){return;}
var lnk_on=d.getElementById("savesearch");var lnk_off=d.getElementById("remsearch");req.onreadystatechange=function(){if(req.readyState!=4){return;}
var txt=ltrim(req.responseText);if(txt.substr(0,3)!="OK:"){return;}
lnk_on.style.cursor="pointer";lnk_on.style.display="none";lnk_off.style.display="block";}
req.open("POST",ajax_url+"/r:"+Math.round(Math.random()*1000),true);req.setRequestHeader("Content-type","application/x-www-form-urlencoded");req.send("savesearch=on");lnk_on.style.cursor="wait";}
function save_search_off(ajax_url,confirm_msg)
{var req=ajax_init(false);if(!req){return;}
if(!confirm(confirm_msg)){return;}
var lnk_on=d.getElementById("savesearch");var lnk_off=d.getElementById("remsearch");req.onreadystatechange=function(){if(req.readyState!=4){return;}
var txt=ltrim(req.responseText);if(txt.substr(0,3)!="OK:"){return;}
lnk_off.style.cursor="pointer";lnk_off.style.display="none";lnk_on.style.display="block";}
req.open("POST",ajax_url+"/r:"+Math.round(Math.random()*1000),true);req.setRequestHeader("Content-type","application/x-www-form-urlencoded");req.send("savesearch=off");lnk_off.style.cursor="wait";}
;var d=document;var w=window;if(d.addEventListener){d.addEventListener("load",input_set_autocomplete,false);w.addEventListener("load",input_set_autocomplete,false);}
else if(d.attachEvent){d.attachEvent("onload",input_set_autocomplete);w.attachEvent("onload",input_set_autocomplete);}
var autocomplete_allset=false;var autocomplete_open=false;var autocomplete_data={};function input_set_autocomplete()
{if(autocomplete_allset){return;}
autocomplete_allset=true;var all=d.getElementsByTagName("INPUT");for(var i=0;i<all.length;i++){input_set_autocomplete_to(all[i]);}
var fsdfgh=function(){setTimeout(input_hide_autocompletes,100);}
var all=d.getElementsByTagName("TEXTAREA");for(var i=0;i<all.length;i++){input_set_autocomplete_toarea(all[i]);}
if(d.addEventListener){d.addEventListener("mouseup",fsdfgh,false);}
else if(d.attachEvent){d.attachEvent("onmouseup",fsdfgh);}}
function input_set_autocomplete_to(obj)
{if(obj.type!="text"){return;}
if(obj.getAttribute("rel")!="autocomplete"){return;}
obj.setAttribute("autocomplete","off");obj.setAttribute("uniqindex",Math.round(Math.random()*99999));var f_onfocus=function(){input_hide_autocompletes();};var f_onkeydown=function(e){if(!e&&w.event){e=w.event;}
if(!e||(!e.keyCode&&!e.charCode)){return;}
var code=e.charCode?e.charCode:e.keyCode;if(code==38||code==40){input_scroll_autocomplete(code==38?"UP":"DOWN");return false;}};var f_onkeyup=function(e){if(!e&&w.event){e=w.event;}
if(!e||(!e.keyCode&&!e.charCode)){return;}
var code=e.charCode?e.charCode:e.keyCode;if((code>=48&&code<=57)||(code>=65&&code<=90)||(code>=97&&code<=122)||(code>=1040&&code<=1103)||(code==34||code==39||code==45)){obj.setAttribute("origvalue",obj.value);input_show_autocomplete(obj);}};var f_onkeypress=function(e){if(!e&&w.event){e=w.event;}
if(!e||(!e.keyCode&&!e.charCode)){return;}
var code=e.charCode?e.charCode:e.keyCode;if(code==13&&autocomplete_open&&autocomplete_data.id==obj.getAttribute("uniqindex")){input_scroll_autocomplete_to(autocomplete_data.focusIndex);if(autocomplete_data.data[autocomplete_data.focusIndex]){var sdf=autocomplete_data.data[autocomplete_data.focusIndex];sdf[2](sdf[0],sdf[1]);if(e.preventDefault){e.preventDefault();}
else{e.returnValue=false;}}
input_hide_autocompletes();return false;}};var f_onblur=function(){setTimeout(input_hide_autocompletes,1000);};if(obj.addEventListener){obj.addEventListener("focus",f_onfocus,false);obj.addEventListener("keydown",f_onkeydown,false);obj.addEventListener("keypress",f_onkeypress,false);obj.addEventListener("keyup",f_onkeyup,false);obj.addEventListener("blur",f_onblur,false);}
else if(obj.attachEvent){obj.attachEvent("onfocus",f_onfocus);obj.attachEvent("onkeydown",f_onkeydown);obj.attachEvent("onkeypress",f_onkeypress);obj.attachEvent("onkeyup",f_onkeyup);obj.attachEvent("onblur",f_onblur);}}
function input_show_autocomplete(obj)
{input_hide_autocompletes();if(autocomplete_open&&autocomplete_data.id==obj.getAttribute("uniqindex")&&autocomplete_data.word==obj.getAttribute("origvalue")){return;}
var callbck_after=function(){};if(obj.getAttribute("autocompleteafter")){callbck_after=function(){try{eval(obj.getAttribute("autocompleteafter"))}catch(e){};};}
var f_only_fill=function(word,url){input_hide_autocompletes();obj.value=word;callbck_after();};var f_fill_submit=function(word,url){input_hide_autocompletes();obj.value=word;obj.form.submit();callbck_after();};var f_fill_redirect=function(word,url){input_hide_autocompletes();obj.value=word;w.location.href=url;callbck_after();};var f_fill_callback=function(word,url){input_hide_autocompletes();obj.value=word;var c=obj.getAttribute("autocompletecallback");if(c){try{eval(c)}catch(e){}}
callbck_after();};var datatype=false;var jsaction=f_only_fill;if(obj.name=="username"||obj.name=="groupname"){datatype=obj.name;}
else if(obj.name=="lookfor"){if(obj.form.lookin.value=="users"){datatype="username";jsaction=f_fill_redirect;}
else if(obj.form.lookin.value=="groups"){datatype="groupname";jsaction=f_fill_redirect;}}
else if(obj.name=="privusr_inp"){datatype="username";jsaction=f_fill_callback;}
else if(obj.name=="puser"&&obj.form.name=="psrch"){datatype="username";jsaction=f_only_fill;}
else if(obj.name=="pgroup"&&obj.form.name=="psrch"){datatype="groupname";jsaction=f_only_fill;}
else if(obj.name=="deluser"&&obj.form.name=="deluser"){datatype="username";jsaction=f_only_fill;}
else if(obj.name=="editusername"&&obj.form.name=="edituser"){datatype="username";jsaction=f_fill_submit;}
if(!datatype){return;}
if(obj.value.length<2){return;}
var req=ajax_init(true);if(!req){return;}
autocomplete_open=obj;autocomplete_data=({id:-1,word:"",loaded:false,data:[],focusIndex:false});autocomplete_data.id=obj.getAttribute("uniqindex");autocomplete_data.word=obj.value;obj.setAttribute("origvalue",obj.value);var dv=d.createElement("DIV");dv.id="inp_dropbox_"+autocomplete_data.id;dv.className="recdrop";dv.style.display="none";dv.style.position="absolute";var coords=obj_find_coords(obj);var tmph=parseInt(obj.clientHeight,10);if(!tmph){tmph=parseInt(obj.style.height,10)+2;}
if(!tmph){tmph=23;}
coords[1]+=tmph;var tmpof=obj.getAttribute("autocompleteoffset");if(tmpof){tmpof=tmpof.split(",");tmpof[0]=parseInt(tmpof[0],10);tmpof[1]=parseInt(tmpof[1],10);if(!isNaN(tmpof[0])){coords[0]+=tmpof[0];}
if(!isNaN(tmpof[1])){coords[1]+=tmpof[1];}}
dv.style.left=coords[0]+"px";dv.style.top=coords[1]+"px";req.onreadystatechange=function(){if(req.readyState!=4){return;}
if(obj.value!=autocomplete_data.word){return;}
if(obj.getAttribute("uniqindex")!=autocomplete_data.id){return;}
if(!req.responseXML){return;}
var data=req.responseXML.getElementsByTagName("result");if(!data||!data[0]){return;}
data=data[0].getElementsByTagName("row");var i,j,word,url,html,dv2;for(i=0;i<data.length;i++){word=data[i].getAttribute("word");url=data[i].getAttribute("url");html=data[i].getAttribute("html");if(!word||!html){continue;}
j=autocomplete_data.data.length;autocomplete_data.data[j]=[word,url,jsaction];dv2=d.createElement("DIV");dv2.id="inp_dropbox_"+autocomplete_data.id+"_row_"+j;dv2.innerHTML=html;dv2.setAttribute("autorowindex",j);dv2.onmouseover=function(){input_scroll_autocomplete_to(this.getAttribute("autorowindex"),true);}
dv2.onclick=function(){input_scroll_autocomplete_to(this.getAttribute("autorowindex"));if(autocomplete_data.data[autocomplete_data.focusIndex]){var sdf=autocomplete_data.data[autocomplete_data.focusIndex];sdf[2](sdf[0],sdf[1]);}
input_hide_autocompletes();};dv.appendChild(dv2);}
if(j==0&&autocomplete_data.data[j][1]==obj.value){return;}
autocomplete_data.loaded=true;if(autocomplete_data.data.length>0){dv.style.display="";}}
d.body.appendChild(dv);req.open("POST",siteurl+"ajax/autocomplete/ajaxtp:xml/r:"+Math.round(Math.random()*1000),true);req.setRequestHeader("Content-type","application/x-www-form-urlencoded");req.send("datatype="+encodeURIComponent(datatype)+"&word="+encodeURIComponent(autocomplete_data.word));}
function input_hide_autocompletes()
{if(!autocomplete_open){return;}
var box=d.getElementById("inp_dropbox_"+autocomplete_open.getAttribute("uniqindex"));if(box){box.style.display="none";box.parentNode.removeChild(box);}
autocomplete_open=false;autocomplete_data={};}
function input_scroll_autocomplete(dir)
{if(!autocomplete_open){return;}
if(autocomplete_data.focusIndex===false){nw=dir=="DOWN"?0:(autocomplete_data.data.length-1);}
else{nw=autocomplete_data.focusIndex+(dir=="DOWN"?1:-1);if(nw==autocomplete_data.data.length){nw=0;}else
if(nw==-1){nw=autocomplete_data.data.length-1;}}
input_scroll_autocomplete_to(nw);}
function input_scroll_autocomplete_to(pos,dontshow)
{if(!autocomplete_open){return;}
if(autocomplete_data.focusIndex!==false){var old=d.getElementById("inp_dropbox_"+autocomplete_data.id+"_row_"+autocomplete_data.focusIndex);if(old){old.className="";}}
if(pos!==false&&autocomplete_data.data[pos]){pos=parseInt(pos,10);if(!dontshow){autocomplete_open.value=autocomplete_data.data[pos][0];}
autocomplete_data.focusIndex=pos;var nw=d.getElementById("inp_dropbox_"+autocomplete_data.id+"_row_"+pos);if(nw){nw.className="selected";}}}
function input_set_autocomplete_toarea(obj)
{if(obj.type!="textarea"){return;}
if(obj.getAttribute("rel")!="autocomplete"){return;}
obj.setAttribute("autocomplete","off");obj.setAttribute("uniqindex",Math.round(Math.random()*99999));var f_onfocus=function(){input_hide_autocompletes();};var f_onkeydown=function(e){if(!e&&w.event){e=w.event;}
if(!e||(!e.keyCode&&!e.charCode)){return;}
var code=e.charCode?e.charCode:e.keyCode;if(code==38||code==40){input_scroll_autocomplete_area(code==38?"UP":"DOWN");return false;}};var f_onkeyup=function(e){if(!e&&w.event){e=w.event;}
if(!e||(!e.keyCode&&!e.charCode)){return;}
var code=e.charCode?e.charCode:e.keyCode;var str=obj.value;var len=str.length;var occur=str.lastIndexOf('@');if(occur>=0)
{if((code>=48&&code<=57)||(code>=65&&code<=90)||(code>=97&&code<=122)||(code>=1040&&code<=1103)||(code==34||code==39||code==45)){var val=str.substring(occur+1,len);obj.setAttribute("origvalue",val);input_show_autocomplete_textarea(obj);}}};var f_onkeypress=function(e){if(!e&&w.event){e=w.event;}
if(!e||(!e.keyCode&&!e.charCode)){return;}
var code=e.charCode?e.charCode:e.keyCode;if(code==13&&autocomplete_open&&autocomplete_data.id==obj.getAttribute("uniqindex")){input_scroll_autocomplete_toarea(autocomplete_data.focusIndex);if(autocomplete_data.data[autocomplete_data.focusIndex]){var sdf=autocomplete_data.data[autocomplete_data.focusIndex];sdf[2](sdf[0],sdf[1]);if(e.preventDefault){e.preventDefault();}
else{e.returnValue=false;}}
input_hide_autocompletes();return false;}};var f_onblur=function(){setTimeout(input_hide_autocompletes,1000);};if(obj.addEventListener){obj.addEventListener("focus",f_onfocus,false);obj.addEventListener("keydown",f_onkeydown,false);obj.addEventListener("keypress",f_onkeypress,false);obj.addEventListener("keyup",f_onkeyup,false);obj.addEventListener("blur",f_onblur,false);}
else if(obj.attachEvent){obj.attachEvent("onfocus",f_onfocus);obj.attachEvent("onkeydown",f_onkeydown);obj.attachEvent("onkeypress",f_onkeypress);obj.attachEvent("onkeyup",f_onkeyup);obj.attachEvent("onblur",f_onblur);}}
function input_show_autocomplete_textarea(obj)
{input_hide_autocompletes();var val=obj.getAttribute("origvalue")
if(autocomplete_open&&autocomplete_data.id==obj.getAttribute("uniqindex")&&autocomplete_data.word==obj.getAttribute("origvalue")){return;}
var callbck_after=function(){};if(obj.getAttribute("autocompleteafter")){callbck_after=function(){try{eval(obj.getAttribute("autocompleteafter"))}catch(e){};};}
var f_only_filltextarea=function(word,url){input_hide_autocompletes();var str=obj.value;var len=str.length;var occur=str.lastIndexOf('@');var valuebefore=str.substring(0,occur+1);obj.value=valuebefore+word;callbck_after();};var datatype=false;var jsaction=f_only_filltextarea;if(obj.name=="message"){datatype="username";jsaction=f_only_filltextarea;}
if(obj.name=="comment"){datatype="username";jsaction=f_only_filltextarea;}
if(!datatype){return;}
if(val.length<2){return;}
var req=ajax_init(true);if(!req){return;}
autocomplete_open=obj;autocomplete_data=({id:-1,word:"",loaded:false,data:[],focusIndex:false});autocomplete_data.id=obj.getAttribute("uniqindex");autocomplete_data.word=val;obj.setAttribute("origvalue",val);var dv=d.createElement("DIV");dv.id="inp_dropbox_"+autocomplete_data.id;dv.className="recdrop";dv.style.display="none";dv.style.position="absolute";var coords=obj_find_coords(obj);var tmph=parseInt(obj.clientHeight,10);if(!tmph){tmph=parseInt(obj.style.height,10)+2;}
if(!tmph){tmph=23;}
coords[1]+=tmph;var tmpof=obj.getAttribute("autocompleteoffset");if(tmpof){tmpof=tmpof.split(",");tmpof[0]=parseInt(tmpof[0],10);tmpof[1]=parseInt(tmpof[1],10);if(!isNaN(tmpof[0])){coords[0]+=tmpof[0];}
if(!isNaN(tmpof[1])){coords[1]+=tmpof[1];}}
dv.style.left=coords[0]+"px";dv.style.top=coords[1]+"px";req.onreadystatechange=function(){if(req.readyState!=4){return;}
if(val!=autocomplete_data.word){return;}
if(obj.getAttribute("uniqindex")!=autocomplete_data.id){return;}
if(!req.responseXML){return;}
var data=req.responseXML.getElementsByTagName("result");if(!data||!data[0]){return;}
data=data[0].getElementsByTagName("row");var i,j,word,url,html,dv2;for(i=0;i<data.length;i++){word=data[i].getAttribute("word");url=data[i].getAttribute("url");html=data[i].getAttribute("html");if(!word||!html){continue;}
j=autocomplete_data.data.length;autocomplete_data.data[j]=[word,url,jsaction];dv2=d.createElement("DIV");dv2.id="inp_dropbox_"+autocomplete_data.id+"_row_"+j;dv2.innerHTML=html;dv2.setAttribute("autorowindex",j);dv2.onmouseover=function(){input_scroll_autocomplete_toarea(this.getAttribute("autorowindex"),true);}
dv2.onclick=function(){input_scroll_autocomplete_toarea(this.getAttribute("autorowindex"));if(autocomplete_data.data[autocomplete_data.focusIndex]){var sdf=autocomplete_data.data[autocomplete_data.focusIndex];sdf[2](sdf[0],sdf[1]);}
input_hide_autocompletes();};dv.appendChild(dv2);}
if(j==0&&autocomplete_data.data[j][1]==val){return;}
autocomplete_data.loaded=true;if(autocomplete_data.data.length>0){dv.style.display="";}}
d.body.appendChild(dv);req.open("POST",siteurl+"ajax/autocomplete/ajaxtp:xml/r:"+Math.round(Math.random()*1000),true);req.setRequestHeader("Content-type","application/x-www-form-urlencoded");req.send("datatype="+encodeURIComponent(datatype)+"&word="+encodeURIComponent(autocomplete_data.word));}
function input_scroll_autocomplete_toarea(pos,dontshow)
{if(!autocomplete_open){return;}
if(autocomplete_data.focusIndex!==false){var old=d.getElementById("inp_dropbox_"+autocomplete_data.id+"_row_"+autocomplete_data.focusIndex);if(old){old.className="";}}
if(pos!==false&&autocomplete_data.data[pos]){pos=parseInt(pos,10);if(!dontshow){var str=autocomplete_open.value;var len=str.length;var occur=str.lastIndexOf('@');var valuebefore=str.substring(0,occur+1);autocomplete_open.value=valuebefore+autocomplete_data.data[pos][0];}
autocomplete_data.focusIndex=pos;var nw=d.getElementById("inp_dropbox_"+autocomplete_data.id+"_row_"+pos);if(nw){nw.className="selected";}}}
function input_scroll_autocomplete_area(dir)
{if(!autocomplete_open){return;}
if(autocomplete_data.focusIndex===false){nw=dir=="DOWN"?0:(autocomplete_data.data.length-1);}
else{nw=autocomplete_data.focusIndex+(dir=="DOWN"?1:-1);if(nw==autocomplete_data.data.length){nw=0;}else
if(nw==-1){nw=autocomplete_data.data.length-1;}}
input_scroll_autocomplete_toarea(nw);}
;var d=document;var w=window;var pf_autoopen=false;var pf_hotkeyopen_loadgroup=false;var pf_hotkeyopen_loaduser=false;var pf_hotkeys_enabled=false;if(d.addEventListener){d.addEventListener("load",postform_set_hotkeys,false);w.addEventListener("load",postform_set_hotkeys,false);}
else if(d.attachEvent){d.attachEvent("onload",postform_set_hotkeys);w.attachEvent("onload",postform_set_hotkeys);}
function postform_set_hotkeys(){if(pf_hotkeys_enabled){return;}
pf_hotkeys_enabled=true;if(pf_autoopen){postform_open();}
var f_onkeypress=function(e){if(!e&&_w.event){e=_w.event;}
if(!e){return;}
var code=e.charCode?e.charCode:e.keyCode;if(pf_hotkeys_enabled&&(code==112||code==1087)&&!e.ctrlKey&&!e.altKey&&pf_open_state==0&&!flybox_opened){if(pf_hotkeyopen_loadgroup){postform_open(({groupname:pf_hotkeyopen_loadgroup}));}
else if(pf_hotkeyopen_loaduser){postform_open(({username:pf_hotkeyopen_loaduser}));}
else{postform_open();}
if(e.preventDefault){e.preventDefault();}else{e.returnValue=false;}}
if(flybox_opened&&code==27){flybox_close();}};var i,all=d.getElementsByTagName("INPUT");for(i=0;i<all.length;i++){postform_forbid_hotkeys_conflicts(all[i]);}
all=d.getElementsByTagName("TEXTAREA");for(i=0;i<all.length;i++){postform_forbid_hotkeys_conflicts(all[i]);}
if(d.addEventListener){d.addEventListener("keypress",f_onkeypress,false);}
else if(d.attachEvent){d.attachEvent("onkeypress",f_onkeypress);}
if(d.post_form&&d.post_form.message){var f_onkpr=function(e){if(!e&&_w.event){e=_w.event;}
if(!e){return;}
var code=e.charCode?e.charCode:e.keyCode;if((code==10||code==13)&&e.ctrlKey){d.post_form.message.blur();postform_submit();if(e.preventDefault){e.preventDefault();}else{e.returnValue=false;}}};if(d.post_form.message.addEventListener){d.post_form.message.addEventListener("keypress",f_onkpr,false);}
else if(d.post_form.message.attachEvent){d.post_form.message.attachEvent("onkeypress",f_onkpr);}}}
function postform_forbid_hotkeys_conflicts(inp)
{if(inp.addEventListener){inp.addEventListener("focus",function(){pf_hotkeys_enabled=false;},false);inp.addEventListener("blur",function(){pf_hotkeys_enabled=true;},false);}
else if(inp.attachEvent){inp.attachEvent("onfocus",function(){pf_hotkeys_enabled=false;});inp.attachEvent("onblur",function(){pf_hotkeys_enabled=true;});}}
var pf_open_state=0;var pf_post_state=0;var pf_attach_state=0;var pf_attach_state_tp="";var pf_msg_max_length=160;var pf_changes=0;var pf_close_confirm="";var pf_rmatch_confirm="";var pf_data={};function postform_open(load_data)
{if(pf_open_state==1){if(pf_attach_state==2){return;}
var open_another=false;if(load_data&&load_data.username&&(pf_data.share_with_type!="user"||pf_data.share_with_xtra!=load_data.username)){open_another=true;}
else if(load_data&&load_data.groupname&&(pf_data.share_with_type!="group"||pf_data.share_with_xtra!=load_data.groupname)){open_another=true;}
else if(load_data&&load_data.editpost&&load_data.editpost!=pf_data.existing_post_id){open_another=true;}
else if((!load_data||!(load_data.username||load_data.groupname||load_data.editpost))&&pf_data.share_with_type!="all"){open_another=true;}
if(open_another){postform_close_withconfirm(function(){postform_open(load_data);});}
else{d.post_form.message.focus();}
scroll(0,0);return;}
if(pf_open_state!=0){return;}
var pf_container=d.getElementById("postform");if(!pf_container){return false;}
scroll(0,0);if(pf_post_state==0){postform_open_step2(load_data);return true;}
if(pf_post_state==1){postform_statusmsg_clearTimeout();pf_post_state=0;postform_htmlobject_hide("pf_postedok",function(){postform_open_step2(load_data);});return true;}
return false;}
function postform_open_step2(load_data)
{d.post_form.reset();d.post_form.message.disabled=false;pf_data=({temp_id:postform_generate_tmpid(10),existing_post_id:"",share_with_type:"all",share_with_xtra:"",message:"",attachments:0,at_link:[],at_image:[],at_videoembed:[],at_file:[],atchimgtab:"upl"});if(load_data&&load_data.username){pf_data.share_with_type="user";pf_data.share_with_xtra=load_data.username;}
else if(load_data&&load_data.groupname){pf_data.share_with_type="group";pf_data.share_with_xtra=load_data.groupname;}
else if(load_data&&load_data.editpost){pf_data.existing_post_id=load_data.editpost;pf_data.share_with_type="";if(postcomments_open_state){var state=postcomments_open_state[load_data.editpost];if(state==2){return;}}}
else{var btn=d.getElementById("postform_open_button");if(btn){btn.style.display="none";}}
if(load_data&&load_data.mention){pf_data.message="@"+load_data.mention+" ";d.post_form.message.value=pf_data.message;}
postform_attachimage_tab(pf_data.atchimgtab);pf_changes=0;d.getElementById("attachbtn_link").style.display="block";d.getElementById("attachbtn_image").style.display="block";d.getElementById("attachbtn_videoembed").style.display="block";d.getElementById("attachbtn_file").style.display="block";d.getElementById("attachok_link").style.display="none";d.getElementById("attachok_image").style.display="none";d.getElementById("attachok_videoembed").style.display="none";d.getElementById("attachok_file").style.display="none";if(pf_data.existing_post_id==""){d.getElementById("pf_title_newpost").style.display="block";d.getElementById("pf_title_edtpost").style.display="none";d.getElementById("sharewith_user").style.display="none";d.getElementById("sharewith_group").style.display="none";d.getElementById("sharewith").style.display="block";d.getElementById("selectedupdateoption").style.display="block";if(pf_data.share_with_type=="all"){var span=d.getElementById("selectedupdateoption").firstChild;span.innerHTML=span.getAttribute("defaultvalue");}
else{d.getElementById("selectedupdateoption").firstChild.innerHTML=postform_str_cut(pf_data.share_with_xtra,30);}
d.getElementById("postbtn_newpost").style.display="block";d.getElementById("postbtn_edtpost").style.display="none";}
else{d.getElementById("pf_title_newpost").style.display="none";d.getElementById("pf_title_edtpost").style.display="block";d.getElementById("sharewith_user").style.display="none";d.getElementById("sharewith_group").style.display="none";d.getElementById("sharewith").style.display="none";d.getElementById("selectedupdateoption").style.display="block";d.getElementById("postbtn_newpost").style.display="none";d.getElementById("postbtn_edtpost").style.display="block";pf_post_state=2;postform_htmlobject_show("pf_loading",36,postform_open_step2_loadpost);return;}
postform_open_step3();}
function postform_open_step2_loadpost()
{var tmp_load_post_err=function(){pf_post_state=0;postform_htmlobject_hide("pf_loading");pf_data={};};var req=ajax_init(true);if(!req){return tmp_load_post_err();}
req.onreadystatechange=function(){if(req.readyState!=4){return;}
if(!req.responseXML){return tmp_load_post_err();}
var data=req.responseXML.getElementsByTagName("result");if(!data||!data[0]){return tmp_load_post_err();}
data=data[0].getElementsByTagName("post");if(!data||!data[0]){return tmp_load_post_err();}
data=data[0];var postid=data.getAttribute("id");var message=data.getAttribute("message");if(!postid||!message||postid!=pf_data.existing_post_id){return tmp_load_post_err();}
pf_data.message=message;d.post_form.message.value=message;data=data.getElementsByTagName("attach");var i,tp,id,txt;for(i=0;i<data.length;i++){tp=data[i].getAttribute("type");id=data[i].getAttribute("id");txt=data[i].getAttribute("text");if(!tp||!id||!txt){continue;}
pf_data["at_"+tp]=[id,txt];pf_data.attachments++;d.getElementById("attachbtn_"+tp).style.display="none";d.getElementById("attachok_"+tp).style.display="block";d.getElementById("attachok_"+tp+"_txt").innerHTML=txt;}
postform_open_step3();}
req.open("POST",siteurl+"ajax/postform-loadpost/ajaxtp:xml/r:"+Math.round(Math.random()*1000),true);req.setRequestHeader("Content-type","application/x-www-form-urlencoded");req.send("postid="+encodeURIComponent(pf_data.existing_post_id));}
function postform_open_step3()
{pf_open_state=2;if(pf_post_state==2){pf_post_state=0;postform_htmlobject_hide("pf_loading");}
d.getElementById("postform").style.display="block";postform_htmlobject_show("pf_mainpart",114,postform_open_step4);if(msgbox_close){msgbox_close();}}
function postform_open_step4()
{pf_open_state=1;d.post_form.message.focus();postform_validate(d.post_form.message);postform_validate_advanced(d.post_form.message);}
function postform_attachbox_open(at_type,h)
{if(pf_open_state!=1){return;}
if(pf_attach_state==1){if(pf_attach_state_tp==at_type){return;}
postform_attachbox_close(function(){postform_attachbox_open_step2(at_type,h);});return;}
if(pf_attach_state==2){return;}
postform_attachbox_open_step2(at_type,h);}
function postform_attachbox_open_step2(at_type,h)
{d.getElementById("attachboxcontent_link").style.display="none";d.getElementById("attachboxcontent_image").style.display="none";d.getElementById("attachboxcontent_videoembed").style.display="none";d.getElementById("attachboxcontent_file").style.display="none";d.getElementById("attachboxcontent_"+at_type).style.display="block";d.getElementById("attachboxcontent_link_ftr").className="submitattachment";d.getElementById("attachboxcontent_image_ftr").className="submitattachment";d.getElementById("attachboxcontent_videoembed_ftr").className="submitattachment";d.getElementById("attachboxcontent_file_ftr").className="submitattachment";d.post_form.atch_link.disabled=false;d.post_form.atch_image_upl.disabled=false;d.post_form.atch_image_url.disabled=false;d.post_form.atch_file.disabled=false;d.post_form.atch_videoembed.disabled=false;if(at_type=="image"){var ttldiv=d.getElementById("attachboxtitle_image_url");ttldiv.innerHTML=ttldiv.getAttribute("defaultvalue");ttldiv=d.getElementById("attachboxtitle_image_upl");ttldiv.innerHTML=ttldiv.getAttribute("defaultvalue");}
else{var ttldiv=d.getElementById("attachboxtitle_"+at_type);ttldiv.innerHTML=ttldiv.getAttribute("defaultvalue");}
pf_attach_state_tp=at_type;pf_attach_state=2;postform_htmlobject_show("attachbox",h,function(){postform_attachbox_open_step3(at_type);});}
function postform_attachbox_open_step3(at_type)
{pf_attach_state=1;d.getElementById("attachbtn_"+at_type).className="attachbtn pressed";d.getElementById("attachbox").className="a_"+at_type;switch(at_type){case"link":d.post_form.atch_link.focus();break;case"videoembed":d.post_form.atch_videoembed.focus();break;case"file":d.post_form.atch_file.focus();break;case"image":d.post_form["atch_image_"+pf_data.atchimgtab].focus();break;}}
function postform_close(callback_after)
{if(pf_open_state!=1){return;}
if(pf_attach_state==2){return;}
if(pf_attach_state==1){postform_attachbox_close();}
d.post_form.message.blur();pf_open_state=2;if(pf_post_state==3){postform_htmlobject_hide("pf_postederror");pf_post_state=0;}
var f=function(){pf_open_state=0;if(pf_post_state==0){d.getElementById("postform").style.display="none";}
var btn=d.getElementById("postform_open_button");if(btn){btn.style.display="";}
if(callback_after){callback_after();}};postform_htmlobject_hide("pf_mainpart",f);}
function postform_close_withconfirm(callback_after)
{if(pf_open_state!=1){return;}
if(pf_attach_state==2){return;}
if(pf_data.message!=d.post_form.message.value){pf_changes++;}
if(pf_changes==0){postform_close(callback_after);return;}
if(!confirm(pf_close_confirm)){return;}
postform_close(callback_after);}
function postform_attachbox_close(callback_after)
{if(pf_attach_state!=1){return;}
d.getElementById("attachbox").className="";d.getElementById("attachbtn_link").className="attachbtn";d.getElementById("attachbtn_image").className="attachbtn";d.getElementById("attachbtn_videoembed").className="attachbtn";d.getElementById("attachbtn_file").className="attachbtn";pf_attach_state=2;postform_htmlobject_hide("attachbox",function(){pf_attach_state=0;if(callback_after){callback_after();}});}
function postform_sharewith_finduser()
{pf_data.share_with_type="user";pf_data.share_with_xtra="";d.post_form.username.value="";d.getElementById("updateoptions").style.display="none";d.getElementById("sharewith_group").style.display="none";d.getElementById("selectedupdateoption").style.display="none";d.getElementById("sharewith_user").style.display="block";d.post_form.username.focus();}
function postform_sharewith_findgroup()
{pf_data.share_with_type="group";pf_data.share_with_xtra="";d.post_form.groupname.value="";d.getElementById("updateoptions").style.display="none";d.getElementById("sharewith_user").style.display="none";d.getElementById("selectedupdateoption").style.display="none";d.getElementById("sharewith_group").style.display="block";d.post_form.groupname.focus();}
function postform_sharewith_user(txt)
{pf_data.share_with_type="user";pf_data.share_with_xtra=txt;d.getElementById("updateoptions").style.display="none";d.getElementById("selectedupdateoption").firstChild.innerHTML=txt;d.getElementById("sharewith_user").style.display="none";d.getElementById("sharewith_group").style.display="none";d.getElementById("selectedupdateoption").style.display="block";d.post_form.message.focus();}
function postform_sharewith_group(txt)
{pf_data.share_with_type="group";pf_data.share_with_xtra=txt;d.getElementById("updateoptions").style.display="none";d.getElementById("selectedupdateoption").firstChild.innerHTML=txt;d.getElementById("sharewith_user").style.display="none";d.getElementById("sharewith_group").style.display="none";d.getElementById("selectedupdateoption").style.display="block";d.post_form.message.focus();}
function postform_sharewith_all(txt)
{pf_data.share_with_type="all";pf_data.share_with_xtra="";d.getElementById("updateoptions").style.display="none";d.getElementById("selectedupdateoption").firstChild.innerHTML=txt;d.getElementById("sharewith_user").style.display="none";d.getElementById("sharewith_group").style.display="none";d.getElementById("selectedupdateoption").style.display="block";d.post_form.message.focus();}
function postform_bgcheck_username()
{var word=d.post_form.username.value;var req=ajax_init(true);if(!req){return;}
req.onreadystatechange=function(){if(req.readyState!=4){return;}
if(!req.responseXML){return;}
var data=req.responseXML.getElementsByTagName("result");if(!data||!data[0]){return;}
data=data[0].firstChild;if(!data){return;}
postform_sharewith_user(data.nodeValue);}
req.open("POST",siteurl+"ajax/checkname/ajaxtp:xml/r:"+Math.round(Math.random()*1000),true);req.setRequestHeader("Content-type","application/x-www-form-urlencoded");req.send("datatype=username&word="+encodeURIComponent(word));}
function postform_bgcheck_groupname()
{var word=d.post_form.groupname.value;var req=ajax_init(true);if(!req){return;}
req.onreadystatechange=function(){if(req.readyState!=4){return;}
if(!req.responseXML){return;}
var data=req.responseXML.getElementsByTagName("result");if(!data||!data[0]){return;}
data=data[0].firstChild;if(!data){return;}
postform_sharewith_group(data.nodeValue);}
req.open("POST",siteurl+"ajax/checkname/ajaxtp:xml/r:"+Math.round(Math.random()*1000),true);req.setRequestHeader("Content-type","application/x-www-form-urlencoded");req.send("datatype=groupname&word="+encodeURIComponent(word));}
function postform_attach_submit(callback_if_ok)
{if(pf_open_state!=1||pf_attach_state!=1){return;}
if(pf_attach_state_tp=="image"){if(d.post_form["atch_image_"+pf_data.atchimgtab].value==""){d.post_form["atch_image_"+pf_data.atchimgtab].focus();return;}
d.post_form["atch_image_"+pf_data.atchimgtab].disabled=true;}
else{if(d.post_form["atch_"+pf_attach_state_tp].value==""){d.post_form["atch_"+pf_attach_state_tp].focus();return;}
d.post_form["atch_"+pf_attach_state_tp].disabled=true;}
d.getElementById("attachboxcontent_"+pf_attach_state_tp+"_ftr").className="submitattachment loading";pf_attach_state=2;pf_changes++;var f_error=function(errmsg){pf_attach_state=1;if(pf_attach_state_tp=="image"){d.post_form["atch_image_"+pf_data.atchimgtab].disabled=false;d.getElementById("attachboxcontent_image_ftr").className="submitattachment";var dv=d.getElementById("attachboxtitle_image_"+pf_data.atchimgtab);dv.innerHTML=errmsg?errmsg:dv.getAttribute("defaultvalue");d.post_form["atch_image_"+pf_data.atchimgtab].focus();}
else{d.post_form["atch_"+pf_attach_state_tp].disabled=false;d.getElementById("attachboxcontent_"+pf_attach_state_tp+"_ftr").className="submitattachment";var dv=d.getElementById("attachboxtitle_"+pf_attach_state_tp);dv.innerHTML=errmsg?errmsg:dv.getAttribute("defaultvalue");d.post_form["atch_"+pf_attach_state_tp].focus();}};var f_ok=function(attxt){if(!pf_data["at_"+pf_attach_state_tp][0]){pf_data.attachments++;}
pf_data["at_"+pf_attach_state_tp]=[-1,attxt];d.getElementById("attachbtn_"+pf_attach_state_tp).style.display="none";d.getElementById("attachok_"+pf_attach_state_tp).style.display="block";d.getElementById("attachok_"+pf_attach_state_tp+"_txt").innerHTML=attxt;var tmpf=function(){pf_attach_state=0;if(pf_attach_state_tp=="image"){d.post_form["atch_image_"+pf_data.atchimgtab].value="";}
else{d.post_form["atch_"+pf_attach_state_tp].value="";}
d.getElementById("attachbtn_"+pf_attach_state_tp).className="attachbtn";if(callback_if_ok){callback_if_ok();}};postform_htmlobject_hide("attachbox",tmpf);d.post_form.message.focus();};switch(pf_attach_state_tp){case"link":case"videoembed":var req=ajax_init(true);if(!req){f_error();return;}
req.onreadystatechange=function(){if(req.readyState!=4){return;}
if(!req.responseXML){f_error();return;}
var data=req.responseXML.getElementsByTagName("result");if(!data||!data[0]){f_error();return;}
data=data[0];var status=data.getElementsByTagName("status");if(!status||!status[0]){f_error();return;}
status=status[0].firstChild.nodeValue;if(status!="OK"){var message=data.getElementsByTagName("message");if(message&&message[0]){f_error(message[0].firstChild.nodeValue);return;}
f_error();return;}
data=data.getElementsByTagName("attach");if(!data||!data[0]){f_error();return;}
data=data[0].getAttribute("text");if(!data){f_error();return;}
f_ok(data);}
req.open("POST",siteurl+"ajax/postform-attach/ajaxtp:xml/r:"+Math.round(Math.random()*1000),true);req.setRequestHeader("Content-type","application/x-www-form-urlencoded");req.send("post_temp_id="+encodeURIComponent(pf_data.temp_id)+"&at_type="+pf_attach_state_tp+"&data="+encodeURIComponent(d.post_form["atch_"+pf_attach_state_tp].value));break;case"file":var frmkey=postform_submit_hidden_uplform(d.post_form.atch_file);var f_check=function(){var req=ajax_init(true);if(!req){return;}
req.onreadystatechange=function(){if(req.readyState!=4){return;}
if(!req.responseXML){f_error();return;}
var data=req.responseXML.getElementsByTagName("result");if(!data||!data[0]){f_error();return;}
data=data[0];var status=data.getElementsByTagName("status");if(!status||!status[0]){f_error();return;}
status=status[0].firstChild.nodeValue;if(status=="WAIT"){setTimeout(f_check,1000);return;}
if(status!="OK"){var message=data.getElementsByTagName("message");if(message&&message[0]){f_error(message[0].firstChild.nodeValue);return;}
f_error();return;}
data=data.getElementsByTagName("attach");if(!data||!data[0]){f_error();return;}
data=data[0].getAttribute("text");if(!data){f_error();return;}
f_ok(data);}
req.open("POST",siteurl+"ajax/postform-attach/ajaxtp:xml/r:"+Math.round(Math.random()*1000),true);req.setRequestHeader("Content-type","application/x-www-form-urlencoded");req.send("post_temp_id="+encodeURIComponent(pf_data.temp_id)+"&at_type=file&data="+encodeURIComponent(frmkey));};setTimeout(f_check,1);break;case"image":var frmkey;if(pf_data.atchimgtab=="upl"){frmkey=postform_submit_hidden_uplform(d.post_form.atch_image_upl);}
var f_check=function(){var req=ajax_init(true);if(!req){f_error();return;}
req.onreadystatechange=function(){if(req.readyState!=4){return;}
if(!req.responseXML){f_error();return;}
var data=req.responseXML.getElementsByTagName("result");if(!data||!data[0]){f_error();return;}
data=data[0];var status=data.getElementsByTagName("status");if(!status||!status[0]){f_error();return;}
status=status[0].firstChild.nodeValue;if(pf_data.atchimgtab=="upl"&&status=="WAIT"){setTimeout(f_check,1000);return;}
if(status!="OK"){var message=data.getElementsByTagName("message");if(message&&message[0]){f_error(message[0].firstChild.nodeValue);return;}
f_error();return;}
data=data.getElementsByTagName("attach");if(!data||!data[0]){f_error();return;}
data=data[0].getAttribute("text");if(!data){f_error();return;}
f_ok(data);}
var dt=pf_data.atchimgtab=="upl"?("upl|"+frmkey):("url|"+d.post_form.atch_image_url.value);req.open("POST",siteurl+"ajax/postform-attach/ajaxtp:xml/r:"+Math.round(Math.random()*1000),true);req.setRequestHeader("Content-type","application/x-www-form-urlencoded");req.send("post_temp_id="+encodeURIComponent(pf_data.temp_id)+"&at_type=image&data="+encodeURIComponent(dt));}
setTimeout(f_check,1);break;default:return;}}
function postform_attach_remove(at_type)
{if(pf_open_state!=1||pf_data.attachments==0||!pf_data["at_"+at_type][0]){return;}
if(!confirm(pf_rmatch_confirm)){return;}
pf_data.attachments--;pf_data["at_"+at_type]=[];if(at_type=="image"){d.post_form["atch_image_"+pf_data.atchimgtab].value="";}
else{d.post_form["atch_"+at_type].value="";}
d.getElementById("attachok_"+at_type).style.display="none";d.getElementById("attachbtn_"+at_type).style.display="block";pf_changes++;}
function postform_attachimage_tab(tb)
{if(pf_attach_state==2){return;}
var ttldiv=d.getElementById("attachboxtitle_image_url");ttldiv.innerHTML=ttldiv.getAttribute("defaultvalue");ttldiv=d.getElementById("attachboxtitle_image_upl");ttldiv.innerHTML=ttldiv.getAttribute("defaultvalue");d.getElementById("attachform_img_upl_btn").className="";d.getElementById("attachform_img_url_btn").className="";d.getElementById("attachform_img_"+tb+"_btn").className="onlitetab";d.getElementById("attachform_img_upl_div").style.display="none";d.getElementById("attachform_img_url_div").style.display="none";d.getElementById("attachform_img_"+tb+"_div").style.display="block";pf_data.atchimgtab=tb;try{d.post_form["atch_image_"+tb].focus();}catch(e){};}
function postform_submit()
{if(pf_open_state!=1||pf_attach_state==2){return;}
if(pf_data.message!=d.post_form.message.value){pf_data.message=d.post_form.message.value;pf_changes++;}
if(pf_data.message==""){d.post_form.message.focus();return;}
if(pf_attach_state==1){postform_attach_submit(function(){if(pf_data.message==d.post_form.message.value){postform_submit();}});return;}
d.post_form.message.disabled=true;pf_open_state=2;if(pf_post_state==1){postform_statusmsg_clearTimeout();pf_post_state=2;postform_htmlobject_hide("pf_postedok",postform_submit_step2);return;}
else if(pf_post_state==3){pf_post_state=2;postform_htmlobject_hide("pf_postederror",postform_submit_step2);return;}
pf_post_state=2;postform_submit_step2();}
function postform_submit_step2()
{postform_htmlobject_show("pf_posting",36,postform_submit_step3);}
function postform_submit_step3()
{postform_htmlobject_hide("pf_mainpart",postform_submit_step4);}
function postform_submit_step4()
{var req=ajax_init(true);if(!req){return;}
var p="post_temp_id="+encodeURIComponent(pf_data.temp_id)+"&message="+encodeURIComponent(pf_data.message);if(pf_data.existing_post_id!=""){p+="&editpost="+encodeURIComponent(pf_data.existing_post_id);}
else if(pf_data.share_with_type=="user"){p+="&username="+encodeURIComponent(pf_data.share_with_xtra);}
else if(pf_data.share_with_type=="group"){p+="&groupname="+encodeURIComponent(pf_data.share_with_xtra);}
if(pf_data.at_link[0]){p+="&at_link="+encodeURIComponent(pf_data.at_link[0]);}
if(pf_data.at_image[0]){p+="&at_image="+encodeURIComponent(pf_data.at_image[0]);}
if(pf_data.at_file[0]){p+="&at_file="+encodeURIComponent(pf_data.at_file[0]);}
if(pf_data.at_videoembed[0]){p+="&at_videoembed="+encodeURIComponent(pf_data.at_videoembed[0]);}
req.onreadystatechange=function(){if(req.readyState!=4){return;}
if(!req.responseXML){return;}
var data=req.responseXML.getElementsByTagName("result");if(!data||!data[0]){return;}
data=data[0];var status=data.getElementsByTagName("status");var message=data.getElementsByTagName("message");if(!status||!status[0]||!message||!message[0]){return;}
status=status[0].firstChild.nodeValue;message=message[0].firstChild.nodeValue;if(status!="OK"){d.getElementById("pf_postederror_msg").innerHTML=message;postform_htmlobject_hide("pf_posting");postform_htmlobject_show("pf_postederror",36);postform_htmlobject_show("pf_mainpart",114,function(){pf_open_state=1;pf_post_state=3;d.post_form.message.disabled=false;d.post_form.message.focus();});return;}
d.getElementById("pf_postedok_msg").innerHTML=message;postform_htmlobject_hide("pf_posting");postform_htmlobject_show("pf_postedok",36,function(){pf_open_state=0;pf_post_state=1;postform_statusmsg_setTimeout();});var btn=d.getElementById("postform_open_button");if(btn){btn.style.display="";}
if(posts_synchronize){posts_synchronize();}
var pinf=pf_data.existing_post_id;if(pinf!=""){pinf=pinf.split("_");var tmp=w.location.href.toString();tmp=tmp.replace(/^http(s)?\:\/\//,"");tmp=tmp.substr(tmp.indexOf("/"));var mtch="/view/"+(pinf[0]=="public"?"post":"priv")+":"+pinf[1];if(tmp.substr(0,mtch.length)==mtch){if(viewpost_synchronize){viewpost_synchronize();}
else{w.location.href=w.location.href.toString();}}}}
req.open("POST",siteurl+"ajax/postform-submit/ajaxtp:xml/r:"+Math.round(Math.random()*1000),true);req.setRequestHeader("Content-type","application/x-www-form-urlencoded");req.send(p);}
function postform_topmsg_close()
{if(pf_post_state==1){postform_statusmsg_clearTimeout();pf_post_state=0;postform_htmlobject_hide("pf_postedok",function(){if(pf_open_state==0){d.getElementById("postform").style.display="none";}});}
else if(pf_post_state==3){pf_post_state=0;postform_htmlobject_hide("pf_postederror",function(){if(pf_open_state==0){d.getElementById("postform").style.display="none";}});}}
function postform_validate(area)
{if(pf_open_state==1&&area){var v=area.value;if(v.length>pf_msg_max_length){area.value=v.substr(0,pf_msg_max_length);}
d.getElementById("pf_chars_counter").innerHTML=(pf_msg_max_length-area.value.length);}
setTimeout(function(){postform_validate(area);},289);}
function postform_validate_advanced(area)
{if(pf_open_state==1&&area){var v=area.value;var n=false;while(v.indexOf("\n")!=-1||v.indexOf("\r")!=-1){v=v.replace(/\r\n|\n|\r/," ");n=true;}
if(n){while(v.indexOf("  ")!=-1){v=v.replace("  "," ");}}
if(v.length>pf_msg_max_length){v=v.substr(0,pf_msg_max_length);n=true;}
if(n){area.value=v;}}
setTimeout(function(){postform_validate_advanced(area);},1981);}
var pf_htmlobjects_shown={};function postform_htmlobject_show(div_id,orig_height,callback_after,steps,delay)
{if(pf_htmlobjects_shown[div_id]==undefined){pf_htmlobjects_shown[div_id]=0;}
if(pf_htmlobjects_shown[div_id]!=0){return true;}
var div=_d.getElementById(div_id);if(!div){return false;}
if(disable_animations){div.style.display="block";div.style.overflow="visible";pf_htmlobjects_shown[div_id]=1;if(callback_after){callback_after();}
return true;}
if(!steps){steps=7;}
if(!delay){delay=20;}
var i=0;var func=function(){i++;if(i==steps){div.style.height=orig_height+"px";div.style.opacity=1;div.style.overflow="visible";pf_htmlobjects_shown[div_id]=1;if(callback_after){callback_after();}
return true;}
if(!isNaN(orig_height)){setTimeout(function(){div.style.height=Math.round(i*orig_height/steps)+"px";},1);}
setTimeout(function(){div.style.opacity=0.5+(i/2)/steps;},1);setTimeout(func,delay);};div.style.overflow="hidden";div.style.height="0px";div.style.display="block";div.style.opacity=0.5;pf_htmlobjects_shown[div_id]=2;func();}
function postform_htmlobject_hide(div_id,callback_after,steps,delay)
{if(pf_htmlobjects_shown[div_id]!=1){return true;}
var div=_d.getElementById(div_id);if(!div){return false;}
if(disable_animations){div.style.display="none";pf_htmlobjects_shown[div_id]=0;if(callback_after){callback_after();}
return true;}
if(!steps){steps=7;}
if(!delay){delay=20;}
var orig_height=parseInt(div.style.height,10);var i=steps;var func=function(){i--;if(i==0){div.style.height="0px";div.style.opacity=0.5;div.style.display="none";div.style.height="auto";pf_htmlobjects_shown[div_id]=0;if(callback_after){callback_after();}
return true;}
if(!isNaN(orig_height)){setTimeout(function(){div.style.height=Math.round(i*orig_height/steps)+"px";},1);}
setTimeout(function(){div.style.opacity=0.5+(i/2)/steps;},1);setTimeout(func,delay);};div.style.overflow="hidden";div.style.opacity=1;pf_htmlobjects_shown[div_id]=2;func();}
function postform_generate_tmpid(len,let)
{if(!len){len=10;}
if(!let){let="abcdefghijklmnopqrstuvwxyz0123456789";}
var i,word="";for(i=0;i<len;i++){word+=let.charAt(Math.round(Math.random()*(let.length-1)));}
return word;}
function postform_str_cut(str,len)
{if(str.length<=len){return str;}
return str.substr(0,len-1)+"..";}
function postform_is_valid_url(url)
{if(!url.match(/^(ftp|http|https)\:\/\//)){url="http://"+url;}
if(!url.match(/^(ftp|http|https)\:\/\/((([a-z0-9.-]+\.)+[a-z]{2,4})|([0-9\.]{1,4}){4})(\/([a-zа-я0-9-_\—\:%\.\?\!\=\+\&\/\#\~\;\,\@]+)?)?$/i)){return false;}
return true;}
function postform_attach_pastelink(event,input,callback_if_ok)
{return false;if(!event&&_w.event){event=_w.event;}
if(!event||!event.type){return false;}
if(event.type=="paste"){setTimeout(function(){if(postform_is_valid_url(input.value)){callback_if_ok();}},1);}
else if(event.type=="keyup"){var code=event.charCode?event.charCode:event.keyCode;if(event.ctrlKey&&code==86&&!event.altKey&&!event.shiftKey){setTimeout(function(){if(postform_is_valid_url(input.value)){callback_if_ok();}},1);}
if(event.shiftKey&&code==45&&!event.altKey&&!event.ctrlKey){setTimeout(function(){if(postform_is_valid_url(input.value)){callback_if_ok();}},1);}}}
function postform_submit_hidden_uplform(fileinput)
{var ifr=d.createElement("IFRAME");ifr.name=postform_generate_tmpid(10);ifr.id=ifr.name;ifr.style.display="none";d.body.appendChild(ifr);try{w.frames[ifr.name].name=ifr.name}catch(e){}
var frm=d.createElement("FORM");frm.method="POST";frm.action=siteurl+"ajax/postform-attachupl";frm.enctype="multipart/form-data";frm.encoding="multipart/form-data";frm.target=ifr.name;frm.name=postform_generate_tmpid(10);frm.style.display="none";var inp1=d.createElement("INPUT");inp1.type="hidden";inp1.name="keyy";inp1.value=postform_generate_tmpid(10);frm.appendChild(inp1);var inp2=fileinput.cloneNode(true);inp2.name="file";inp2.disabled=false;if(inp2.value==fileinput.value){frm.appendChild(inp2);d.body.appendChild(frm);frm.submit();}
else{var container=fileinput.parentNode;var oldname=fileinput.name;var fileinput2=fileinput;fileinput2.name="file";fileinput2.disabled=false;frm.appendChild(fileinput2);d.body.appendChild(frm);frm.submit();fileinput.name=oldname;fileinput.disabled=true;container.appendChild(fileinput);}
return inp1.value;}
var postform_statusmsg_timeout=false;function postform_statusmsg_setTimeout()
{if(postform_statusmsg_timeout){return;}
postform_statusmsg_timeout=setTimeout(function(){postform_htmlobject_hide("pf_postedok");},3000);}
function postform_statusmsg_clearTimeout()
{if(postform_statusmsg_timeout){clearTimeout(postform_statusmsg_timeout);postform_statusmsg_timeout=false;}}
function postform_mention(username,always_open)
{if(pf_open_state==2){return;}
if(pf_open_state==0){postform_open(({mention:username}));return;}
if(always_open){postform_open(({mention:username}));return;}
var v=d.post_form.message.value+" @"+username;v=v.replace("  "," ");v=trim(v);if(v.length>pf_msg_max_length){d.post_form.message.focus();return;}
v+=" ";d.post_form.message.value=v;d.post_form.message.focus();}
;var d=document;var w=window;function post_fave(postid)
{var req=ajax_init(false);if(!req){return;}
var thislink=d.getElementById("postlink_fave_"+postid);req.onreadystatechange=function(){if(req.readyState!=4){return;}
if(req.responseText!="OK"){return;}
thislink.style.cursor="pointer";thislink.style.display="none";d.getElementById("postlink_unfave_"+postid).style.display="block";}
req.open("POST",siteurl+"ajax/favepost/r:"+Math.round(Math.random()*1000),true);req.setRequestHeader("Content-type","application/x-www-form-urlencoded");req.send("type=on&postid="+encodeURIComponent(postid));thislink.style.cursor="wait";}
function post_unfave(postid,confirm_msg,remove_from_list)
{var req=ajax_init(false);if(!req){return;}
if(!confirm(confirm_msg)){return;}
var thislink=d.getElementById("postlink_unfave_"+postid);req.onreadystatechange=function(){if(req.readyState!=4){return;}
if(req.responseText!="OK"){return;}
thislink.style.cursor="pointer";thislink.style.display="none";d.getElementById("postlink_fave_"+postid).style.display="block";if(remove_from_list){post_hide_slow(postid,posts_synchronize);}}
req.open("POST",siteurl+"ajax/favepost/r:"+Math.round(Math.random()*1000),true);req.setRequestHeader("Content-type","application/x-www-form-urlencoded");req.send("type=off&postid="+encodeURIComponent(postid));thislink.style.cursor="wait";}
function post_delete(postid,confirm_msg,callback_after)
{if(postcomments_open_state&&!d.getElementById("viewpost")){var state=postcomments_open_state[postid];if(state==2){return;}}
var req=ajax_init(false);if(!req){return;}
if(confirm_msg){if(!confirm(confirm_msg)){return;}}
if(pf_open_state==2){return;}
if(pf_open_state==1&&pf_data.existing_post_id==postid){postform_close();}
req.onreadystatechange=function(){if(req.readyState!=4){return;}
if(req.responseText!="OK"){return;}
if(callback_after){callback_after();}
post_hide_slow(postid,posts_synchronize);if(msgbox_close){msgbox_close();};if(postform_topmsg_close){postform_topmsg_close();};}
req.open("POST",siteurl+"ajax/delpost/r:"+Math.round(Math.random()*1000),true);req.setRequestHeader("Content-type","application/x-www-form-urlencoded");req.send("postid="+encodeURIComponent(postid));d.getElementById("postlink_del_"+postid).style.cursor="wait";}
function post_hide_slow(postid,callback_after)
{var div_id="post_"+postid;pf_htmlobjects_shown[div_id]=1;postform_htmlobject_hide(div_id,callback_after);}
var sync_tmout=false;function posts_synchronize()
{if(postcomments_open_state){for(var i in postcomments_open_state){if(postcomments_open_state[i]!=0){return false;}}}
if(dropcontrols_last_open||postuserbox_last_open){return false;}
var req=ajax_init(false);if(!req){return;}
var dv=d.getElementById("posts_html");if(!dv){return;}
var url=w.location.href.toString();if(!url){return;}
if(url.substr(0,siteurl.length)==siteurl){url=url.substr(siteurl.length);url=siteurl+url+"/from:ajax/r:"+Math.round(Math.random()*1000);}
else{url=url.replace(/^http(s)?\:\/\//,"");url=url.substr(url.indexOf("/"));url=siteurl+url+"/from:ajax/r:"+Math.round(Math.random()*1000);}
var i,ch,lastpostdate="",lastpostdates=[];for(i=0;i<dv.childNodes.length;i++){ch=dv.childNodes[i];if(!ch.id||!ch.id.match(/^post_/)||!ch.className.match(/^(m)?post/)||!ch.getAttribute("postdate")){continue;}
lastpostdates[lastpostdates.length]=parseInt(ch.getAttribute("postdate"),10);}
for(i=0;i<lastpostdates.length;i++){lastpostdate=Math.max(lastpostdate,lastpostdates[i]);}
req.onreadystatechange=function(){if(req.readyState!=4){return;}
if(!req.responseText){return;}
var txt=ltrim(req.responseText);if(txt.substr(0,3)!="OK:"){return;}
txt=txt.substr(3);dv.innerHTML=txt;setTimeout(posts_synchronize_step2,1);setTimeout(function(){var i,all=dv.getElementsByTagName("INPUT");for(i=0;i<all.length;i++){postform_forbid_hotkeys_conflicts(all[i]);}
all=dv.getElementsByTagName("TEXTAREA");for(i=0;i<all.length;i++){postform_forbid_hotkeys_conflicts(all[i]);input_set_autocomplete_toarea(all[i]);}},1);}
req.open("POST",url,true);req.setRequestHeader("Content-type","application/x-www-form-urlencoded");req.send("lastpostdate="+encodeURIComponent(lastpostdate));if(sync_tmout){clearTimeout(sync_tmout);sync_tmout=false;}}
function posts_synchronize_step2()
{var dv=d.getElementById("posts_html");if(!dv){return;}
var i,ch,h,tmp;for(i=0;i<dv.childNodes.length;i++){ch=dv.childNodes[i];if(!ch.id||!ch.id.match(/^post_/)||!ch.className.match(/^(m)?post/)||!ch.getAttribute("postdate")){continue;}
if(ch.style.display!="none"){continue;}
if(disable_animations){ch.style.display="block";return;}
h=parseInt(ch.clientHeight,10);if(isNaN(h)||h==0){tmp=ch.cloneNode(true);tmp.id="asdfgh"+(Math.round(Math.random()*1000));tmp.style.visibility="hidden";tmp.style.display="block";dv.appendChild(tmp);h=parseInt(tmp.clientHeight,10);tmp.style.display="none";tmp.parentNode.removeChild(tmp);}
if(h==0){ch.style.display="block";}
else{postform_htmlobject_show(ch.id,h);}}
sync_tmout=setTimeout(posts_synchronize,300000);}
function posts_synchronize_single(post_id)
{var comments_open=false;if(postcomments_open_state&&postcomments_open_state[post_id]==1){comments_open=true;}
var req=ajax_init(false);if(!req){return;}
var dv=d.getElementById("posts_html");if(!dv){return;}
var pdv=d.getElementById("post_"+post_id);if(!pdv){return;}
var url=w.location.href.toString();if(!url){return;}
if(url.substr(0,siteurl.length)==siteurl){url=url.substr(siteurl.length);url=siteurl+url+"/from:ajax/onlypost:"+post_id+"/"+(comments_open?("opencomments:"+post_id+"/"):"")+url+"/r:"+Math.round(Math.random()*1000);}
else{url=url.replace(/^http(s)?\:\/\//,"");url=url.substr(url.indexOf("/"));url=siteurl+url+"/from:ajax/onlypost:"+post_id+"/"+(comments_open?("opencomments:"+post_id+"/"):"")+url+"/r:"+Math.round(Math.random()*1000);}
req.onreadystatechange=function(){if(req.readyState!=4){return;}
if(!req.responseText){return;}
var txt=ltrim(req.responseText);if(txt.substr(0,3)!="OK:"){return;}
txt=txt.substr(3);var ndv=d.createElement("DIV");ndv.innerHTML=txt;setTimeout(function(){ndv=ndv.getElementsByTagName("DIV");if(ndv&&ndv[0]){ndv=ndv[0].cloneNode(true);pdv.style.visibility="hidden";dv.insertBefore(ndv,pdv);pdv.style.display="none";dv.removeChild(pdv);setTimeout(function(){var i,all=ndv.getElementsByTagName("INPUT");for(i=0;i<all.length;i++){postform_forbid_hotkeys_conflicts(all[i]);}
all=ndv.getElementsByTagName("TEXTAREA");for(i=0;i<all.length;i++){postform_forbid_hotkeys_conflicts(all[i]);input_set_autocomplete_toarea(all[i]);}},1);}},1);}
req.open("POST",url,true);req.setRequestHeader("Content-type","application/x-www-form-urlencoded");if(sync_tmout){clearTimeout(sync_tmout);sync_tmout=false;}
req.send("");}
function viewpost_synchronize()
{var req=ajax_init(false);if(!req){return;}
var dv=d.getElementById("viewpost");if(!dv){return;}
var url=w.location.href.toString();if(!url){return;}
if(url.substr(0,siteurl.length)==siteurl){url=url.substr(siteurl.length);url=siteurl+url+"/from:ajax/r:"+Math.round(Math.random()*1000);}
else{url=url.replace(/^http(s)?\:\/\//,"");url=url.substr(url.indexOf("/"));url=siteurl+url+"/from:ajax/r:"+Math.round(Math.random()*1000);}
url=url.replace(/#comments/,"");req.onreadystatechange=function(){if(req.readyState!=4){return;}
if(!req.responseText){return;}
var txt=ltrim(req.responseText);if(txt.substr(0,3)!="OK:"){return;}
txt=txt.substr(3);var ndv=d.createElement("DIV");ndv.innerHTML=txt;setTimeout(function(){ndv=ndv.getElementsByTagName("DIV")[0].cloneNode(true);dv.style.visibility="hidden";while(dv.firstChild){dv.removeChild(dv.firstChild);}
dv.parentNode.insertBefore(ndv,dv);dv.style.display="none";dv.parentNode.removeChild(dv);},1);setTimeout(function(){var i,all=ndv.getElementsByTagName("INPUT");for(i=0;i<all.length;i++){postform_forbid_hotkeys_conflicts(all[i]);}
all=ndv.getElementsByTagName("TEXTAREA");for(i=0;i<all.length;i++){postform_forbid_hotkeys_conflicts(all[i]);}},1);}
req.open("POST",url,true);req.setRequestHeader("Content-type","application/x-www-form-urlencoded");req.send("");}
var flybox_opened=false;function flybox_open(width,height,title,html)
{if(flybox_opened){return false;}
flybox_opened=true;var outer=d.getElementById("flybox_container");var box=d.getElementById("flybox_box");var ttl=d.getElementById("flybox_title");var cnt=d.getElementById("flybox_main");if(!outer||!box||!cnt){return false;}
if(!width){width=600;}
if(!height){height=500;}
if(!title){title="";}
if(!html){html="";}
var page_size=get_screen_preview_size();box.style.width=width+"px";box.style.height=height+"px";var left=Math.round((page_size[0]-width)/2);var top=Math.round((page_size[1]-height)/2);left=Math.max(left,10);top=Math.max(top,10);box.style.left=left+"px";box.style.top=top+"px";ttl.innerHTML=title;setTimeout(function(){outer.style.display="block";},1);setTimeout(function(){cnt.innerHTML=html;},1);}
function flybox_close()
{flybox_opened=false;d.getElementById("flybox_container").style.display="none";setTimeout(function(){d.getElementById("flybox_main").innerHTML="";},1);if(navigator.appName.toLowerCase().indexOf("opera")!=-1){setTimeout(function(){d.body.innerHTML+="";},2);}}
function flybox_open_att_image(width,height,title,postid)
{width=Math.max(width,400);var html='<iframe src="'+siteurl+'getattachment/tp:image/pid:'+postid+'" style="width:'+(width+10)+'px; height:'+(height+41)+'px;" border="0" frameborder="0" style="border:0px solid;" scrolling="no"></iframe>';return flybox_open(width+34,height+129,title,html);}
function flybox_open_att_videoembed(width,height,title,postid)
{var html='<iframe src="'+siteurl+'getattachment/tp:videoembed/pid:'+postid+'" style="width:'+(width+10)+'px; height:'+(height+41)+'px;" border="0" frameborder="0" style="border:0px solid;" scrolling="no"></iframe>';return flybox_open(width+34,height+129,title,html);}
function privmsg_usrfilter_setusr(username,check_first)
{d.privform.privusr_inp.blur();d.privform.privusr_inp.disabled=true;d.privform.privusr_inp.style.cursor="wait";var f_ok=function(){var url=w.location.href.toString();if(!url){return;}
url=url.replace(/usr\:[a-z0-9а-я_-]+(\/)?/i,"");url=url.replace(/pg\:[0-9]+(\/)?/i,"");url=url.replace(/\/+$/,"");url+="/usr:"+username;w.location.href=url;};var f_err=function(){d.privform.privusr_inp.disabled=false;d.privform.privusr_inp.style.cursor="text";d.privform.privusr_inp.focus();setTimeout(function(){d.privform.privusr_inp.style.color="#f00";},1);setTimeout(function(){d.privform.privusr_inp.style.color="#000";},400);setTimeout(function(){d.privform.privusr_inp.style.color="#f00";},800);setTimeout(function(){d.privform.privusr_inp.style.color="#000";},1200);};if(check_first){var req=ajax_init(true);if(!req){return;}
req.onreadystatechange=function(){if(req.readyState!=4){return;}
if(!req.responseXML){return;}
var data=req.responseXML.getElementsByTagName("result");if(!data||!data[0]){f_err();return;}
data=data[0].firstChild;if(!data){f_err();return;}
username=data.nodeValue;f_ok();}
req.open("POST",siteurl+"ajax/checkname/ajaxtp:xml/r:"+Math.round(Math.random()*1000),true);req.setRequestHeader("Content-type","application/x-www-form-urlencoded");req.send("datatype=username&word="+encodeURIComponent(username));return;}
f_ok();}
function privmsg_usrfilter_reset()
{d.privform.privusr_inp.value="";d.privform.privusr_inp.disabled=false;d.privform.privusr_inp.style.cursor="text";d.getElementById("pmfilterok").style.display="none";d.getElementById("pmfilter").style.display="block";d.privform.privusr_inp.focus();}
var posts_topbtns_hd={};var posts_topbtns_sh={};function show_post_topbtns(pid)
{var div=document.getElementById("post_btns_top_"+pid);if(!div){return;}
if(posts_topbtns_hd[pid]){clearTimeout(posts_topbtns_hd[pid]);}
posts_topbtns_hd[pid]=null;posts_topbtns_sh[pid]=setTimeout(function(){div.style.display="block";},100);}
function hide_post_topbtns(pid,fast)
{var div=document.getElementById("post_btns_top_"+pid);if(!div){return;}
if(posts_topbtns_hd[pid]){return;}
if(posts_topbtns_sh[pid]){clearTimeout(posts_topbtns_sh[pid]);}
posts_topbtns_sh[pid]=null;if(fast){div.style.display="none";return;}
posts_topbtns_hd[pid]=setTimeout(function(){div.style.display="none";},200);}
postcomments_open_state=[];function postcomments_open(post_id)
{var state=postcomments_open_state[post_id];if(state==1){postcomments_close(post_id);return;}
if(state==2){return;}
var p=d.getElementById("post_"+post_id);if(!p){return;}
p.style.height="auto";p.style.overflow="hidden";var dv=d.getElementById("postcomments_"+post_id);var h=parseInt(dv.clientHeight,10);if(isNaN(h)||h==0){tmp=dv.cloneNode(true);tmp.id="asdfgh"+(Math.round(Math.random()*1000));tmp.style.visibility="hidden";tmp.style.display="block";dv.parentNode.appendChild(tmp);h=parseInt(tmp.clientHeight,10);tmp.style.display="none";tmp.parentNode.removeChild(tmp);}
if(h==0){pf_htmlobjects_shown["postcomments_"+post_id]=true;dv.style.display="block";dv.style.height="auto";p.className+=" withcomments";}
else{postform_htmlobject_show(dv.id,h,function(){dv.style.height="auto";p.className+=" withcomments";try{d.getElementById("postcomments_"+post_id+"_textarea").focus();}catch(e){}});}
try{d.getElementById("postcomments_"+post_id+"_textarea").focus();}catch(e){}
postcomments_open_state[post_id]=1;postcomments_mark(post_id);p.style.overflow="visible";}
function postcomments_mark(post_id)
{var req=ajax_init(false);if(req){req.onreadystatechange=function(){if(req.readyState!=4){return;}
var cnt=d.getElementById("post_newcomments_"+post_id);if(cnt){cnt.style.display="none";}}
req.open("POST",siteurl+"ajax/post-comments-mark/ajaxtp:txt/r:"+Math.round(Math.random()*1000),true);req.setRequestHeader("Content-type","application/x-www-form-urlencoded");req.send("postid="+encodeURIComponent(post_id));}}
function postcomments_close(post_id,callback_after)
{var state=postcomments_open_state[post_id];if(state==undefined)state=1;if(state!=1){return;}
postcomments_collapse(post_id);pf_htmlobjects_shown["postcomments_"+post_id]=true;postform_htmlobject_hide("postcomments_"+post_id,function(){postcomments_open_state[post_id]=0;if(callback_after){callback_after();}});var p=d.getElementById("post_"+post_id);p.className=p.className.replace(" withcomments","");}
function postcomments_expand(post_id)
{var slim=d.getElementById("postcomments_"+post_id+"_slimform");if(slim){slim.style.display="none";d.getElementById("postcomments_"+post_id+"_bigform").style.display="block";d.getElementById("postcomments_"+post_id+"_textarea").focus();}}
function postcomments_collapse(post_id)
{var slim=d.getElementById("postcomments_"+post_id+"_slimform");if(slim){d.getElementById("postcomments_"+post_id+"_textarea").blur();d.getElementById("postcomments_"+post_id+"_bigform").style.display="none";slim.style.display="block";}}
function postcomments_submit(post_id)
{if(postcomments_open_state[post_id]==2){return;}
var txt=d.getElementById("postcomments_"+post_id+"_textarea");var btn=d.getElementById("postcomments_"+post_id+"_submitbtn");txt.value=trim(txt.value);if(txt.value===""){txt.focus();return;}
txt.disabled=true;btn.disabled=true;txt.style.cursor="wait";btn.style.cursor="wait";btn.blur();postcomments_open_state[post_id]=2;var req=ajax_init(false);if(!req){return;}
req.onreadystatechange=function(){if(req.readyState!=4){return;}
if(!req.responseText){return;}
var res=trim(req.responseText);if(res!="OK"){return;}
postcomments_open_state[post_id]=1;if(d.getElementById("viewpost")){viewpost_synchronize();}
else{posts_synchronize_single(post_id);}
if(!d.getElementById("viewpost")){postcomments_close(post_id,false);}}
req.open("POST",siteurl+"ajax/post-comment/ajaxtp:txt/r:"+Math.round(Math.random()*1000),true);req.setRequestHeader("Content-type","application/x-www-form-urlencoded");req.send("postid="+encodeURIComponent(post_id)+"&message="+encodeURIComponent(txt.value));}
function postcomment_delete(post_id,comment_id,confirm_msg,callback_after)
{var req=ajax_init(false);if(!req){return;}
if(confirm_msg){if(!confirm(confirm_msg)){return;}}
req.onreadystatechange=function(){if(req.readyState!=4){return;}
if(req.responseText!="OK"){return;}
if(callback_after){callback_after();}
if(d.getElementById("viewpost")){viewpost_synchronize();}
else{posts_synchronize_single(post_id);}
if(msgbox_close){msgbox_close();};if(postform_topmsg_close){postform_topmsg_close();};}
req.open("POST",siteurl+"ajax/delcomment/r:"+Math.round(Math.random()*1000),true);req.setRequestHeader("Content-type","application/x-www-form-urlencoded");req.send("postid="+encodeURIComponent(post_id)+"&commentid="+encodeURIComponent(comment_id));d.getElementById("postcomment_"+comment_id).style.cursor="wait";}
function textarea_autoheight(textarea)
{var mn=40;var mx=390;if(!textarea||!textarea.nodeName||textarea.nodeName!="TEXTAREA"){return;}
if(!textarea.id){textarea.id="tmptxtarea_"+Math.round(Math.random()*10000);}
dv=d.getElementById("tmptxtdv_"+textarea.id);if(!dv){var dv=d.createElement("DIV");dv.id="tmptxtdv_"+textarea.id;dv.className=textarea.className;dv.style.width=textarea.clientWidth+"px";dv.style.overflow="auto";dv.style.whiteSpace="pre-wrap";dv.style.visibility="hidden";dv.style.display="block";dv.style.position="absolute";textarea.parentNode.appendChild(dv);}
dv.innerHTML="";dv.appendChild(d.createTextNode(textarea.value+"\n"));var h=parseInt(dv.clientHeight,10);if(isNaN(h)){return;}
if(h<=mn){h=mn;textarea.style.overflow="hidden";}
else if(h>=mx){h=mx;textarea.style.overflow="auto";}
else{textarea.style.overflow="hidden";}
textarea.style.height=h+"px";}
if(!pf_htmlobjects_shown){pf_htmlobjects_shown={};}
var last_extshare_openbox=false;var last_extshare_tmout=false;function extshare_openbox(tmpid)
{if(pf_htmlobjects_shown["extshare_tmpbox_open_"+tmpid]==undefined){pf_htmlobjects_shown["extshare_tmpbox_open_"+tmpid]=0;}
if(pf_htmlobjects_shown["extshare_tmpbox_open_"+tmpid]!=0){return true;}
if(last_extshare_openbox){last_extshare_openbox.style.display="none";pf_htmlobjects_shown[last_extshare_openbox.id]=0;last_extshare_openbox=false;}
var lnk=d.getElementById("extshare_link_"+tmpid);if(!lnk){return false;}
var c=obj_find_coords(lnk);if(!c||c[0]==0||c[1]==0){return false;}
var bx=d.getElementById("extshare_tmpbox_"+tmpid);if(!bx){return false;}
var bx2=d.getElementById("extshare_tmpbox_open_"+tmpid);if(bx2){bx2.style.display="none";}
else{bx2=bx.cloneNode(true);bx2.id="extshare_tmpbox_open_"+tmpid;bx2.style.display="none";d.body.appendChild(bx2);}
bx2.onmouseover=function(){extshare_keepopen();};bx2.onmouseout=function(){extshare_closebox(tmpid);};bx2.style.position="absolute";bx2.style.left=c[0]+"px";bx2.style.top=(c[1]+15)+"px";var i,lnks=bx2.getElementsByTagName("A");for(i=0;i<lnks.length;i++){lnks[i].onmouseover=function(){extshare_keepopen();};}
if(disable_animations){bx2.style.display="block";pf_htmlobjects_shown[bx2.id]=1;}
else{var h=parseInt(bx2.clientHeight,10);if(isNaN(h)||h==0){bx2.style.visiblity="hidden";bx2.style.display="block";h=parseInt(bx2.clientHeight,10);bx2.style.display="none";bx2.style.visibility="visible";}
if(h==0){bx2.style.display="block";pf_htmlobjects_shown[bx2.id]=1;}
else{postform_htmlobject_show(bx2.id,h);}}
last_extshare_openbox=bx2;}
function extshare_closebox(tmpid)
{if(last_extshare_tmout){clearTimeout(last_extshare_tmout);}
var bx2=d.getElementById("extshare_tmpbox_open_"+tmpid);if(!bx2)return;last_extshare_tmout=setTimeout(function(){if(disable_animations){bx2.style.display="none";pf_htmlobjects_shown[bx2.id]=0;}
else{pf_htmlobjects_shown[bx2.id]=1;postform_htmlobject_hide(bx2.id);}
last_extshare_openbox=false;last_extshare_tmout=false;},300);}
function extshare_keepopen()
{setTimeout(function(){if(last_extshare_tmout){clearTimeout(last_extshare_tmout);}},50);}
var dropcontrols_last_open=false;var dropcontrols_share_tmout=false;function dropcontrols_open(post_id){dropcontrols_close();setTimeout(function(){d.getElementById("dropcontrols_link_"+post_id).className="dropcontrols dropped";d.getElementById("dropcontrols_box_"+post_id).style.display="block";dropcontrols_last_open=post_id;},10);}
function dropcontrols_close(post_id){if(!post_id&&dropcontrols_last_open){post_id=dropcontrols_last_open;}
if(!post_id){return;}
dropcontrols_share_close(post_id);d.getElementById("dropcontrols_box_"+post_id).style.display="none";d.getElementById("dropcontrols_link_"+post_id).className="dropcontrols";dropcontrols_last_open=false;}
function dropcontrols_share_open(post_id){dropcontrols_share_keepopen();d.getElementById("dropcontrols_sharelink_"+post_id).className="pctrls_share droppped";d.getElementById("dropcontrols_sharebox_"+post_id).style.display="block";}
function dropcontrols_share_keepopen(){if(dropcontrols_share_tmout){clearTimeout(dropcontrols_share_tmout);}}
function dropcontrols_share_close_ev(post_id){dropcontrols_share_tmout=setTimeout(function(){dropcontrols_share_close(post_id)},100);}
function dropcontrols_share_close(post_id){if(post_id.match(/^private_[0-9]*$/))return;if(!d.getElementById("dropcontrols_sharelink_"+post_id))return;d.getElementById("dropcontrols_sharelink_"+post_id).className="pctrls_share";d.getElementById("dropcontrols_sharebox_"+post_id).style.display="none";}
if(d.addEventListener){d.addEventListener("click",function(){dropcontrols_close();},false);w.addEventListener("click",function(){dropcontrols_close();},false);}
else if(d.attachEvent){d.attachEvent("onclick",function(){dropcontrols_close();});w.attachEvent("onclick",function(){dropcontrols_close();});}
var postuserbox_last_open=false;var postuserbox_tmout=false;var postuserbox_open_timer=false;function postuserbox_open(post_id){postuserbox_close();postuserbox_open_timer=setTimeout(function(){postuserbox_close();d.getElementById("postuserbox_av1_"+post_id).style.display="none";d.getElementById("postuserbox_av2_"+post_id).style.display="block";postuserbox_last_open=post_id;},2000);}
function postuserbox_keepopen(){if(postuserbox_tmout){clearTimeout(postuserbox_tmout);}}
function postuserbox_close_ev(post_id){postuserbox_tmout=setTimeout(function(){postuserbox_close(post_id)},1000);if(postuserbox_open_timer){clearTimeout(postuserbox_open_timer);}}
function postuserbox_close(post_id){postuserbox_keepopen();if(!post_id&&postuserbox_last_open){post_id=postuserbox_last_open;}
if(!post_id){return;}
d.getElementById("postuserbox_av2_"+post_id).style.display="none";d.getElementById("postuserbox_av1_"+post_id).style.display="block";postuserbox_last_open=false;}
function reshare_post(postid,confirmmsg,msg_after)
{var req=ajax_init(false);if(!req){return;}
if(confirmmsg){if(!confirm(confirmmsg)){return false;}}
req.onreadystatechange=function(){if(req.readyState!=4){return;}
if(req.responseText!="OK"){return;}
d.location.reload(true);}
req.open("POST",siteurl+"ajax/reshare/r:"+Math.round(Math.random()*1000),true);req.setRequestHeader("Content-type","application/x-www-form-urlencoded");req.send("postid="+encodeURIComponent(postid)+"&type=on");}
function unshare_post(postid,confirmmsg,msg_after)
{var req=ajax_init(false);if(!req){return;}
if(confirmmsg){if(!confirm(confirmmsg)){return false;}}
req.onreadystatechange=function(){if(req.readyState!=4){return;}
if(req.responseText!="OK"){return;}
d.location.reload(true);}
req.open("POST",siteurl+"ajax/reshare/r:"+Math.round(Math.random()*1000),true);req.setRequestHeader("Content-type","application/x-www-form-urlencoded");req.send("postid="+encodeURIComponent(postid)+"&type=off");}
function post_to_twitter(postid,confirmmsg,msg_after)
{var req=ajax_init(false);if(!req){return;}
if(confirmmsg){if(!confirm(confirmmsg)){return false;}}
req.onreadystatechange=function(){if(req.readyState!=4){return;}
if(req.responseText!="OK"){return;}
if(msg_after){slim_msgbox(msg_after);}}
req.open("POST",siteurl+"ajax/post-to-twitter/r:"+Math.round(Math.random()*1000),true);req.setRequestHeader("Content-type","application/x-www-form-urlencoded");req.send("postid="+encodeURIComponent(postid));}
function post_to_facebook(postid,confirmmsg,msg_after)
{var req=ajax_init(false);if(!req){return;}
if(confirmmsg){if(!confirm(confirmmsg)){return false;}}
req.onreadystatechange=function(){if(req.readyState!=4){return;}
if(req.responseText!="OK"){return;}
if(msg_after){slim_msgbox(msg_after);}}
req.open("POST",siteurl+"ajax/post-to-facebook/r:"+Math.round(Math.random()*1000),true);req.setRequestHeader("Content-type","application/x-www-form-urlencoded");req.send("postid="+encodeURIComponent(postid));}
function post_like(postid)
{var req=ajax_init(false);if(!req){return;}
var thislink=d.getElementById("postlink_like_"+postid);req.onreadystatechange=function(){if(req.readyState!=4){return;}
if(req.responseText!="OK"){return;}
d.getElementById("postlink_like_"+postid).style.display="Like";d.getElementById("postlink_like_"+postid).style.display="Unlike";posts_synchronize();}
req.open("POST",siteurl+"ajax/likepost/r:"+Math.round(Math.random()*1000),true);req.setRequestHeader("Content-type","application/x-www-form-urlencoded");req.send("type=on&postid="+encodeURIComponent(postid));thislink.style.cursor="wait";d.getElementById("postlink_unlike_"+postid).style.cursor="wait";}
function post_unlike(postid)
{var req=ajax_init(false);if(!req){return;}
var thislink=d.getElementById("postlink_like_"+postid);req.onreadystatechange=function(){if(req.readyState!=4){return;}
if(req.responseText!="OK"){return;}
thislink.style.cursor="pointer";thislink.style.display="none";d.getElementById("postlink_unlike_"+postid).style.display="Unlike";d.getElementById("postlink_like_"+postid).style.display="Like";posts_synchronize();}
req.open("POST",siteurl+"ajax/dislikepost/r:"+Math.round(Math.random()*1000),true);req.setRequestHeader("Content-type","application/x-www-form-urlencoded");req.send("type=on&postid="+encodeURIComponent(postid));thislink.style.cursor="wait";d.getElementById("postlink_like_"+postid).style.cursor="wait";}
function post_likecomment(postid,commentid)
{var req=ajax_init(false);if(!req){return;}
var thislink=d.getElementById("postlink_clike_"+commentid);req.onreadystatechange=function(){if(req.readyState!=4){return;}
if(req.responseText!="OK"){return;}
thislink.style.cursor="pointer";thislink.style.display="none";d.getElementById("postlink_clike_"+commentid).style.display="Like";d.getElementById("postlink_cunlike_"+commentid).style.display="none";d.getElementById("postlink_cunlike_"+commentid).style.display="Unlike";if(d.getElementById("viewpost")){viewpost_synchronize();}
else{posts_synchronize_single(postid);}}
req.open("POST",siteurl+"ajax/likecomment/r:"+Math.round(Math.random()*1000),true);req.setRequestHeader("Content-type","application/x-www-form-urlencoded");req.send("type=on&postid="+encodeURIComponent(postid)+"&commentid="+encodeURIComponent(commentid));thislink.style.cursor="wait";}
function post_unlikecomment(postid,commentid)
{var req=ajax_init(false);if(!req){return;}
var thislink=d.getElementById("postlink_cunlike_"+commentid);req.onreadystatechange=function(){if(req.readyState!=4){return;}
if(req.responseText!="OK"){return;}
if(req.responseText=="OK")
thislink.style.cursor="pointer";thislink.style.display="none";d.getElementById("postlink_cunlike_"+commentid).style.display="Unlike";d.getElementById("postlink_clike_"+commentid).style.display="none";d.getElementById("postlink_clike_"+commentid).style.display="Like";if(d.getElementById("viewpost")){viewpost_synchronize();}
else{posts_synchronize_single(postid);}}
req.open("POST",siteurl+"ajax/dislikecomment/r:"+Math.round(Math.random()*1000),true);req.setRequestHeader("Content-type","application/x-www-form-urlencoded");req.send("type=on&postid="+encodeURIComponent(postid)+"&commentid="+encodeURIComponent(commentid));thislink.style.cursor="wait";}
function facebox_open_likepostmembers(postid)
{var req=ajax_init(false);if(!req){return;}
req.onreadystatechange=function(){if(req.readyState!=4){return;}
jQuery.facebox(function(){jQuery.facebox(req.responseText)})}
req.open("POST",siteurl+"faceboxlike_users/r:"+Math.round(Math.random()*1000),true);req.setRequestHeader("Content-type","application/x-www-form-urlencoded");req.send("post_id="+encodeURIComponent(postid));}
function facebox_open_dislikepostmembers(postid)
{var req=ajax_init(false);if(!req){return;}
req.onreadystatechange=function(){if(req.readyState!=4){return;}
jQuery.facebox(function(){jQuery.facebox(req.responseText)})}
req.open("POST",siteurl+"faceboxdislike_users/r:"+Math.round(Math.random()*1000),true);req.setRequestHeader("Content-type","application/x-www-form-urlencoded");req.send("post_id="+encodeURIComponent(postid));}
function facebox_open_likecommentmembers(commentid)
{var req=ajax_init(false);if(!req){return;}
req.onreadystatechange=function(){if(req.readyState!=4){return;}
jQuery.facebox(function(){jQuery.facebox(req.responseText)})}
req.open("POST",siteurl+"faceboxcommentlike_users/r:"+Math.round(Math.random()*1000),true);req.setRequestHeader("Content-type","application/x-www-form-urlencoded");req.send("comment_id="+encodeURIComponent(commentid));}
function facebox_open_dislikecommentmembers(postid)
{var req=ajax_init(false);if(!req){return;}
req.onreadystatechange=function(){if(req.readyState!=4){return;}
jQuery.facebox(function(){jQuery.facebox(req.responseText)})}
req.open("POST",siteurl+"faceboxcommentdislike_users/r:"+Math.round(Math.random()*1000),true);req.setRequestHeader("Content-type","application/x-www-form-urlencoded");req.send("comment_id="+encodeURIComponent(commentid));}
function showfulltext(id){d.getElementById('text_cut_'+id).style.display="none";d.getElementById('text_full_'+id).style.display="block";}
function showcuttext(id){d.getElementById('text_full_'+id).style.display="none";d.getElementById('text_cut_'+id).style.display="block";}
function send_to_link(postid,url){var req=ajax_init(true);if(!req){return false;}
if(!postid||!url){return false;}
req.onreadystatechange=function(){if(req.readyState!=4){return false;}
if(req.responseText!='OK'){return false;}
window.open(url)}
req.open("POST",siteurl+"ajax/addlinkclick/r:"+Math.round(Math.random()*1000),true);req.setRequestHeader("Content-type","application/x-www-form-urlencoded");req.send("type=on&postid="+encodeURIComponent(postid));}
function astha(post_id){var req=ajax_init(false);if(!req){return;}
req.onreadystatechange=function(){if(req.readyState!=4){return;}
jQuery.facebox(function(){jQuery.facebox(req.responseText)})}
req.open("POST",siteurl+"signpop/r:"+Math.round(Math.random()*1000),true);req.setRequestHeader("Content-type","application/x-www-form-urlencoded");req.send("post_id="+encodeURIComponent(post_id));}
;var swfobject=function(){var D="undefined",r="object",S="Shockwave Flash",W="ShockwaveFlash.ShockwaveFlash",q="application/x-shockwave-flash",R="SWFObjectExprInst",x="onreadystatechange",O=window,j=document,t=navigator,T=false,U=[h],o=[],N=[],I=[],l,Q,E,B,J=false,a=false,n,G,m=true,M=function(){var aa=typeof j.getElementById!=D&&typeof j.getElementsByTagName!=D&&typeof j.createElement!=D,ah=t.userAgent.toLowerCase(),Y=t.platform.toLowerCase(),ae=Y?/win/.test(Y):/win/.test(ah),ac=Y?/mac/.test(Y):/mac/.test(ah),af=/webkit/.test(ah)?parseFloat(ah.replace(/^.*webkit\/(\d+(\.\d+)?).*$/,"$1")):false,X=!+"\v1",ag=[0,0,0],ab=null;if(typeof t.plugins!=D&&typeof t.plugins[S]==r){ab=t.plugins[S].description;if(ab&&!(typeof t.mimeTypes!=D&&t.mimeTypes[q]&&!t.mimeTypes[q].enabledPlugin)){T=true;X=false;ab=ab.replace(/^.*\s+(\S+\s+\S+$)/,"$1");ag[0]=parseInt(ab.replace(/^(.*)\..*$/,"$1"),10);ag[1]=parseInt(ab.replace(/^.*\.(.*)\s.*$/,"$1"),10);ag[2]=/[a-zA-Z]/.test(ab)?parseInt(ab.replace(/^.*[a-zA-Z]+(.*)$/,"$1"),10):0}}else{if(typeof O.ActiveXObject!=D){try{var ad=new ActiveXObject(W);if(ad){ab=ad.GetVariable("$version");if(ab){X=true;ab=ab.split(" ")[1].split(",");ag=[parseInt(ab[0],10),parseInt(ab[1],10),parseInt(ab[2],10)]}}}catch(Z){}}}return{w3:aa,pv:ag,wk:af,ie:X,win:ae,mac:ac}}(),k=function(){if(!M.w3){return}if((typeof j.readyState!=D&&j.readyState=="complete")||(typeof j.readyState==D&&(j.getElementsByTagName("body")[0]||j.body))){f()}if(!J){if(typeof j.addEventListener!=D){j.addEventListener("DOMContentLoaded",f,false)}if(M.ie&&M.win){j.attachEvent(x,function(){if(j.readyState=="complete"){j.detachEvent(x,arguments.callee);f()}});if(O==top){(function(){if(J){return}try{j.documentElement.doScroll("left")}catch(X){setTimeout(arguments.callee,0);return}f()})()}}if(M.wk){(function(){if(J){return}if(!/loaded|complete/.test(j.readyState)){setTimeout(arguments.callee,0);return}f()})()}s(f)}}();function f(){if(J){return}try{var Z=j.getElementsByTagName("body")[0].appendChild(C("span"));Z.parentNode.removeChild(Z)}catch(aa){return}J=true;var X=U.length;for(var Y=0;Y<X;Y++){U[Y]()}}function K(X){if(J){X()}else{U[U.length]=X}}function s(Y){if(typeof O.addEventListener!=D){O.addEventListener("load",Y,false)}else{if(typeof j.addEventListener!=D){j.addEventListener("load",Y,false)}else{if(typeof O.attachEvent!=D){i(O,"onload",Y)}else{if(typeof O.onload=="function"){var X=O.onload;O.onload=function(){X();Y()}}else{O.onload=Y}}}}}function h(){if(T){V()}else{H()}}function V(){var X=j.getElementsByTagName("body")[0];var aa=C(r);aa.setAttribute("type",q);var Z=X.appendChild(aa);if(Z){var Y=0;(function(){if(typeof Z.GetVariable!=D){var ab=Z.GetVariable("$version");if(ab){ab=ab.split(" ")[1].split(",");M.pv=[parseInt(ab[0],10),parseInt(ab[1],10),parseInt(ab[2],10)]}}else{if(Y<10){Y++;setTimeout(arguments.callee,10);return}}X.removeChild(aa);Z=null;H()})()}else{H()}}function H(){var ag=o.length;if(ag>0){for(var af=0;af<ag;af++){var Y=o[af].id;var ab=o[af].callbackFn;var aa={success:false,id:Y};if(M.pv[0]>0){var ae=c(Y);if(ae){if(F(o[af].swfVersion)&&!(M.wk&&M.wk<312)){w(Y,true);if(ab){aa.success=true;aa.ref=z(Y);ab(aa)}}else{if(o[af].expressInstall&&A()){var ai={};ai.data=o[af].expressInstall;ai.width=ae.getAttribute("width")||"0";ai.height=ae.getAttribute("height")||"0";if(ae.getAttribute("class")){ai.styleclass=ae.getAttribute("class")}if(ae.getAttribute("align")){ai.align=ae.getAttribute("align")}var ah={};var X=ae.getElementsByTagName("param");var ac=X.length;for(var ad=0;ad<ac;ad++){if(X[ad].getAttribute("name").toLowerCase()!="movie"){ah[X[ad].getAttribute("name")]=X[ad].getAttribute("value")}}P(ai,ah,Y,ab)}else{p(ae);if(ab){ab(aa)}}}}}else{w(Y,true);if(ab){var Z=z(Y);if(Z&&typeof Z.SetVariable!=D){aa.success=true;aa.ref=Z}ab(aa)}}}}}function z(aa){var X=null;var Y=c(aa);if(Y&&Y.nodeName=="OBJECT"){if(typeof Y.SetVariable!=D){X=Y}else{var Z=Y.getElementsByTagName(r)[0];if(Z){X=Z}}}return X}function A(){return!a&&F("6.0.65")&&(M.win||M.mac)&&!(M.wk&&M.wk<312)}function P(aa,ab,X,Z){a=true;E=Z||null;B={success:false,id:X};var ae=c(X);if(ae){if(ae.nodeName=="OBJECT"){l=g(ae);Q=null}else{l=ae;Q=X}aa.id=R;if(typeof aa.width==D||(!/%$/.test(aa.width)&&parseInt(aa.width,10)<310)){aa.width="310"}if(typeof aa.height==D||(!/%$/.test(aa.height)&&parseInt(aa.height,10)<137)){aa.height="137"}j.title=j.title.slice(0,47)+" - Flash Player Installation";var ad=M.ie&&M.win?"ActiveX":"PlugIn",ac="MMredirectURL="+O.location.toString().replace(/&/g,"%26")+"&MMplayerType="+ad+"&MMdoctitle="+j.title;if(typeof ab.flashvars!=D){ab.flashvars+="&"+ac}else{ab.flashvars=ac}if(M.ie&&M.win&&ae.readyState!=4){var Y=C("div");X+="SWFObjectNew";Y.setAttribute("id",X);ae.parentNode.insertBefore(Y,ae);ae.style.display="none";(function(){if(ae.readyState==4){ae.parentNode.removeChild(ae)}else{setTimeout(arguments.callee,10)}})()}u(aa,ab,X)}}function p(Y){if(M.ie&&M.win&&Y.readyState!=4){var X=C("div");Y.parentNode.insertBefore(X,Y);X.parentNode.replaceChild(g(Y),X);Y.style.display="none";(function(){if(Y.readyState==4){Y.parentNode.removeChild(Y)}else{setTimeout(arguments.callee,10)}})()}else{Y.parentNode.replaceChild(g(Y),Y)}}function g(ab){var aa=C("div");if(M.win&&M.ie){aa.innerHTML=ab.innerHTML}else{var Y=ab.getElementsByTagName(r)[0];if(Y){var ad=Y.childNodes;if(ad){var X=ad.length;for(var Z=0;Z<X;Z++){if(!(ad[Z].nodeType==1&&ad[Z].nodeName=="PARAM")&&!(ad[Z].nodeType==8)){aa.appendChild(ad[Z].cloneNode(true))}}}}}return aa}function u(ai,ag,Y){var X,aa=c(Y);if(M.wk&&M.wk<312){return X}if(aa){if(typeof ai.id==D){ai.id=Y}if(M.ie&&M.win){var ah="";for(var ae in ai){if(ai[ae]!=Object.prototype[ae]){if(ae.toLowerCase()=="data"){ag.movie=ai[ae]}else{if(ae.toLowerCase()=="styleclass"){ah+=' class="'+ai[ae]+'"'}else{if(ae.toLowerCase()!="classid"){ah+=" "+ae+'="'+ai[ae]+'"'}}}}}var af="";for(var ad in ag){if(ag[ad]!=Object.prototype[ad]){af+='<param name="'+ad+'" value="'+ag[ad]+'" />'}}aa.outerHTML='<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"'+ah+">"+af+"</object>";N[N.length]=ai.id;X=c(ai.id)}else{var Z=C(r);Z.setAttribute("type",q);for(var ac in ai){if(ai[ac]!=Object.prototype[ac]){if(ac.toLowerCase()=="styleclass"){Z.setAttribute("class",ai[ac])}else{if(ac.toLowerCase()!="classid"){Z.setAttribute(ac,ai[ac])}}}}for(var ab in ag){if(ag[ab]!=Object.prototype[ab]&&ab.toLowerCase()!="movie"){e(Z,ab,ag[ab])}}aa.parentNode.replaceChild(Z,aa);X=Z}}return X}function e(Z,X,Y){var aa=C("param");aa.setAttribute("name",X);aa.setAttribute("value",Y);Z.appendChild(aa)}function y(Y){var X=c(Y);if(X&&X.nodeName=="OBJECT"){if(M.ie&&M.win){X.style.display="none";(function(){if(X.readyState==4){b(Y)}else{setTimeout(arguments.callee,10)}})()}else{X.parentNode.removeChild(X)}}}function b(Z){var Y=c(Z);if(Y){for(var X in Y){if(typeof Y[X]=="function"){Y[X]=null}}Y.parentNode.removeChild(Y)}}function c(Z){var X=null;try{X=j.getElementById(Z)}catch(Y){}return X}function C(X){return j.createElement(X)}function i(Z,X,Y){Z.attachEvent(X,Y);I[I.length]=[Z,X,Y]}function F(Z){var Y=M.pv,X=Z.split(".");X[0]=parseInt(X[0],10);X[1]=parseInt(X[1],10)||0;X[2]=parseInt(X[2],10)||0;return(Y[0]>X[0]||(Y[0]==X[0]&&Y[1]>X[1])||(Y[0]==X[0]&&Y[1]==X[1]&&Y[2]>=X[2]))?true:false}function v(ac,Y,ad,ab){if(M.ie&&M.mac){return}var aa=j.getElementsByTagName("head")[0];if(!aa){return}var X=(ad&&typeof ad=="string")?ad:"screen";if(ab){n=null;G=null}if(!n||G!=X){var Z=C("style");Z.setAttribute("type","text/css");Z.setAttribute("media",X);n=aa.appendChild(Z);if(M.ie&&M.win&&typeof j.styleSheets!=D&&j.styleSheets.length>0){n=j.styleSheets[j.styleSheets.length-1]}G=X}if(M.ie&&M.win){if(n&&typeof n.addRule==r){n.addRule(ac,Y)}}else{if(n&&typeof j.createTextNode!=D){n.appendChild(j.createTextNode(ac+" {"+Y+"}"))}}}function w(Z,X){if(!m){return}var Y=X?"visible":"hidden";if(J&&c(Z)){c(Z).style.visibility=Y}else{v("#"+Z,"visibility:"+Y)}}function L(Y){var Z=/[\\\"<>\.;]/;var X=Z.exec(Y)!=null;return X&&typeof encodeURIComponent!=D?encodeURIComponent(Y):Y}var d=function(){if(M.ie&&M.win){window.attachEvent("onunload",function(){var ac=I.length;for(var ab=0;ab<ac;ab++){I[ab][0].detachEvent(I[ab][1],I[ab][2])}var Z=N.length;for(var aa=0;aa<Z;aa++){y(N[aa])}for(var Y in M){M[Y]=null}M=null;for(var X in swfobject){swfobject[X]=null}swfobject=null})}}();return{registerObject:function(ab,X,aa,Z){if(M.w3&&ab&&X){var Y={};Y.id=ab;Y.swfVersion=X;Y.expressInstall=aa;Y.callbackFn=Z;o[o.length]=Y;w(ab,false)}else{if(Z){Z({success:false,id:ab})}}},getObjectById:function(X){if(M.w3){return z(X)}},embedSWF:function(ab,ah,ae,ag,Y,aa,Z,ad,af,ac){var X={success:false,id:ah};if(M.w3&&!(M.wk&&M.wk<312)&&ab&&ah&&ae&&ag&&Y){w(ah,false);K(function(){ae+="";ag+="";var aj={};if(af&&typeof af===r){for(var al in af){aj[al]=af[al]}}aj.data=ab;aj.width=ae;aj.height=ag;var am={};if(ad&&typeof ad===r){for(var ak in ad){am[ak]=ad[ak]}}if(Z&&typeof Z===r){for(var ai in Z){if(typeof am.flashvars!=D){am.flashvars+="&"+ai+"="+Z[ai]}else{am.flashvars=ai+"="+Z[ai]}}}if(F(Y)){var an=u(aj,am,ah);if(aj.id==ah){w(ah,true)}X.success=true;X.ref=an}else{if(aa&&A()){aj.data=aa;P(aj,am,ah,ac);return}else{w(ah,true)}}if(ac){ac(X)}})}else{if(ac){ac(X)}}},switchOffAutoHideShow:function(){m=false},ua:M,getFlashPlayerVersion:function(){return{major:M.pv[0],minor:M.pv[1],release:M.pv[2]}},hasFlashPlayerVersion:F,createSWF:function(Z,Y,X){if(M.w3){return u(Z,Y,X)}else{return undefined}},showExpressInstall:function(Z,aa,X,Y){if(M.w3&&A()){P(Z,aa,X,Y)}},removeSWF:function(X){if(M.w3){y(X)}},createCSS:function(aa,Z,Y,X){if(M.w3){v(aa,Z,Y,X)}},addDomLoadEvent:K,addLoadEvent:s,getQueryParamValue:function(aa){var Z=j.location.search||j.location.hash;if(Z){if(/\?/.test(Z)){Z=Z.split("?")[1]}if(aa==null){return L(Z)}var Y=Z.split("&");for(var X=0;X<Y.length;X++){if(Y[X].substring(0,Y[X].indexOf("="))==aa){return L(Y[X].substring((Y[X].indexOf("=")+1)))}}}return""},expressInstallCallback:function(){if(a){var X=c(R);if(X&&l){X.parentNode.replaceChild(l,X);if(Q){w(Q,true);if(M.ie&&M.win){l.style.display="block"}}if(E){E(B)}}a=false}}}}();
