
var Facebook=new Class({Extends:Widget,initialize:function(){this.isLoading=false;this.cfg={hasSettingsBtn:true,title:"Facebook",module:"Facebook"}
this.tags={};this.content="<div id='cont' style='display:block' class='fb'>"+" <div id='error' style='width:210px;margin:5px auto;color:red;display:none'></div>"+" <div id='msg' style='display:none'></div>"+" <div id='fb_login' style='text-align:center'>"+loc.text('fb_loginmsg')+"<br/><br/><div id='login_button'></div></div><br />"+" <div id='icons' style='clear:both;'></div>"+" <div style='border-bottom:1px solid black;height:26px;clear:both;margin-top:10px;display:none' id='btns'>"+"  <div class='get_stream act'>"+loc.text('fb_stream')+"</div>"+"  <div class='get_friends inact'>"+loc.text('fb_friends')+"</div>"+" </div>"+" <div id='stream'>"+"  <div id='head' style='clear:both;margin-top:5px'></div>"+"  <div id='posts' style='clear:both'></div>"+" </div>"+" <div id='friends' style='clear:both;margin-top:5px'></div>"+" <div id='notes' style='clear:both;'></div>"+"</div>";this.defaultProfile["title"]="Facebook";this.defaultProfile["bgcolor"]="orig";this.defaultProfile["period"]=1200;this.defaultProfile["birthdays"]=1;this.defaultProfile["signs"]=1;this.defaultProfile["info"]=1;this.defaultProfile["scnt"]=5;this.uid=null;this.appid=null;this.icon=null;this.profiles=[];this.posts=[];this.comments=[];this.commentsprof=[];this.friends=[];this.spage=0;this.loaded=false;},onBuildInterface:function(){var t=this;t.settings="<form id='f"+t.id+"' onsubmit='return false'>"+"<div class='settings_section' style='padding:4px 8px'>"+" <span class='settings_label'>"+loc.text("inp_title")+"</span>"+" <input type='text' name='title' size='15' class='settings_control'>"+"</div>"+"<div class='settings_section'>"+" <span class='settings_label'>"+loc.text("fb_scount")+"</span>"+" <select name='scnt' class='settings_control'>"+"  <option value='3'"+(this.profile.scnt=='3'?' selected':'')+">3</option>"+"  <option value='5'"+(this.profile.scnt=='5'?' selected':'')+">5</option>"+"  <option value='8'"+(this.profile.scnt=='8'?' selected':'')+">8</option>"+"  <option value='10'"+(this.profile.scnt=='10'?' selected':'')+">10</option>"+"  <option value='12'"+(this.profile.scnt=='12'?' selected':'')+">12</option>"+"  <option value='9999'"+(this.profile.scnt=='9999'?' selected':'')+">"+loc.text("rss_all")+"</option>"+" </select>"+"</div>"+"<div class='settings_section'>"+" <span class='settings_label'>"+loc.text("fb_need_info")+"</span>"+" <input type='checkbox' size='15' name='info'"+(this.profile.info?' checked':'')+">"+"</div>"+"<div class='settings_section'>"+" <span class='settings_label'>"+loc.text("fb_need_birthdays")+"</span>"+" <input type='checkbox' size='15' name='birthdays'"+(this.profile.birthdays?' checked':'')+">"+"</div>"+"<div class='settings_section'>"+" <span class='settings_label'>"+loc.text("fb_need_signs")+"</span>"+" <input type='checkbox' size='15' name='signs'"+(this.profile.signs?' checked':'')+">"+"</div>"+"<div class='settings_section'>"+" <span class='settings_label'>"+loc.text("rss_inp_refresh")+"</span>"+" <select name='period' class='settings_control'>"+"  <option value='120'"+(this.profile.period=='120'?' selected':'')+">"+loc.text("rss_p120")+"</option>"+"  <option value='300'"+(this.profile.period=='300'?' selected':'')+">"+loc.text("rss_p300")+"</option>"+"  <option value='600'"+(this.profile.period=='600'?' selected':'')+">"+loc.text("rss_p600")+"</option>"+"  <option value='1200'"+(this.profile.period=='1200'?' selected':'')+">"+loc.text("rss_p1200")+"</option>"+"  <option value='1800'"+(this.profile.period=='1800'?' selected':'')+">"+loc.text("rss_p1800")+"</option>"+"  <option value='3600'"+(this.profile.period=='3600'?' selected':'')+">"+loc.text("rss_p3600")+"</option>"+"  <option value='10800'"+(this.profile.period=='10800'?' selected':'')+">"+loc.text("rss_p10800")+"</option>"+" </select>"+"</div>"+"</form>";t.setSettings(t.settings+t.changeColors);t.setContent(t.content);t.tags['title']=t.mid.getElement('input[name=title]');t.tags['period']=t.mid.getElement('select[name=period]');t.tags['signs']=t.mid.getElement('input[name=signs]');t.tags['birthdays']=t.mid.getElement('input[name=birthdays]');t.tags['info']=t.mid.getElement('input[name=info]');t.tags['scnt']=t.mid.getElement('select[name=scnt]');t.tags['title'].value=t.profile.title;t.tags['bstream']=t.mid.getElement('div.get_stream');t.tags['bfriends']=t.mid.getElement('div.get_friends');t.tags['friends']=t.mid.getElement('div[id=friends]');t.tags['stream']=t.mid.getElement('div[id=stream]');t.tags['head']=t.mid.getElement('div[id=head]');t.tags['btns']=t.mid.getElement('div[id=btns]');t.tags['posts']=t.mid.getElement('div[id=posts]');t.tags['fb_login']=t.mid.getElement('div[id=fb_login]');t.tags['icons']=t.mid.getElement('div[id=icons]');t.tags['notes']=t.mid.getElement('div[id=notes]');t.tags['scnt'].addEvent('change',function(){t.profile.scnt=t.getValue('scnt');t.showPosts();t.save();});t.tags['signs'].addEvent('click',function(){t.profile.signs=t.getProp('signs','checked')?1:0;if(t.profile.signs==1){t.mid.getElement('div[id=signs]').style.display='block';}else{t.mid.getElement('div[id=signs]').style.display='none';}
t.save();});t.tags['birthdays'].addEvent('click',function(){t.profile.birthdays=t.getProp('birthdays','checked')?1:0;if(t.profile.birthdays==1){t.mid.getElement('div[id=birthdays]').style.display='block';}else{t.mid.getElement('div[id=birthdays]').style.display='none';}
t.save();});t.tags['info'].addEvent('click',function(){t.profile.info=t.getProp('info','checked')?1:0;if(t.profile.info==1){t.mid.getElement('div[id=info]').style.display='block';}else{t.mid.getElement('div[id=info]').style.display='none';}
t.save();});t.tags['bstream'].addEvent('click',function(){t.sendAct(this,'get_stream');});t.tags['bfriends'].addEvent('click',function(){t.sendAct(this,'get_friends');});t.tags['title'].addEvent('keydown',function(e){if(e.key=='enter')
t.settingsSetTitle();});t.setTitle(t.profile.title);t.tags['period'].addEvent('change',function(){t.setPeriod();});t.colorsAction();t.setBgColor(t.profile.bgcolor,1);},onOpen:function(){request.send({fb_action:'get_apikey'},this);main.processTimer(this.id,this.profile.period*1000);},saveProfile:function(){},refresh:function(){if(this.loaded){this.comments=[];this.sendAct(null,'notifications_get');this.sendAct(null,'get_stream');}},setPeriod:function(){this.profile.period=this.getValue('period');main.stopTimer(this.id);main.processTimer(this.id,this.profile.period*1000,true);this.save();},timerHandler:function(){if(!this.isInReader){this.refresh();this.loaded=true;}},calcRelTime:function(H){var I=new Date(H*1000);var G=I.getFullYear()+"-"+(I.getMonth()+1)+"-"+I.getDate()+"-"+I.getHours()+"-"+I.getMinutes()+"-"+I.getSeconds();G=G.split("-");for(var F=0,E=G.length;F<E;F++){if(G[F].length==1){G[F]="0"+G[F]}}
var E=-(new Date().getTimezoneOffset()/60);if(typeof E!="number"){E=0}
var A=new Date(G[0],G[1]-1,G[2],G[3],G[4],G[5]);var C=new Date();var F=parseInt((C.getTime()-A.getTime())/1000);F=F+(C.getTimezoneOffset()*60+3600*E);if(F<60){return(loc.text("fb_lm"));}
else{if(F<120){return(loc.text("fb_1m"));}
else{if(F<(45*60)){return(Math.round(F/60)+loc.text("fb_m"));}
else{if(F<(90*60)){return(loc.text("fb_1h"));}
else{if(F<(24*60*60)){return(Math.round(F/3600)+loc.text("fb_h"));}
else{if(A.getDate()==C.getDate()-1){return(loc.text("fb_y"));}
else{return(Math.round(F/86400)+loc.text("fb_d"));}}}}}}},friend_info:function(uid){var h='',f=this.friends[uid];h+="<div style='float:left;height:100px;padding-right:10px;'><img src="+f.pic+" style='max-height:100px;max-width:100px;'></div><div><b>"+loc.text("fb_name")+" <a href='"+f.profile_url+"' target='_blank'>"+f.name+"</a></b></div>";if(f.status.message)h+="<div><b>"+loc.text("fb_status")+"</b> "+f.status.message+"</div>";h+="<div><b>"+loc.text("fb_sex")+"</b> "+f.sex+"</div><div><b>"+loc.text("fb_birth")+"</b> "+f.birthday+"</div>";if(f.hometown_location.city)
h+="<div><b>"+loc.text("fb_birthloc")+"</b> "+f.hometown_location.city+"</div>";this.mid.getElement('div[id="finfo"]').innerHTML=h;},sendAct:function(obj,act,pid,fid){var c,pi,cpid,comment='',h='',t=this;if(obj){c=obj.className;c=c.split(" ");c=c[0];}
cpid=t.mid.getElement('div[id="c'+pid+'"]');if(act=='stream_addcomment'){var txt=t.mid.getElement('textarea[id=txt'+pid+']');comment=txt.value;obj.disabled=true;txt.disabled=true;txt.style.backgroundColor='#cccccc';}
else if(act=='stream_publish'){comment=t.tags.share.value;obj.disabled=true;t.tags.share.disabled=true;t.tags.share.getParent().style.backgroundColor='#cccccc';}
else if(act=='get_comments'){if(cpid.style.display=='none'){cpid.style.display='block'}
else{cpid.style.display='none'}
if(this.comments[pid]){t.showComments(this.comments[pid],pid);act='';}}
else if(act=='stream_removecomment'){if(!confirm("Biztosan törölni akarod?"))
act='';}
else if(act=='stream_remove'){if(!confirm("Biztosan törölni akarod?"))
act='';}
else if(act=='comment_link'){act='';pi=this.searchPost(pid);if(this.posts[pi].comments.count>0){cpid.style.display='block';;}
var e=t.mid.getElement('div[id="cbox'+pid+'"]');if(e.style.display=='none'){e.style.display='block';if(!this.comments[pid])act='get_comments';else t.showComments(this.comments[pid],pid);}else{e.style.display='none';}}
else if(act=='get_friends'){if(t.tags.friends.style.display=='block'||this.friends.length>0){act='';}
else{t.tags.friends.innerHTML=loc.text("fb_loading");}
if(obj){obj.className='get_friends act';t.tags.btns.getChildren('div')[0].className='get_stream inact';}
t.tags.stream.style.display='none';t.tags.friends.style.display='block';}
else if(act=='get_stream'){if(obj){obj.className='get_stream act';t.tags.btns.getChildren('div')[1].className='get_friends inact';}
t.tags.stream.style.display='block';t.tags.friends.style.display='none';}
if(act!=''){request.send({uid:uid,fb_action:act,pid:pid,comment:comment,fid:fid},this);if(act=='get_comments'){cpid.innerHTML=loc.text("fb_loading");}}},searchPost:function(pid){for(var i=0;i<this.posts.length;i++){if(this.posts[i].id==pid){break;}}
return i;},dispatchMsg:function(response3){var t=this,pi;var d=response3;if(d.error){alert('HIBA!'+d.error);}
if(d.act=='get_apikey'){FB_RequireFeatures(["XFBML"],function(){t.appid=d.appid;t.icon=d.icon;FB.init(d.apikey,"/facebook/xd_receiver.htm");FB.XFBML.Host.autoParseDomTree=false;FB.Connect.ifUserConnected(null,function(){FB.XFBML.Host.addElement(new FB.XFBML.LoginButton($("login_button")));});FB.Facebook.get_sessionState().waitUntilReady(function(){this.uid=FB.Connect.get_loggedInUser();if(this.uid){t.uid=this.uid;t.tags.fb_login.style.display='none';request.send({uid:uid,fb_action:'get_permission'},t);}});});}
else if(d.act=='get_permission'){if(d.publish=='1'&&d.read=='1'&&d.offline=='1'){t.sendAct(null,'notifications_get');t.tags.btns.style.display='block';t.tags.head.innerHTML=loc.text("fb_loading");t.sendAct(null,'get_stream');}else{FB.Connect.showPermissionDialog("publish_stream,read_stream,offline_access",function(perm){if(perm!='publish_stream,read_stream,offline_access'){alert(loc.text('fb_perm_error'));}else{t.sendAct(null,'notifications_get');t.tags.btns.style.display='block';t.sendAct(null,'get_stream');}});}}
else if(d.act=='get_comments'){t.comments[d.pid]=d.comments;t.showComments(d.comments,d.pid);}
else if(d.act=='stream_publish'){var c=Math.floor((new Date()).getTime()/1000);var newPost={id:d.msg,source_id:t.uid,viewer_id:t.uid,message:d.comment,created_time:c,likes:{},comments:{count:0},app_id:t.appid,attribution:'Widgami',attachment:{icon:t.icon}};t.posts.unshift(newPost);t.showPosts();t.tags.share.value='';t.tags.disabled=false;t.tags.share.disabled=false;t.tags.share.parentNode.style.backgroundColor='#ffffff';t.mid.getElement('input.share').disabled=false;}
else if(d.act=='stream_remove'){pi=t.searchPost(d.pid);t.posts.splice(pi,1);t.showPosts();}
else if(d.act=='stream_addlike'){pi=t.searchPost(d.pid);t.posts[pi].likes.count++;t.posts[pi].likes.user_likes=1;t.showPosts();}
else if(d.act=='stream_removelike'){pi=t.searchPost(d.pid);t.posts[pi].likes.count--;t.posts[pi].likes.user_likes=0;t.showPosts();}
else if(d.act=='stream_addcomment'){d.pid.disabled=false;t.mid.getElement('textarea[id="txt'+d.pid+'"]').disabled=false;t.mid.getElement('textarea[id="txt'+d.pid+'"]').style.backgroundColor='#ffffff';t.mid.getElement('textarea[id="txt'+d.pid+'"]').value='';t.mid.getElement('div[id="cbox'+d.pid+'"]').style.display='none';var c=Math.floor((new Date()).getTime()/1000);var nc={id:d.msg,fromid:t.uid,text:d.comment,time:c,name:t.profiles[t.uid].name,profile_url:t.profiles[t.uid].url,pic_square:t.profiles[t.uid].pic_square};if(t.comments[d.pid]&&t.comments[d.pid].length>0){t.comments[d.pid].unshift(nc);}
else{t.comments[d.pid]=new Array()
t.comments[d.pid].push(nc);}
for(var i=0;i<this.posts.length;i++){if(this.posts[i].id==d.pid){this.posts[i].comments.count++;break;}}
t.showPosts();t.showComments(this.comments[d.pid],d.pid);t.mid.getElement('div[id="c'+d.pid+'"]').style.display='block';}
else if(d.act=='stream_removecomment'){for(var i=0;i<t.comments[d.xid].length;i++){if(t.comments[d.xid][i].id==d.pid){t.comments[d.xid].splice(i,1);break;}}
pi=t.searchPost(d.xid);t.posts[pi].comments.count--;t.showPosts();if(t.comments[d.xid].length>0){t.showComments(t.comments[d.xid],d.xid);t.mid.getElement('div[id="c'+d.xid+'"]').style.display='block';}}else if(d.act=='notifications_get'){var h="<div id='info' style='text-align:center;padding-bottom:10px;display:"+(t.profile.info?'block':'none')+"'><a class='fb-info fb-msg' href='http://www.facebook.com/inbox/' target='_blank' title='"+loc.text("fb_msgs")+"'>";if(d.msg.messages.unread!='0'){h+="<span> "+d.msg.messages.unread+"</span>";}
else{h+=d.msg.messages.unread;}
h+="</a><a class='fb-info fb-pokes' href='http://www.facebook.com/home/' target='_blank' title='"+loc.text('fb_dig')+"'>";if(d.msg.pokes.unread!='0'){h+=" <span>"+d.msg.pokes.unread+"</span>";}
else{h+=d.msg.pokes.unread;}
h+="<a class='fb-info fb-groups' href='http://www.facebook.com/reqs.php#group_confirm' target='_blank' title='"+loc.text('fb_group')+"'> "+d.msg.group_invites.length+"</a><a class='fb-info fb-events' href='http://www.facebook.com/reqs.php#event_confirm' target='_blank' title='"+loc.text('fb_events')+"'>"+d.msg.event_invites.length+"</a><a class='fb-info fb-signs' href='http://www.facebook.com/reqs.php#friend' target='_blank' title='"+loc.text('fb_signs')+"'>"+d.msg.friend_requests.length+"</a></div>";t.tags.icons.innerHTML=h;h="<div id='signs' style='display:"+(t.profile.signs?"block":"none")+"'>";if(d.persons){h+="<div style='color:white;background-color:#5B74A8;padding:5px;margin-bottom:10px;font-weight:bold'>"+loc.text('fb_signs')+"</div>";for(var i in d.persons){var p=d.persons[i];h+="<div style='clear:both;margin-top:5px;padding-bottom:5px;border-bottom:1px dotted #cccccc'><div style='float:left;padding-right:10px;width:100px;height:auto;text-align:center'><img src="+p.pic+" style='max-height:100px;max-width:100px;'></div>";if(p.name!='not_public'){h+="<div><b>"+loc.text('fb_name')+" <a href='"+p.profile_url+"' target='_blank'>"+p.name+"</a></b></div>";if(p.status.message){h+="<div><b>"+loc.text('fb_status')+"</b> "+p.status.message+"</div>";}
h+="<div><b>"+loc.text('fb_sex')+"</b> "+p.sex+"</div><div><b>"+loc.text('fb_birth')+"</b> "+p.birthday+"</div>";if(p.hometown_location.city){h+="<div><b>"+loc.text('fb_birthloc')+"</b> "+p.hometown_location.city+"</div>";}}
else{h+="<div><b><a href='"+p.profile_url+"' target='_blank'>"+loc.text('fb_notpublic_msg')+"</a></b></div>";}
h+="<br clear='both'></div>";}}
h+="</div>";h+="<div id='birthdays' style='display:"+(t.profile.birthdays?"block":"none")+"'>";h+="<div style='color:white;background-color:#5B74A8;padding:5px;margin-bottom:10px;font-weight:bold'>"+loc.text('fb_birthdays')+"</div>";if(d.birthdays){for(var i=0;i<d.birthdays.length;i++){var p=d.birthdays[i];h+="<div style='clear:both;margin-top:5px;padding-bottom:5px;border-bottom:1px dotted #cccccc'><div style='float:left;padding-right:10px;width:100px;height:auto;text-align:center'><img src="+p.pic+" style='max-height:100px;max-width:100px;'></div>";h+="<div><b><a href='"+p.profile_url+"' target='_blank'>"+p.name+"</a></b>";if(p.yold){h+=" ma "+p.yold+" éves";}
h+="</div>";h+="<br clear='both'></div>";}}
else{h+="<div>"+loc.text('fb_nobirths')+"</div>";}
h+="</div>";t.tags.notes.innerHTML=h;}
else if(d.act=='get_friends'){var h="",i=0;t.friends=d.friends;t.tags.friends.innerHTML="<div id='finfo'></div>";h+="<div style='clear:both'>";for(var f in t.friends){if(i==0){t.friend_info(t.friends[f].uid);}
h+="<div class='fimgout' onclick=main.getWidget("+t.id+").friend_info('"+t.friends[f].uid+"')>";if(t.friends[f].pic_square){h+=" <img src='"+t.friends[f].pic_square+"' alt='"+t.friends[f].name+"'>";}else{h+=" <img src='http://static.ak.connect.facebook.com/pics/q_silhouette.gif'>";}
h+="</div>";i++;}
t.friends.length=i;h+='</div>';t.tags.friends.innerHTML+=h;}
else if(d.act=='get_stream'){t.profiles=d.profiles;t.posts=d.posts;t.showHead();t.showPosts();}},showComments:function(comments,pid){if(comments.length>0){var h='',t=this;for(var i=0;i<comments.length;i++){h+="<div id='c"+comments[i].id+"' class='' style='clear:both;border-bottom:2px solid white;margin-bottom:2px;padding:6px 4px 3px 6px;'>"+" <a title='"+comments[i].name+"' href='"+comments[i].profile_url+"'style='float:left;margin-right:8px' target='_blank'><img src='"+comments[i].pic_square+"' alt='"+comments[i].name+"' style='width:32px;height:32px'/></a>"+"  <div class=''>"+"   <div class='comment_text'>"+"    <a class='comment_author' href='"+comments[i].profile_url+"' style='font-weight:bold' target='_blank'>"+comments[i].name+"</a>"+"    <div style='display:inline;padding-left:0.4em;'>"+comments[i].text+"</div>"+"   </div>"+"   <div>"+t.calcRelTime(comments[i].time);if(comments[i].fromid==t.uid){h+="· <a href='javascript:void(0);' class='stream_removecomment' onclick=main.getWidget("+t.id+").sendAct(this,'stream_removecomment','"+comments[i].id+"','"+comments[i].fromid+"'); title=''>"+loc.text('fb_delete2')+"</a>";}
h+="  </div></div><br clear='all'>"+" </div>";}
t.mid.getElement('div[id=c'+pid+']').innerHTML=h;}},showHead:function(){var h="",t=this;h+="<div style='padding-left:52px;position:relative'>"+" <div style='position:absolute;left:0px;top:0px'><img src='"+t.profiles[t.posts[0].viewer_id].pic_square+"' alt='"+t.profiles[t.posts[0].viewer_id].name+"'/></div>"+" <div style=''>"+"  <div style='border:1px solid #ccc'>"+"   <textarea style='border:none;padding:2px;width:95%;font-family:Tahoma,Verdana;height:44px;font-size:11px' id='share'></textarea>"+"  </div>"+" </div>"+" <div style='text-align:right'><input class='share' type='button' style='border:1px solid #0C2253;padding:3px;background-color:#5B74A8;color:white;font-size:11px;margin-top:3px' value='Megosztom' onclick=main.getWidget("+t.id+").sendAct(this,'stream_publish',0);></div>"+"</div>";t.tags.head.innerHTML=h;t.tags.share=t.mid.getElement('textarea[id=share]');},showPosts:function(){var p,h="",t=this,n;var plength=t.posts.length;var num=t.spage*t.profile.scnt;for(var i=num;i<parseInt(parseInt(num)+parseInt(t.profile.scnt));i++){if(t.posts[i]){p=t.posts[i];prof=t.profiles[p.source_id];n="";h+="<div class='post'>"+" <div class='upic'>"+"  <a title='"+prof.name+"' class='upic' href='"+prof.url+"' target='_blank'>"+"   <img src='"+prof.pic_square+"' alt='"+prof.name+"'/>"+"  </a>"+" </div>"+" <div class='msg-block'>"+"  <div class='msg'>"+"   <span class='name'><a href='"+prof.url+"' target='_blank'>"+prof.name+"</a></span>"+"   <span class='msg'>"+p.message+"</span>"+"  </div>";if(p.attachment){h+="  <div class='att'>";if(p.attachment.media){if(p.attachment.media.length>1){h+="<div class='media double'>";for(j=0;j<p.attachment.media.length;j++){h+="    <a href='"+p.attachment.media[j].href+"' target='_blank'>"+"     <img alt='' src='"+p.attachment.media[j].src+"'/>"+"    </a>";}
h+="   </div>";}
else{h+="   <div class='media single'>"+"    <a href='"+p.attachment.media[0].href+"' target='_blank'>"+"     <img alt='' src='"+p.attachment.media[0].src+"'/>"+"    </a>"+"   </div>";}}
if(p.attachment.fb_object_type=='photo'){h+="<div class='UIStoryAttachment_Copy'><div><a href='"+p.attachment.permalink+"' target='_blank'><b>"+p.attachment.name+"</b></a></div>";if(p.attachment.properties){h+="<div><span>"+p.attachment.properties[0].name+":&nbsp;</span><a href='"+p.attachment.properties[0].href+"' target='_blank'>"+p.attachment.properties[0].text+"</a></div>";}
h+="</div>";}
else if(p.attachment.fb_object_type=='album'){h+="   <div class='UIStoryAttachment_Copy'><a href='"+p.attachment.permalink+"' target='_blank'><b>"+p.attachment.name+"</b></a></div></div>";}
else{if(p.attachment.name){n="<a href='"+p.attachment.href+"' target='_blank'><b>"+p.attachment.name+"</b></a><br>";}
if(p.attachment.description){h+="   <div class='UIStoryAttachment_Copy'>"+n+p.attachment.description+"</div>";}}
h+="  </div>";}
h+="  <div class='links'>";if(p.attribution){h+="   <a title='"+p.attribution+"' class='icon' href='http://www.facebook.com/apps/application.php?id="+p.app_id+"' target='_blank'>"+"    <img src='"+(p.attachment.icon!='http://api.facebook.com/images/icons/hidden.gif'?p.attachment.icon:'pix/hidden.png')+"' alt=''>"+"   </a>";}
h+="   <div class='icon-block'>"+"    <span class='icon-time'>"+"     <abbr class='timestamp'>"+t.calcRelTime(p.created_time)+"</abbr>"+"    </span>";if(p.attribution){h+="    <span class='icon-bottom'>"+loc.text('fb_with')+" <a href='http://www.facebook.com/apps/application.php?id="+p.app_id+"' target='_blank'>"+p.attribution+"</a></span>";}
h+="     · <label class='comment_link' onclick=main.getWidget("+t.id+").sendAct(this,'comment_link','"+p.id+"')>"+loc.text('fb_addcomment')+"</label> · "+"    <span>";if(p.likes.user_likes==1){h+="   <a class='stream_removelike' href='javascript:void(0);' onclick=main.getWidget("+t.id+").sendAct(this,'stream_removelike','"+p.id+"');>"+loc.text('fb_notlike')+" </a>";}else{h+="   <a title='Tetszik' class='stream_addlike' href='javascript:void(0);' onclick=main.getWidget("+t.id+").sendAct(this,'stream_addlike','"+p.id+"');>"+loc.text('fb_like')+" </a>";}
if(p.app_id==t.appid&&prof.id==t.uid){h+="    · <a class='stream_remove' href='javascript:void(0);' onclick=main.getWidget("+t.id+").sendAct(this,'stream_remove','"+p.id+"');> "+loc.text('fb_delete')+"</a>";}
h+="   </span>";h+="   </div>";h+="  </div>";h+="<div id='cbox"+p.id+"' style='display:none'>"+"  <div class='comment_box'>"+"   <div class='comment_box_arr'></div>"+"   <div class='comment_box_inn' style='text-align:right;'>"+"    <textarea class='fb-textarea' rows='2' cols='30' id='txt"+p.id+"'></textarea><br>"+"    <input class='addcom' type='button' style='border:1px solid #0C2253;padding:3px;background-color:#5B74A8;color:white;font-size:11px;margin-top:3px' value='"+loc.text('fb_addcomment')+"' onclick=main.getWidget("+t.id+").sendAct(this,'stream_addcomment','"+p.id+"');>"+"   </div>"+"  </div>"+"  </div>";if(p.comments.count>0||p.likes.count>0){h+="<div class='comment_box'>"+" <div class='comment_box_arr'></div>"+" <div class='comment_box_inn'>";if(p.comments.count>0){h+="<div class='like_msg'><img src='pix/fb-comment.png'/>&nbsp;</div>";h+="<div class='get_comments' onclick=main.getWidget("+t.id+").sendAct(this,'get_comments','"+p.id+"');>"+p.comments.count+" "+loc.text('fb_comment')+"&nbsp;</div>";}
if(p.likes.count>0){h+="<div class='like_msg'><img src='pix/fb-like.png'/>&nbsp;</div>";if(p.likes.count==1){if(p.likes.user_likes==1){h+="<div class='like_msg'>"+loc.text('fb_youlike')+"</div>";}else{if(p.likes.friends.length>0){h+="<div class='like_msg'><a href='"+t.profiles[p.likes.friends[0]].url+"' target='_blank'>"+t.profiles[p.likes.friends[0]].name+"</a> "+loc.text('fb_like1')+"</div>";}
else if(p.likes.sample.length>0&&t.profiles[p.likes.sample[0]]){h+="<div class='like_msg'><a href='"+t.profiles[p.likes.sample[0]].url+"' target='_blank'>"+t.profiles[p.likes.sample[0]].name+"</a> "+loc.text('fb_like1')+"</div>";}else{h+="<div class='like_msg'>1 "+loc.text('fb_like2')+"</div>";}}}else{if(p.likes.user_likes==1&&p.likes.count==2){if(p.likes.friends.length>0){h+="<div class='like_msg'>"+loc.text('fb_you')+" <a href='"+t.profiles[p.likes.friends[0]].url+"' target='_blank'>"+t.profiles[p.likes.friends[0]].name+"</a> "+loc.text('fb_like1')+"</div>";}
else if(p.likes.sample.length>0&&t.profiles[p.likes.sample[0]]){h+="<div class='like_msg'>"+loc.text('fb_you')+" <a href='"+t.profiles[p.likes.sample[0]].url+"' target='_blank'>"+t.profiles[p.likes.sample[0]].name+"</a> "+loc.text('fb_like1')+"</div>";}}
else if(p.likes.user_likes==1){h+="<div class='like_msg'>"+loc.text('fb_you2')+" "+p.likes.count+" "+loc.text('fb_like2')+"</div>";}else{h+="<div class='like_msg'>"+p.likes.count+" "+loc.text('fb_like2')+"</div>";}}}
else{if(p.likes.user_likes=='1'){h+="<div style='float:left'>"+loc.text('fb_youlike')+"</div>";}}
h+="<br clear='all' /></div></div>";}
h+="<div id='c"+p.id+"' style='clear:both;display:none' class='comment_box_inn'></div>";h+=" </div>"+"</div>";}}
t.tags.posts.innerHTML=h;if(t.spage>0){row=new Element('div',{'html':"<div class='window_prev'>"+loc.text("rss_prev")+"</div><div class='window_prev_arrow'/>",'events':{'click':function(e){t.sPrev();}}});row.inject(t.tags.posts);}
if((t.posts.length-parseInt(parseInt(num)+parseInt(t.profile.scnt)))>0){row=new Element('div',{'html':"<div class='window_next'>"+loc.text("rss_next")+"</div><div class='window_next_arrow'/>",'events':{'click':function(e){t.sNext();}}});row.inject(t.tags.posts);}},sPrev:function(){this.spage--;this.showPosts();},sNext:function(){this.spage++;this.showPosts();},settingsAll:function(){this.settingsSetTitle();this.saveProfile();}});