$(document).ready(function(){function a(k){if(k!=null){if(k.substring(k.length-1)=="%"){return k.substring(0,k.length-1)}else{if(k.substr(k.length-2,2).toLowerCase()=="px"){return k.substring(0,k.length-2)}else{return k}}}return k}function j(m,k){var l=new XMLHttpRequest();if("withCredentials" in l){l.open(m,k,true)}else{if(typeof XDomainRequest!="undefined"){l=new XDomainRequest();l.open(m,k)}else{l=null}}return l}function h(m){var n=$('<div id="sidebarimport" />');n.html(m);$("#ul-primary").prepend(n.children("#primary").html());var k=n.children("#secondary").children("li");var l=1;while(l<k.length){$("#ul-secondary").append(k[l]);l++}}function e(){var k=j("GET","http://frederator.com/wp-content/themes/frederator/js/sidebar-all.php");if(k){k.onload=function(){h(k.responseText)};k.send()}}function f(){jQuery.ajax({url:"http://frederator.com/wp-content/themes/frederator/js/sidebar-all.php",cache:false,complete:function(k){h(k.responseText)}})}if($.browser.msie){e()}else{f()}$(".entry img").lazyload({threshold:200,placeholder:"http://frederator.com/wp-content/themes/frederator/images/gray.png",effect:"fadeIn"});$(document).pngFix();window.viewport={height:function(){return $(window).height()},width:function(){return $(window).width()},scrollTop:function(){return $(window).scrollTop()},scrollLeft:function(){return $(window).scrollLeft()}};$(".text .entry img").hide();$(".firstphoto img").hide();$(".photo .entry img").hide();function b(l,k){jQuery.ajax({url:"http://frederator.com/wp-content/themes/frederator/js/imagecheck.php?url="+l,complete:function(m){if(m.responseText=="true"){k.fancybox({type:"image"})}}})}var g=1;$(".text .entry img").load(function(){var o=599;var m=0;$(this).css("width","auto");$(this).css("height","auto");var l=$(this).width();var n=$(this)[0].getAttribute("width");if(n!=null){if(n.substring(n.length-1)=="%"){n=o*parseFloat(n.substring(0,n.length-1))/100}}else{n=l}var k=$(this).height();if(n>o){m=o/l;$(this).css("width",o);if($(this).parents("a").length<=0){$(this).wrap(function(){var p=$("<a/>");p.attr("id","photoshellLink"+g);g+=1;p.attr("href",$(this).attr("original"));p.text($(this).text());p.fancybox({type:"image"});return p})}}else{m=n/l;$(this).css("width",n)}k=Math.ceil(k*m);$(this).css("height",k);$(this).fadeIn("slow")}).each(function(){if(this.complete){$(this).trigger("load")}});$(".firstphoto img").load(function(){var o=599;var n=0;$(this).css("width","auto");$(this).css("height","auto");var m=$(this).width();var k=$(this).height();n=o/m;k=Math.ceil(k*n);m=Math.ceil(m*n);$(this).css("width",m);$(this).css("height",k);if($(this).parents("a").length<=0){$(this).wrap(function(){var p=$("<a/>");p.attr("id","photoshellLink"+g);g+=1;p.attr("href",$(this).attr("original"));p.text($(this).text());p.fancybox({type:"image"});return p})}else{var l=$(this).parents("a").attr("href");b(l,$(this).parents("a"))}$(this).fadeIn("slow")}).each(function(){if(this.complete){$(this).trigger("load")}});$(".photo .entry img").load(function(){if($(this).parents(".firstphoto").length>0){return}var o=599;var m=0;$(this).css("width","auto");$(this).css("height","auto");var l=$(this).width();var n=$(this)[0].getAttribute("width");if(n!=null){if(n.substring(n.length-1)=="%"){n=o*parseFloat(n.substring(0,n.length-1))/100}}else{n=l}var k=$(this).height();if(n>o){m=o/l;$(this).css("width",o);if($(this).parents("a").length<=0){$(this).wrap(function(){var p=$("<a/>");p.attr("id","photoshellLink"+g);g+=1;p.attr("href",$(this).attr("original"));p.text($(this).text());p.fancybox();return p})}}else{m=n/l;$(this).css("width",n)}k=Math.ceil(k*m);$(this).css("height",k);$(this).fadeIn("slow")}).each(function(){if(this.complete){$(this).trigger("load")}});$(".html_photoset").each(function(){if($(this).children("iframe").size()<=0){return}$(this).css("width","auto");$(this).css("height","auto");var m=$(this).children("iframe");var l=a(m.attr("width"));var k=a(m.attr("height"));m=null;$(this).css("width",l);$(this).css("height",k)});$(".firstvideo").each(function(){var l=false;if($(this).children("object").size()>0){var o=$(this).children("object");var n=a($(this).children("object").attr("width"));var k=a($(this).children("object").attr("height"));l=true}else{if($(this).children("iframe").size()>0){var o=$(this).children("iframe");var n=a($(this).children("iframe").attr("width"));var k=a($(this).children("iframe").attr("height"));l=true}else{return}}if(l){var p=599;var m=0;m=p/n;k=Math.ceil(k*m);n=Math.ceil(n*m);o.attr("width",n);o.attr("height",k);o.children("embed").attr("width",n);o.children("embed").attr("height",k)}$(this).css("width",n);$(this).css("height",k)});$("#secondary img").each(function(){var n=180;var m=0;$(this).css("width","auto");$(this).css("height","auto");var l=$(this).width();var k=$(this).height();if(l>n){m=n/l;k=Math.ceil(k*m);l=Math.ceil(l*m);$(this).css("width",l);$(this).css("height",k)}});function i(m){var l=document.createElement("div");l.innerHTML=m;var k=l.textContent||l.innerText;delete l;return k}function d(k){return k.replace(/<\/?[^>]+>/gi,"")}function c(k,o,l){if(!k){var n=$(l).parents("h1").children("p").html();if(n){$(l).parents("h1").children("p").remove();k=n}else{return o}}o=i(d(k));var m=o.split(" ",8);var q=m.join(" ");if(m.length>=8){q+="..."}return q}$("a.tumblr-title").each(function(){$(this).html(c($(this).html(),$(this).attr("title"),this))});$(".photo .socialmedia").each(function(){var k=i(d($(this).parents(".post").children(".entry-title").html()));$(this).children(".st_twitter_hcount").attr("st_title",k);$(this).children(".st_facebook_hcount").attr("st_title",k);$(this).children(".st_email").attr("st_title",k);$(this).children(".st_sharethis").attr("st_title",k)});$(".video .socialmedia").each(function(){var k=i(d($(this).parents(".post").children(".entry-title").html()));$(this).children(".st_twitter_hcount").attr("st_title",k);$(this).children(".st_facebook_hcount").attr("st_title",k);$(this).children(".st_email").attr("st_title",k);$(this).children(".st_sharethis").attr("st_title",k)});$(window).scroll(function(){var k=$(window).scrollTop();if(k>200){$("#backtotop").fadeIn("slow")}if(k<200){$("#backtotop").fadeOut("slow")}});$("#backtotop").hover(function(){$(this).addClass("hover")},function(){$(this).removeClass("hover")});$("#backtotop").click(function(){$.scrollTo(0,{duration:700,axis:"y"})});$("#rclist").change(function(){if($(this).val()){window.open("http://archives.frederatorblogs.com/"+$(this).val(),"_blank")}})});
