var GenericAvatar=new Class({avatar_class:Avatar,options:new Array(),add_option:function(a){if(a.is_visible()){this.options.push(a)}},prepare_data:function(b){var a={id:b.id,name:b.name,city:b.city,photo_uri:b.photo_uri,friends_count:b.friends_count,artificiality:b.artificiality};return a},load_options:function(){this.options=new Array();this.add_option(new AvatarOptionGallery(this.user_data.id));this.add_option(new AvatarOptionSendGift(this.user_data.id));this.add_option(new AvatarOptionAddToFriends(this.user_data));this.add_option(new AvatarOptionCommonFriends(this.user_data));this.add_option(new AvatarOptionEurogabki(this.user_data.id));this.add_option(new AvatarOptionWalentynki2011(this.user_data.id))},render:function(b){this.user_data=this.prepare_data(b);this.load_options();var a=new Element("div",{"class":"avatar",events:{click:function(c){c.stopPropagation()}}});a.grab(this.get_content());if(nk_options.name_day&&nk_options.name_day.enabled==true){a.grab(this.get_name_day_button())}a.setStyle("display","block");return a},get_content:function(){var a=new Element("div",{"class":"avatar_content"});a.grab(this.get_photo());a.grab(this.get_user_info());a.grab(this.get_bar());return a},get_photo:function(){var b=new Element("div",{"class":"avatar_new_photo"});var a=new Element("div",{"class":"avatar_middle"});var e=new Element("div",{"class":"avatar_inner"});var d=new Element("a",{href:"/profile/"+this.user_data.id,title:"Przejdź do profilu"});d.grab(new Element("img",{alt:"Pokaż profil","class":this.user_data.photo_uri?"":"brak_zdjecia",src:this.user_data.photo_uri||getStaticUri("/img/avatar/brakzdjecia")}));var c=this.get_artificial();if(c){d.grab(c)}e.grab(d);a.grab(e);b.grab(a);return b},get_artificial:function(){this.user_data.artificiality=parseInt(this.user_data.artificiality);if(!this.user_data.artificiality){return}if(this.user_data.artificiality==3){return new Element("span",{"class":"official_tag"})}else{if(this.user_data.artificiality==2){return new Element("span",{"class":"sponsored_tag"})}else{return new Element("img",{alt:"Profil fikcyjny","class":"av_kontofikcyjne",src:getStaticUri("/img/avatar/av_kontofikcyjne")})}}},get_user_info:function(){var c=this;var b=new Element("div",{"class":"avatar_info"});b.addEvent("mouseover",function(d){c.avatar_class.add_hover(this)});b.addEvent("mouseleave",function(d){clearTimeout(this.t);this.has_hover=false});var a=new Element("div",{"class":"avatar_user_info"});a.grab(this.get_name());a.grab(this.get_city());b.grab(a);return b},get_html_name:function(a,b){return break_string(a,0,13)},get_name:function(){var a=new Element("a",{"class":"avatar_user_name",html:this.get_html_name(this.user_data.name,this.user_data.current_filter),title:"Przejdź do profilu",href:"/profile/"+this.user_data.id});return a},get_city:function(){var a=new Element("p",{"class":"avatar_user_city",html:nk.misc.print_with_wbr(this.user_data.city,12)});return a},get_bar:function(){var a=new Element("div",{"class":"avatar_bar"});a.grab(this.get_mail_button());a.grab(this.get_friends_button());a.grab(this.get_options_button());a.grab(this.get_options_window());return a},get_name_day_button:function(){var a=new Element("div",{"class":"avatar_name_day"});var b=new Element("a",{title:"Podaruj prezent",href:"/gifts/send/"+this.user_data.id});b.grab(new Element("span",{"class":"hidden",html:"Podaruj prezent"}));a.grab(b);return a},get_mail_button:function(){var a=new Element("a",{"class":"avatar_mail",title:"Wyślij wiadomość",href:"/poczta/compose/"+this.user_data.id});a.grab(new Element("img",{alt:"Napisz wiadomość",src:getStaticUri("/img/avatar/avatar_mail")}));return a},get_friends_button:function(){var a=(parseInt(this.user_data.friends_count)>this.avatar_class.max_friends_count)?this.avatar_class.max_friends_count+"+":parseInt(this.user_data.friends_count);var b=new Element("a",{"class":"avatar_friends",href:"/friends/"+this.user_data.id,title:"Pokaż listę znajomych"});b.grab(new Element("img",{src:getStaticUri("/img/icon/ico_friends")}));b.grab(new Element("span",{html:a}));return b},get_options_button:function(){var b=this;var a=new Element("div",{"class":"avatar_arrow"+(this.options.length==0?" disabled":"")});if(this.options.length){a.addEvent("click",function(c){b.avatar_class.toggle_options(this)});a.addEvent("click",function(c){b.avatar_class.stop_propagation(c)})}a.grab(new Element("img",{src:getStaticUri("/img/avatar/avatar_arrow"),alt:"Rozwiń"}));return a},get_options_window:function(){var c=this;var b=new Element("div",{"class":"avatar_options"});var a=new Element("span",{html:"&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;","class":"avatar_close_arrow"});b.grab(a);a.addEvent("click",function(d){c.avatar_class.hide_all_options()});b.grab(this.get_options_list());b.setStyle("display","none");b.addEvent("click",function(d){c.avatar_class.stop_propagation(d)});return b},get_options_list:function(){var a=new Element("ul",{"class":"avatar_options_list"});$each(this.options,function(b){a.grab(b.get_content())});return a}});var HighlightFilter=new Class({get_html_name:function(a,b){return misc_highlight_filter_wbr(a,b,13)}});
