if(!window.famebloggers){window.famebloggers={}}if(!window.famebloggers.rss){window.famebloggers.rss={}}function _fa_dynamic_rss(){this.base_url="http://back.famebloggers.com/bubbleroom/service/rss/feed";this.current_item=0;this.data=null;this.feeds=null;this.last_tick=0;this.options={cycle_time:5000,description_length:100,effect:"slide",element_id:null,limit:8,link_target:"_blank",layout:"title, time",style:"plain",time_format:"hour",title:true,transition_time:2};this.pause=false;this.timer=null;if(typeof _fameads_dynamic_rss_options!="undefined"){if(typeof _fameads_dynamic_rss_options.feeds!="undefined"){this.feeds=_fameads_dynamic_rss_options.feeds}if(typeof _fameads_dynamic_rss_options.options!="undefined"){for(var b in this.options){if(typeof _fameads_dynamic_rss_options.options[b]!="undefined"){this.options[b]=_fameads_dynamic_rss_options.options[b]}}}}if(this.feeds){for(var a=0;a<this.feeds.length;a++){this.request(this.feeds[a].url);break}}}_fa_dynamic_rss.prototype.advance=function(d,c){var e=document.getElementById("fa_dynamic_rss-item_"+this.current_item);var b=this.current_item+c;if(b<0){if(this.data.items.length>=this.options.limit){b=this.options.limit-1}else{b=this.data.items.length-1}}else{if(b>=this.data.items.length||b>=this.options.limit){b=0}}var a=document.getElementById("fa_dynamic_rss-item_"+b);if(d){this.last_tick=this.ticks()}if(this.options.effect=="slide"&&!this.slide(e,a,c)){return true}this.current_item=b;e.style.display="none";a.style.display="";a.style.left=e.style.left="0px";this.update_paging();this.start_cycle(false);return false};_fa_dynamic_rss.prototype.bind=function(c){var a=this;var b=[].slice.call(arguments,1);return function(){var d=b.concat([].slice.call(arguments));return c.apply(a,d)}};_fa_dynamic_rss.prototype.clear=function(a){if(a===null){return}var b;while((b=a.firstChild)){a.removeChild(b)}};_fa_dynamic_rss.prototype.create_image_link=function(e,g,f,h,a){var d=document.createElement("div");if(e){d.className=e}var c=document.createElement("a");c.href=a;c.target=f;var b=document.createElement("img");b.className="fa_dynamic_rss-image";b.alt=escape(h);b.src=g;c.appendChild(b);d.appendChild(c);return d};_fa_dynamic_rss.prototype.create_item=function(g,h,e){var f=document.createElement("div");f.className="fa_dynamic_rss-item "+g;f.id="fa_dynamic_rss-item_"+h;var b=this.options.layout.split(", ");for(i=0;i<b.length;i++){if(b[i]=="description"){var d=this.strip_tags(e.description);if(d.length>this.options.description_length){d=d.substr(0,this.options.description_length)+" ..."}f.appendChild(this.create_text_link("fa_dynamic_rss-description",this.options.link_target,this.expand(d),e.link))}else{if(b[i]=="image"){var a=/<img[^>]+src=\s*(?:"|)([^"\s>]+)[^>]*>/.exec(e.description);if(a&&typeof a[1]!="undefined"){f.appendChild(this.create_image_link("fa_dynamic_rss-image-link",a[1],this.options.link_target,e.title,e.link))}}else{if(b[i]=="time"){f.appendChild(this.create_time(e.date))}else{if(b[i]=="title"){f.appendChild(this.create_text_link("fa_dynamic_rss-link",this.options.link_target,e.title,e.link))}}}}}var c=document.createElement("div");c.className="fa_dynamic_rss-clear";f.appendChild(c);return f};_fa_dynamic_rss.prototype.create_text_link=function(d,e,f,a){var c=document.createElement("div");if(d){c.className=d}var b=document.createElement("a");b.href=a;b.target=e;b.appendChild(document.createTextNode(f));c.appendChild(b);return c};_fa_dynamic_rss.prototype.create_paging=function(){var d,c;var a=this;d=document.createElement("div");d.className="fa_dynamic_rss-paging";c=document.createElement("a");c.href="#";c.onclick=function(){a.advance(true,-1);return false};c.appendChild(document.createTextNode(this.expand("&#171;")));d.appendChild(c);c=document.createElement("span");c.id="fa_dynamic_rss-paging_count";var b=this.data.items.length;if(this.data.items.length>this.options.limit){b=this.options.limit}c.appendChild(document.createTextNode(" "+(this.current_item+1)+" / "+b+" "));d.appendChild(c);c=document.createElement("a");c.href="#";c.onclick=function(){a.advance(true,1);return false};c.appendChild(document.createTextNode(this.expand("&#187;")));d.appendChild(c);return d};_fa_dynamic_rss.prototype.create_time=function(b){if(this.options.time_format=="hour"){b=b.substring(11,16)}var a=document.createElement("div");a.className="fa_dynamic_rss-time";a.appendChild(document.createTextNode(b));return a};_fa_dynamic_rss.prototype.expand=function(c){var b=null;var a="";if(document.createElement){b=document.createElement("div");if(typeof b.innerHTML!="undefined"&&typeof b.firstChild!="undefined"){a=c.replace(/&[a-z0-9#]+;/gi,function(d){return b.innerHTML=d,b.firstChild.nodeValue})}}return a};_fa_dynamic_rss.prototype.pause_cycle=function(){if(this.timer){clearTimeout(this.timer)}this.pause=true;return true};_fa_dynamic_rss.prototype.request=function(c){var d=Math.floor(Math.random()*99999999999);var f="update_"+d;var e="famebloggers.rss."+f+","+d;famebloggers.rss[f]=this.bind(this.update);var b=document.createElement("script");b.async=true;b.src=this.base_url+"?format=jsonp,"+e+"&url="+encodeURIComponent(c);b.type="text/javascript";var a=document.getElementsByTagName("body").item(0).childNodes.item(0);if(!a){return false}a.parentNode.insertBefore(b,a);return true};_fa_dynamic_rss.prototype.slide=function(g,e,f){var a=0;var c=this.ticks();var d=c-this.last_tick;this.last_tick=c;var h=(d/this.options.transition_time);if(f<0){a=Math.round(parseInt(g.style.left)+h,10);g.style.left=a+"px";e.style.left=-(g.offsetWidth-a)+"px";if(a>=g.offsetWidth){return true}}else{a=Math.round(parseInt(g.style.left)-h,10);g.style.left=a+"px";e.style.left=(g.offsetWidth+a)+"px";if(a<=-g.offsetWidth){return true}}e.style.display="";var b=this;setTimeout(function(){b.advance(false,f)},this.options.transition_time);return false};_fa_dynamic_rss.prototype.start_cycle=function(b){if(b){this.pause=false}if(this.timer){clearTimeout(this.timer)}if(!this.options.cycle_time||this.pause){return true}var a=this;this.timer=setTimeout(function(){a.advance(true,1)},this.options.cycle_time);return true};_fa_dynamic_rss.prototype.strip_tags=function(b){if(!b){return""}var a=/<\S[^><]*>/g;return b.replace(a,"")};_fa_dynamic_rss.prototype.ticks=function(){var a=new Date();return a.getTime()};_fa_dynamic_rss.prototype.update=function(a,d){if(!d.items.length){return false}var e=null,b="",k;var h,g,f;var j=this;this.data=d;h=document.createElement("div");h.className="fa_dynamic_rss";if(this.options.style=="single"){h.onmouseover=function(){j.pause_cycle()};h.onmouseout=function(){j.start_cycle(true)}}g=document.createElement("div");g.className="fa_dynamic_rss-items";for(var c=0;c<this.data.items.length;c++){if(this.options.limit&&c>=this.options.limit){break}k=this.data.items[c];if(this.options.style=="single"){f=this.create_item(b,c,k);if(f){if(c){f.style.display="none"}else{this.current_item=c}f.style.left="0px";f.style.position="absolute";f.style.top="0px";g.appendChild(f)}}else{if(c%2){b="fa_dynamic_rss-even"}else{b="fa_dynamic_rss-odd"}g.appendChild(this.create_item(b,c,k))}}e=document.getElementById(this.options.element_id);if(e){this.clear(e);if(this.options.title){h.appendChild(this.create_text_link("fa_dynamic_rss-title",this.options.link_target,this.data.title,this.data.link))}if(this.options.style=="single"){h.appendChild(this.create_paging())}h.appendChild(g);e.appendChild(h);if(this.options.style=="single"){this.start_cycle(true)}}return true};_fa_dynamic_rss.prototype.update_paging=function(){var a=document.getElementById("fa_dynamic_rss-paging_count");if(a){var b=this.data.items.length;if(this.data.items.length>this.options.limit){b=this.options.limit}a.innerHTML=" "+(this.current_item+1)+" / "+b+" "}return true};new _fa_dynamic_rss();
