if(typeof NkWidgetSledzikShoutRenderer=="undefined"){NkWidgetCore.init();var NkWidgetSledzikShoutRenderer=new NkWidgetClass({render:function(e){var d;var c=/\b((https?\:\/\/|www\.)[\w-.śćńółęąźż]{2,}\.[a-z]{2,5}((\/|#|\?)[\w-.?&%#=,+~;$\/śćńółęąźż():]*)?)/gi;var f=e.content.match(c);if(f){var b=e.content.replace(/(\[|\])/g,"\\$1");for(var a=0;a<f.length;a++){b=b.replace(f[a],"["+a+"]")}b=NkWidgetCore.Misc.wbr(b,15,5);for(var a=0;a<f.length;a++){b=b.replace("["+a+"]",'<a target="_blank" href="'+(f[a].indexOf("http://")>-1?f[a]:"http://"+f[a])+'">'+NkWidgetCore.Misc.wbr(f[a],15,5)+"</a>")}b=b.replace(/\\(\[|\])/g,"$1")}else{var b=NkWidgetCore.Misc.wbr(e.content,15,5)}d=NkWidgetCore.DOM.create("li",{"class":"nk_widget_shout"});d.content=NkWidgetCore.DOM.create("p",{"class":"nk_widget_shout_content",html:b});d.datetime=NkWidgetCore.DOM.create("span",{"class":"nk_widget_entry_date",text:e.datetime});return NkWidgetCore.DOM.adopt(d,[d.content,d.datetime])}});var NkWidgetSledzikAbstract=new NkWidgetClass({box:null,list:[],options:{id:"",user:{uid:null,name:"",avatar_uri:null},theme:{widget_border_color:"#aabece",widget_background_color:"#ffffff",header_text_color:"#ffffff",header_background_color:"#2b608c",stripe_background_color:"#a1d262",shout_text_color:"#475058",shout_date_color:"#9aa7b2",shout_link_color:"#2b74b0",shout_border_color:"#e1e7ed"},css:"style/nk_widgets",count:10,width:250,height:390,timeout:10000},error_message:"",empty_list_message:"Lista pusta",initialize:function(a){this.set_options(a)},init:function(){this.create();this.update();this.download();return this},create:function(){if(this.options.user.uid===null){return}if(typeof this.options.id=="string"){var a=this.get_container_id();document.write('<div id="'+a+'" class="nk_widget" ></div>');this.box=NkWidgetCore.DOM.get_by_id(a)}else{this.box=this.options.id}if(!NkWidgetCore.DOM.get_by_id("nk_widget_styles")){NkWidgetCore.DOM.grab(NkWidgetCore.DOM.get_by_name(document,"head")[0],NkWidgetCore.DOM.create("link",{id:"nk_widget_styles",rel:"stylesheet",type:"text/css",href:NkWidgetCore.Misc.get_static_uri(this.options.css)}))}this.box.header=NkWidgetCore.DOM.create("div",{"class":"nk_widget_header"});this.box.header.top=NkWidgetCore.DOM.create("div",{"class":"nk_widget_header_top"});this.box.header.top.logo=NkWidgetCore.DOM.create("a",{href:NkWidgetCore.NK.host,title:"nk.pl","class":"nk_widget_logo",target:"_blank",html:'<img class="nk_widget_img" alt="nk.pl" src="'+NkWidgetCore.Misc.get_static_uri("img/nk_widgets/widget/nk_widget_logo"+(NkWidgetCore.Browser.ie6?"_ie6":""))+'">'});this.box.header.top.user_name=NkWidgetCore.DOM.create("a",{href:NkWidgetCore.NK.host+"profile/"+this.options.user.uid,"class":"nk_widget_usr_name",target:"_blank"});this.box.header.top.avatar=NkWidgetCore.DOM.create("a",{href:NkWidgetCore.NK.host+"profile/"+this.options.user.uid,"class":"nk_widget_avatar",target:"_blank"});this.box.header.top.avatar.official=NkWidgetCore.DOM.create("span",{"class":"nk_widget_avatar_standard",html:'<img class="nk_widget_img" alt="Konto oficialne" src="'+NkWidgetCore.Misc.get_static_uri("img/nk_widgets/widget/avatar_official"+(NkWidgetCore.Browser.ie6?"_ie6":""))+'">'});this.box.header.top.avatar.user_name=NkWidgetCore.DOM.create("span",{"class":"nk_widget_avatar_name"});this.box.header.stripe=NkWidgetCore.DOM.create("div",{html:"<!-- -->","class":"nk_widget_header_stripe"});this.box.footer=NkWidgetCore.DOM.create("div",{"class":"nk_widget_footer"});this.box.footer.followee=NkWidgetCore.DOM.create("a",{target:"_blank","class":"nk_widget_btn_follow",href:NkWidgetCore.NK.host+["profile",this.options.user.uid,"follow"].join("/"),html:'<img class="nk_widget_img" alt="Śledź" src="'+NkWidgetCore.Misc.get_static_uri("img/nk_widgets/widget/btn_follow")+'">',title:"Śledź"});this.box.container=NkWidgetCore.DOM.create("div",{"class":"nk_widget_content"});this.box.container.list=NkWidgetCore.DOM.create("ul",{"class":"nk_widget_list"});NkWidgetCore.DOM.grab(this.box.footer,this.box.footer.followee);NkWidgetCore.DOM.grab(this.box.container,this.box.container.list);NkWidgetCore.DOM.adopt(this.box,[this.box.header,this.box.container,this.box.footer]);NkWidgetCore.DOM.adopt(this.box.header,[this.box.header.top,this.box.header.stripe]);NkWidgetCore.DOM.adopt(this.box.header.top.avatar,[this.box.header.top.avatar.user_name,this.box.header.top.avatar.official]);NkWidgetCore.DOM.adopt(this.box.header.top,[this.box.header.top.logo,this.box.header.top.avatar,this.box.header.top.user_name])},get_container_id:function(){return this.options.id},update:function(b){this.set_options(b);this.update_dimension();NkWidgetCore.DOM.set_styles(this.box,{"border-color":this.options.theme.widget_border_color,"background-color":this.options.theme.widget_background_color});NkWidgetCore.DOM.set_styles(this.box.header.top,{"background-color":this.options.theme.header_background_color});NkWidgetCore.DOM.set_styles(this.box.header.top.user_name,{color:this.options.theme.header_text_color});NkWidgetCore.DOM.set_styles(this.box.header.stripe,{"background-color":this.options.theme.stripe_background_color});NkWidgetCore.DOM.set_styles(this.box.container.list,{color:this.options.theme.shout_text_color,"background-color":this.options.theme.shout_backgorund_color});NkWidgetCore.DOM.set(this.box.header.top.user_name,{text:this.options.user.name});NkWidgetCore.DOM.set(this.box.header.top.avatar.user_name,{html:NkWidgetCore.Misc.demo(this.options.user.name,30)});NkWidgetCore.DOM.set(this.box.header.top.avatar,{title:this.options.user.name,styles:{background:"url("+this.options.user.avatar_uri+") no-repeat 50%"}});NkWidgetCore.DOM.set(this.box.header.top.avatar.official,{"class":this.options.user.is_official?"nk_widget_avatar_official":"nk_widget_avatar_standard"});for(var c=0,d=NkWidgetCore.DOM.get_by_name(this.box.container.list,"a"),a=d.length;c<a;c++){NkWidgetCore.DOM.set_styles(d[c],{color:this.options.theme.shout_link_color})}},update_dimension:function(){var a=this.get_size_range();this.options.width=Math.min(Math.max(this.options.width,a.xmin),a.xmax);this.options.height=Math.min(Math.max(this.options.height,a.ymin),a.ymax);NkWidgetCore.DOM.set_styles(this.box,{width:(this.options.width-2)+"px",height:this.options.height+"px"});NkWidgetCore.DOM.set_styles(this.box.container.list,{width:(this.options.width-13)+"px",height:(this.options.height-100)+"px"})},update_theme_color:function(b,a){this.options.theme[b]=a;this.update()},get_size_range:function(){return{xmin:168,xmax:766,ymin:150,ymax:400}},redraw:function(){NkWidgetCore.DOM.empty(this.box.container.list);if(this.list.length){for(var b=0,a=this.list.length;b<a;b++){NkWidgetCore.DOM.grab(this.box.container.list,this.renderer.render(this.list[b]))}}else{NkWidgetCore.DOM.grab(this.box.container.list,NkWidgetCore.DOM.create("li",{"class":"nk_widget_connect_error",html:"<p>"+(this.error_message||this.empty_list_message)+"</p>"}))}},download:function(a){if(typeof a=="undefined"){return false}new NkWidgetCore.Request.JSONP({url:a,timeout:this.options.timeout,onRequest:NkWidgetCore.Misc.bind(this,this.on_request),onSuccess:NkWidgetCore.Misc.bind(this,this.on_success),onTimeout:NkWidgetCore.Misc.bind(this,this.on_timeout)}).send()},on_request:function(){NkWidgetCore.DOM.add_class(this.box,"nk_widget_loading")},on_success:function(a){NkWidgetCore.DOM.remove_class(this.box,"nk_widget_loading");if(a.STATUS=="OK"){this.list=a.RESPONSE.list;this.redraw();this.update({user:a.RESPONSE.user})}else{this.list=[];this.error_message=a.RESPONSE.MSG;this.on_error(this.error_message)}},on_error:function(a){this.update({user:{name:"Błąd połączenia",avatar_uri:NkWidgetCore.Misc.get_static_uri("img/avatar/avatar_blocked_user_small")}});NkWidgetCore.DOM.set(this.box.container.list,{html:""});NkWidgetCore.DOM.grab(this.box.container.list,NkWidgetCore.DOM.create("li",{"class":"nk_widget_connect_error",html:"<p>"+a+"</p>"}))},on_timeout:function(){NkWidgetCore.DOM.add_class(this.box,"nk_widget_error");NkWidgetCore.DOM.remove_class(this.box,"nk_widget_loading");this.on_error("Błąd połączenia z serwerem")}});var NkWidgetSledzikShoutList=new NkWidgetClass({Extends:NkWidgetSledzikAbstract,name:"NkWidgetSledzikShoutList",renderer:null,empty_list_message:"Brak wpisów",options:{id:"nk_widget_sledzik_shout_list"},initialize:function(a){this.parent(a);this.renderer=new NkWidgetSledzikShoutRenderer()},get_container_id:function(){return this.options.id+"_"+NkWidgetSledzikShoutList.index++},update:function(b){this.parent(b);if(!this.list.length){return}for(var c=0,d=this.box.container.list.childNodes,a=d.length;c<a;c++){NkWidgetCore.DOM.set_styles(d[c].content,{color:this.options.theme.shout_text_color});NkWidgetCore.DOM.set_styles(d[c].datetime,{color:this.options.theme.shout_date_color});NkWidgetCore.DOM.set_styles(d[c],{"border-color":this.options.theme.shout_border_color})}},download:function(){this.parent(NkWidgetCore.NK.host+"sledzik/jsonp/shouts/"+[this.options.user.uid,0,this.options.count].join("/")+"?ref="+window.location.hostname)}});NkWidgetSledzikShoutList.index=0};