/* Copyright © 2009 Johan Kiviniemi
 *
 * Permission to use, copy, modify, and/or distribute this software for any
 * purpose with or without fee is hereby granted, provided that the above
 * copyright notice and this permission notice appear in all copies.
 */
(function(d){var i=document,g=undefined;function h(){return d("meta[name=title]").attr("content")||d("title").text()}function j(){return d("meta[name=description]").attr("content")}function a(){return d("link[rel=self]").attr("href")}function c(m,n,k){for(var l in n){if(n.hasOwnProperty(l)){if(typeof k[l]==="string"){window[m+l]=k[l]}}}}function e(k,l){return d.ajax({url:k,success:l,dataType:"script",cache:true})}function b(){this.running=false;this.queue=[]}b.prototype.push=function(k,l){this.queue.push([k,l]);if(!this.running){this.pop()}};b.prototype.pop=function(){this.running=true;var m=this.queue.shift();if(!m){this.running=false;i.write=i.writeln=function(){};return}var l=m[0],n=m[1];i.write=function(o){d("<div/>").html(o).children().appendTo(l)};i.writeln=function(o){i.write(o+"\n")};var k=this;e(n,function(){k.pop()})};var f=new b();d.fn.loadDigg=function(k){var l={url:a(),title:h(),bodytext:j(),media:g,topic:g,skin:g,bgcolor:g,window:g};c("digg_",l,d.extend({},l,k));this.eq(0).each(function(){d(this).empty();f.push(this,"http://digg.com/tools/diggthis.js")});return this};d.fn.loadDisqus=function(k,l){var m={url:a(),title:h(),message:g};c("disqus_",m,d.extend({},m,l));this.eq(0).each(function(){d(this).empty().append('<div id="disqus_thread"/>');f.push(this,"http://disqus.com/forums/"+k+"/embed.js")});return this};d.fn.loadDelicious=function(k){var l={"class":g};k=d.extend({},l,k);if(typeof window.Delicious==="undefined"){window.Delicious={}}if(typeof k["class"]==="string"){window.Delicious.BLOGBADGE_DEFAULT_CLASS=k["class"]}this.eq(0).each(function(){d(this).empty();f.push(this,"http://static.delicious.com/js/blogbadge.js")});return this};d.loadGoogleAnalytics=function(l){var k;if(i.location.protocol==="https:"){k="https://ssl."}else{k="http://www."}k+="google-analytics.com/ga.js";e(k,function(){try{_gat._getTracker(l)._trackPageview()}catch(m){}});return d}})(jQuery);