(function(b){function c(g,f,o){var m=o.relative?g.position().top:g.offset().top,n=o.relative?g.position().left:g.offset().left,l=o.position[0];m-=f.outerHeight()-o.offset[0];n+=g.outerWidth()+o.offset[1];var k=f.outerHeight()+g.outerHeight();if(l=="center"){m+=k/2}if(l=="bottom"){m+=k}l=o.position[1];g=f.outerWidth()+g.outerWidth();if(l=="center"){n-=g/2}if(l=="left"){n-=g}return{top:m,left:n}}function a(A,z){var y=this,w=A.add(y),x,v=0,t=0,n=A.attr("title"),g=d[z.effect],p,f=A.is(":input"),B=f&&A.is(":checkbox, :radio, select, :button, :submit"),C=A.attr("type"),o=z.events[C]||z.events[f?B?"widget":"input":"def"];if(!g){throw'Nonexistent effect "'+z.effect+'"'}o=o.split(/,\s*/);if(o.length!=2){throw"Tooltip: bad events configuration for "+C}A.bind(o[0],function(e){clearTimeout(v);if(z.predelay){t=setTimeout(function(){y.show(e)},z.predelay)}else{y.show(e)}}).bind(o[1],function(e){clearTimeout(t);if(z.delay){v=setTimeout(function(){y.hide(e)},z.delay)}else{y.hide(e)}});if(n&&z.cancelDefault){A.removeAttr("title");A.data("title",n)}b.extend(y,{show:function(h){if(!x){if(n){x=b(z.layout).addClass(z.tipClass).appendTo(document.body).hide().append(n)}else{if(z.tip){x=b(z.tip).eq(0)}else{x=A.next();x.length||(x=A.parent().next())}}if(!x.length){throw"Cannot find tooltip for "+A}}if(y.isShown()){return y}x.stop(true,true);var e=c(A,x,z);h=h||b.Event();h.type="onBeforeShow";w.trigger(h,[e]);if(h.isDefaultPrevented()){return y}e=c(A,x,z);x.css({position:"absolute",top:e.top,left:e.left});p=true;g[0].call(y,function(){h.type="onShow";p="full";w.trigger(h)});e=z.events.tooltip.split(/,\s*/);x.bind(e[0],function(){clearTimeout(v);clearTimeout(t)});e[1]&&!A.is("input:not(:checkbox, :radio), textarea")&&x.bind(e[1],function(j){j.relatedTarget!=A[0]&&A.trigger(o[1].split(" ")[0])});return y},hide:function(e){if(!x||!y.isShown()){return y}e=e||b.Event();e.type="onBeforeHide";w.trigger(e);if(!e.isDefaultPrevented()){p=false;d[z.effect][1].call(y,function(){e.type="onHide";p=false;w.trigger(e)});return y}},isShown:function(e){return e?p=="full":p},getConf:function(){return z},getTip:function(){return x},getTrigger:function(){return A}});b.each("onHide,onBeforeShow,onShow,onBeforeHide".split(","),function(h,e){b.isFunction(z[e])&&b(y).bind(e,z[e]);y[e]=function(j){b(y).bind(e,j);return y}})}b.tools=b.tools||{version:"1.2.3"};b.tools.tooltip={conf:{effect:"toggle",fadeOutSpeed:"fast",predelay:0,delay:30,opacity:1,tip:0,position:["top","center"],offset:[0,0],relative:false,cancelDefault:true,events:{def:"mouseenter,mouseleave",input:"focus,blur",widget:"focus mouseenter,blur mouseleave",tooltip:"mouseenter,mouseleave"},layout:"<div/>",tipClass:"tooltip"},addEffect:function(f,e,g){d[f]=[e,g]}};var d={toggle:[function(f){var e=this.getConf(),g=this.getTip();e=e.opacity;e<1&&g.css({opacity:e});g.show();f.call()},function(e){this.getTip().hide();e.call()}],fade:[function(f){var e=this.getConf();this.getTip().fadeTo(e.fadeInSpeed,e.opacity,f)},function(e){this.getTip().fadeOut(this.getConf().fadeOutSpeed,e)}]};b.fn.tooltip=function(f){var e=this.data("tooltip");if(e){return e}f=b.extend(true,{},b.tools.tooltip.conf,f);if(typeof f.position=="string"){f.position=f.position.split(/,?\s/)}this.each(function(){e=new a(b(this),f);b(this).data("tooltip",e)});return f.api?e:this}})(jQuery);(function(c){var a=c.tools.tooltip;c.extend(a.conf,{direction:"up",bounce:false,slideOffset:10,slideInSpeed:200,slideOutSpeed:200,slideFade:!c.browser.msie});var b={up:["-","top"],down:["+","top"],left:["-","left"],right:["+","left"]};a.addEffect("slide",function(h){var e=this.getConf(),j=this.getTip(),d=e.slideFade?{opacity:e.opacity}:{},k=b[e.direction]||b.up;d[k[1]]=k[0]+"="+e.slideOffset;e.slideFade&&j.css({opacity:0});j.show().animate(d,e.slideInSpeed,h)},function(k){var e=this.getConf(),l=e.slideOffset,d=e.slideFade?{opacity:0}:{},m=b[e.direction]||b.up,j=""+m[0];if(e.bounce){j=j=="+"?"-":"+"}d[m[1]]=j+"="+l;this.getTip().animate(d,e.slideOutSpeed,function(){c(this).hide();k.call()})})})(jQuery);(function(d){function b(e){var j=d(window),g=j.width()+j.scrollLeft(),f=j.height()+j.scrollTop();return[e.offset().top<=j.scrollTop(),g<=e.offset().left+e.width(),f<=e.offset().top+e.height(),j.scrollLeft()>=e.offset().left]}function a(e){for(var f=e.length;f--;){if(e[f]){return false}}return true}var c=d.tools.tooltip;c.dynamic={conf:{classNames:"top right bottom left"}};d.fn.dynamic=function(e){if(typeof e=="number"){e={speed:e}}e=d.extend({},c.dynamic.conf,e);var g=e.classNames.split(/\s/),f;this.each(function(){var j=d(this).tooltip().onBeforeShow(function(l,k){l=this.getTip();var h=this.getConf();f||(f=[h.position[0],h.position[1],h.offset[0],h.offset[1],d.extend({},h)]);d.extend(h,f[4]);h.position=[f[0],f[1]];h.offset=[f[2],f[3]];l.css({visibility:"hidden",position:"absolute",top:k.top,left:k.left}).show();k=b(l);if(!a(k)){if(k[2]){d.extend(h,e.top);h.position[0]="top";l.addClass(g[0])}if(k[3]){d.extend(h,e.right);h.position[1]="right";l.addClass(g[1])}if(k[0]){d.extend(h,e.bottom);h.position[0]="bottom";l.addClass(g[2])}if(k[1]){d.extend(h,e.left);h.position[1]="left";l.addClass(g[3])}if(k[0]||k[2]){h.offset[0]*=-1}if(k[1]||k[3]){h.offset[1]*=-1}}l.css({visibility:"visible"}).hide()});j.onBeforeShow(function(){var h=this.getConf();this.getTip();setTimeout(function(){h.position=[f[0],f[1]];h.offset=[f[2],f[3]]},0)});j.onHide(function(){var h=this.getTip();h.removeClass(e.classNames)});ret=j});return e.api?ret:this}})(jQuery);var allImages=$(".pic");$(document).ready(function(){$.ajax({url:"./ajax/phptwidget/phptwidget.php",dataType:"html",cache:false,data:"",complete:function(a,b){$("#twitterstatus").fadeIn()},success:function(c){twitterStatus=$("#twitterstatus");twitterStatus.html(c);var b=twitterStatus.height();var a=42-b;if(a<0){a=0}twitterStatus.fadeIn();$("#twitter").fadeOut(function(){$(this).css("background","url(./img/profile_n.jpg)").fadeIn()})},error:function(c,b,a){$("#twitter").fadeOut(function(){$(this).css("background","url(./img/profile_n.jpg)").fadeIn()})}});$.ajax({url:"./ajax/phplatestsong/phplatestsong.php",dataType:"html",cache:false,data:"",complete:function(a,b){$("#lastfmtrack").fadeIn()},success:function(a){$("#lastfmtrack").fadeOut(function(){$(this).html(a)})},error:function(c,b,a){$("#lastfm").fadeOut(function(){$(this).css("background","url(./img/music.jpg)").fadeIn()})}});$(".tooltipped a").tooltip({effect:"slide",bounce:true});organizeImages()});var resizeTimer;$(window).resize(function(){organizeImages()});function organizeImages(){if(!$("#current.active").length){return}var a=calculateNumImages();allImages=$(".pic");for(i=a;i<allImages.length;i++){pic=$(".pic#"+i);if(pic.is(":visible")){pic.fadeOut()}else{break}}for(i=0;i<a;i++){pic=$(".pic#"+i);if(!pic.is(":visible")){if(!pic.attr("src")){pic.attr("src",pic.attr("t_src"))}pic.fadeIn()}}}function calculateNumImages(){body=$("body");pic=$(".pic");totalWidth=$("#right").width();totalHeight=(body.height()-parseInt($("#rightcontent").css("margin-top")));squareWidth=pic.outerWidth(true);squareHeight=pic.outerHeight(true);rightOfSquares=(Math.floor(totalWidth/squareWidth)-4)*3;belowSquaresRows=(Math.floor(totalHeight/squareHeight)-3);if(rightOfSquares<0){rightOfSquares=0}if(belowSquaresRows>0){belowSquares=belowSquaresRows*Math.floor(totalWidth/squareWidth)}else{belowSquares=0}if(rightOfSquares==0){belowSquares=belowSquaresRows*4}return rightOfSquares+belowSquares}$(function(){hashtag=window.location.hash.substr(1);if(hashtag!=""){if(hashtag=="about"){$.ajax({url:"./ajax/about.php",dataType:"html",cache:false,data:"",beforeSend:function(){$("#rightcontent").hide()},success:function(a){$("#rightcontent").fadeOut(function(){$("#top").fadeOut();$("#rightcontent").html(a);$("#top").html("");$("#top").fadeIn();$("#rightcontent").fadeIn()});$(".active").addClass("hoverable");$(".active").removeClass("active");$("#about").removeClass("hoverable");$("#about").addClass("active").css("background-position","109px -49px").animate({backgroundPosition:"125px -49px"});$("#container").css("height",$("#rightcontent").height())},error:function(c,b,a){$("#top").html("<br />Error loading page. Is there an internet connection?");$("#top").fadeIn();$("#rightcontent").fadeIn()}})}}$("#about").click(function(a){a.preventDefault();$.ajax({url:"./ajax/about.php",dataType:"html",cache:false,data:"",beforeSend:function(){$("#rightcontent").fadeOut()},success:function(b){$("#rightcontent").fadeOut(function(){$("#top").fadeOut();$("#rightcontent").html(b);$("#top").html("");$("#top").fadeIn();$("#container").css("height",$("#rightcontent").height());$("#rightcontent").fadeIn()});$(".active").addClass("hoverable");$(".active").removeClass("active").attr("style","");$("#about").removeClass("hoverable");$("#about").addClass("active").css("background-position","109px -49px").animate({backgroundPosition:"125px -49px"});window.location.hash="about"},error:function(d,c,b){$("#top").html("<br />Error loading page. Is there an internet connection?");$("#top").fadeIn();$("#rightcontent").fadeIn()}})});$("#current").click(function(a){if(page=="about"){return}a.preventDefault();$.ajax({url:"./ajax/current.php",dataType:"html",cache:false,data:"",beforeSend:function(){$("#rightcontent").fadeOut();$("#top").fadeOut()},success:function(b){$("#rightcontent").fadeOut(function(){$("#top").fadeOut();$("#rightcontent").html(b);$("#top").html("");$("#top").fadeIn();$("#rightcontent").fadeIn(function(){$(".tooltipped a").tooltip({effect:"slide",bounce:true})});$("#container").css("height","");organizeImages()});$(".active").addClass("hoverable");$(".active").removeClass("active").attr("style","");$("#current").removeClass("hoverable");$("#current").addClass("active").css("background-position","109px -49px").animate({backgroundPosition:"125px -49px"});window.location.hash=""},error:function(d,c,b){$("#top").html("<br />Error loading page. Is there an internet connection?");$("#top").fadeIn();$("#rightcontent").fadeIn()}})})});
