﻿/* Creative Commons Attribution-Share Alike 3.0 Netherlands License - http://creativecommons.org/licenses/by-sa/3.0/nl/
 @Visit http://pwi.googlecode.com/ for more informations, duscussions etc about this library */
function InitHoverEvent(){$(".app").hover(function(){var b=$(this);b.children(".sponsorFlip").children(".zoom").stop().animate({opacity:"1.0",height:"350px",width:"350px",top:"0px",left:"0px"});b.children(".dark-background").animate({opacity:"1.0"})},function(){var b=$(this);b.children(".sponsorFlip").children(".zoom").stop().animate({opacity:"1.0",height:"300px",width:"300px",top:"0px",left:"0px"});b.children(".dark-background").animate({opacity:"0"})});$(".util").hover(function(){var b=$(this);
b.children(".sponsorFlip").children(".zoom").stop().animate({opacity:"1.0",height:"350px",width:"350px",top:"0px",left:"0px"});b.children(".dark-background").animate({opacity:"1.0"})},function(){var b=$(this);b.children(".sponsorFlip").children(".zoom").stop().animate({opacity:"1.0",height:"300px",width:"300px",top:"0px",left:"0px"});b.children(".dark-background").animate({opacity:"0"})})}
function InitClickEvent(){$(".sponsorFlip").bind("click",function(){var b=$(this);b.data("flipped")?(b.revertFlip(),b.data("flipped",!1)):(b.flip({direction:"lr",speed:350,onBefore:function(){b.html(b.siblings(".sponsorData").html())}}),b.data("flipped",!0))})}$(function(){InitHoverEvent()});$(document).ready(function(){InitClickEvent()});
$(document).ready(function(){$("#container").pwi({username:"tkesterton",popupExt:function(b){b.fancybox({hideOnContentClick:!1,overlayColor:"#000",overlayOpacity:0.9,transitionIn:"elastic",transitionOut:"elastic"})}})});(function(b){b.fn.sorted=function(i){var e={reversed:!1,by:function(b){return b.text()}};b.extend(e,i);$data=b(this);arr=$data.get();arr.sort(function(j,d){var g=e.by(b(j)),c=e.by(b(d));return e.reversed?g<c?1:g>c?-1:0:g<c?-1:g>c?1:0});return b(arr)}})(jQuery);
$(function(){var b=function(c){for(var b={selected:!1,type:0},d=0;d<c.length;d++){if(c[d].indexOf("selected-")==0)b.selected=!0;if(c[d].indexOf("segment-")==0)b.segment=c[d].split("-")[1]}return b},i=function(b){return b.parent().filter('[class*="selected-"]').find("a").attr("data-value")},e=function(b){return b.parent().filter('[class*="selected-"]').find("a").attr("data-value")},j=$("#list"),d=j.clone(),g=$("ul.splitter ul");g.each(function(){var c=$(this).find("a");c.bind("click",function(f){var k=
$(this).parent(),l=b(k.attr("class").split(" ")),p=l.segment;l.selected||(c.parent().removeClass("selected-0").removeClass("selected-1").removeClass("selected-2"),k.addClass("selected-"+p),k=i(g.eq(1).find("a")),l=e(g.eq(0).find("a")),l=l=="all"?d.find("li"):d.find("li."+l),k=k=="size"?l.sorted({by:function(b){return parseFloat($(b).find("age").text())}}):l.sorted({by:function(b){return $(b).find("strong").text().toLowerCase()}}),j.quicksand(k,function(){InitHoverEvent();InitClickEvent()}));f.preventDefault()})})});
$(document).ready(function(){var b=1,i=function(){$.getJSON("http://twitter.com/status/user_timeline/kesterton_diary.json?count=15&page="+b+"&callback=?",function(e){$.each(e,function(b,d){var g=d.text,c=d.id;$("<p />").html(g).append($("<a />").attr("href","http://twitter.com/kesterton_diary/status/"+c).attr("title","Go to Twitter status").append($("<img />").attr("src","images/link.png"))).appendTo($("#tweets"))});$("#overlay").fadeOut();$("#pageCount").html(b);$("#tweetCount").html(b*15)})};i();
$("#tweets").scroll(function(){if($(this)[0].scrollHeight-$(this).scrollTop()==$(this).outerHeight()){b++;if(b>10)return alert("We should not spam the Twitter API with calls. I hope you get the idea!"),!1;$("#overlay").fadeIn();i()}})});
(function(b){function i(b){b.elem.style[b.prop]=parseInt(b.now,10)+b.unit}var e={aqua:[0,255,255],azure:[240,255,255],beige:[245,245,220],black:[0,0,0],blue:[0,0,255],brown:[165,42,42],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgrey:[169,169,169],darkgreen:[0,100,0],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkviolet:[148,0,211],fuchsia:[255,0,255],gold:[255,
215,0],green:[0,128,0],indigo:[75,0,130],khaki:[240,230,140],lightblue:[173,216,230],lightcyan:[224,255,255],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightyellow:[255,255,224],lime:[0,255,0],magenta:[255,0,255],maroon:[128,0,0],navy:[0,0,128],olive:[128,128,0],orange:[255,165,0],pink:[255,192,203],purple:[128,0,128],violet:[128,0,128],red:[255,0,0],silver:[192,192,192],white:[255,255,255],yellow:[255,255,0],transparent:[255,255,255]},j=function(b){return b&&b.indexOf("#")==
-1&&b.indexOf("(")==-1?"rgb("+e[b].toString()+")":b};b.extend(b.fx.step,{borderTopWidth:i,borderBottomWidth:i,borderLeftWidth:i,borderRightWidth:i});b.fn.revertFlip=function(){return this.each(function(){var d=b(this);d.flip(d.data("flipRevertedSettings"))})};b.fn.flip=function(d){return this.each(function(){var g=b(this),c,f,e,i;if(g.data("flipLock"))return!1;var p={direction:function(a){switch(a){case "tb":return"bt";case "bt":return"tb";case "lr":return"rl";case "rl":return"lr";default:return"bt"}}(d.direction),
bgColor:j(d.color)||"#999",color:j(d.bgColor)||g.css("background-color"),content:g.html(),speed:d.speed||500,onBefore:d.onBefore||function(){},onEnd:d.onEnd||function(){},onAnimation:d.onAnimation||function(){}};g.data("flipRevertedSettings",p).data("flipLock",1).data("flipSettings",p);c={width:g.width(),height:g.height(),bgColor:j(d.bgColor)||g.css("background-color"),fontSize:g.css("font-size")||"12px",direction:d.direction||"tb",toColor:j(d.color)||"#999",speed:d.speed||500,top:g.offset().top,
left:g.offset().left,target:d.content||null,transparent:"transparent",dontChangeColor:d.dontChangeColor||!1,onBefore:d.onBefore||function(){},onEnd:d.onEnd||function(){},onAnimation:d.onAnimation||function(){}};f=g.css("visibility","hidden").clone(!0).data("flipLock",1).appendTo("body").html("").css({visibility:"visible",position:"absolute",left:c.left,top:c.top,margin:0});var n=function(){return{backgroundColor:c.transparent,fontSize:0,lineHeight:0,borderTopWidth:0,borderLeftWidth:0,borderRightWidth:0,
borderBottomWidth:0,borderTopColor:c.transparent,borderBottomColor:c.transparent,borderLeftColor:c.transparent,borderRightColor:c.transparent,background:"none",borderStyle:"solid",height:0,width:0}},o=function(){var a=c.height/100*25,b=n();b.width=c.width;return{start:b,first:{borderTopWidth:0,borderLeftWidth:a,borderRightWidth:a,borderBottomWidth:0,borderTopColor:"#999",borderBottomColor:"#999",top:c.top+c.height/2,left:c.left-a},second:{borderBottomWidth:0,borderTopWidth:0,borderLeftWidth:0,borderRightWidth:0,
borderTopColor:c.transparent,borderBottomColor:c.transparent,top:c.top,left:c.left}}},m=function(){var a=c.height/100*25,b=n();b.height=c.height;return{start:b,first:{borderTopWidth:a,borderLeftWidth:0,borderRightWidth:0,borderBottomWidth:a,borderLeftColor:"#999",borderRightColor:"#999",top:c.top-a,left:c.left+c.width/2},second:{borderTopWidth:0,borderLeftWidth:0,borderRightWidth:0,borderBottomWidth:0,borderLeftColor:c.transparent,borderRightColor:c.transparent,top:c.top,left:c.left}}};e={tb:function(){var a=
o();a.start.borderTopWidth=c.height;a.start.borderTopColor=c.bgColor;a.second.borderBottomWidth=c.height;a.second.borderBottomColor=c.toColor;return a},bt:function(){var a=o();a.start.borderBottomWidth=c.height;a.start.borderBottomColor=c.bgColor;a.second.borderTopWidth=c.height;a.second.borderTopColor=c.toColor;return a},lr:function(){var a=m();a.start.borderLeftWidth=c.width;a.start.borderLeftColor=c.bgColor;a.second.borderRightWidth=c.width;a.second.borderRightColor=c.toColor;return a},rl:function(){var a=
m();a.start.borderRightWidth=c.width;a.start.borderRightColor=c.bgColor;a.second.borderLeftWidth=c.width;a.second.borderLeftColor=c.toColor;return a}}[c.direction]();i=function(){var a=c.target;return a&&a.jquery?a.html():a};f.queue(function(){c.onBefore(f,g);f.html("").css(e.start);f.dequeue()});f.animate(e.first,c.speed);f.queue(function(){c.onAnimation(f,g);f.dequeue()});f.animate(e.second,c.speed);f.queue(function(){c.dontChangeColor||g.css({backgroundColor:c.toColor});g.css({visibility:"visible"});
var a=i();a&&g.html(a);f.remove();c.onEnd(f,g);g.removeData("flipLock");f.dequeue()})})}})(jQuery);
(function(b){var i;b.fn.pwi=function(e){function j(b){b=new Date(Number(b));var c=b.getUTCFullYear();c<1E3&&(c+=1900);return b.getUTCDate()+" "+a.months[b.getUTCMonth()]+" "+c}function d(b){var c=new Date(Number(b));$year=c.getUTCFullYear();$year<1E3&&($year+=1900);return c=="Invalid Date"?b:c.getUTCDate()+" "+a.months[c.getUTCMonth()]+" "+$year+" at "+c.getUTCHours()+":"+(c.getUTCMinutes()<10?"0"+c.getUTCMinutes():c.getUTCMinutes())}function g(c){var g,h="",j="",e=c.content.src;j=(c.summary?c.summary.$t:
"").replace(/\n/g,"<br />\n");a.showPhotoDate&&(h=c.exif$tags.exif$time?d(c.exif$tags.exif$time.$t):c.gphoto$timestamp?d(c.gphoto$timestamp.$t):d(c.published.$t),h+=" ");h+=j.replace(RegExp("'","g"),"&#39;");g=b("<div class='pwi_photo' style='height:"+(a.thumbSize+1)+"px;cursor: pointer;'/>");g.append("<a href='"+e+"?imgmax="+a.photoSize+"' rel='lb-"+a.username+"' title='"+h+"'><img src='"+e+"?imgmax="+a.thumbSize+"&crop="+a.thumbCrop+"'/></a>");a.showPhotoCaption&&(a.showPhotoCaptionDate&&a.showPhotoDate&&
(j=h),j.length>a.showCaptionLength&&(j=j.substring(0,a.showCaptionLength)),g.find("a").append("<br/>"+j));typeof a.onclickThumb==="function"&&g.bind("click.pwi",c,l);return g}function c(d){var g=b("<div/>"),h=0,e=0;h=a.albumsPerPage*(a.albumPage-1);for(e=d.feed.entry.length;h<a.albumMaxResults&&h<e&&h<a.albumsPerPage*a.albumPage;){var f=d.feed.entry[h].gphoto$name.$t,i=j(d.feed.entry[h].gphoto$timestamp.$t),k=d.feed.entry[h].media$group.media$thumbnail[0].url.replace(RegExp("/s160-c/","g"),"/");if(b.inArray(f,
a.albums)>-1||a.albums.length===0)$scAlbum=b("<div class='pwi_album'/>"),$scAlbum.bind("click.pwi",d.feed.entry[h],function(b){b.stopPropagation();a.page=1;a.album=b.data.gphoto$name.$t;if(typeof a.onclickAlbumThumb==="function")a.onclickAlbumThumb(b);else n();return!1}),a.showAlbumThumbs&&$scAlbum.append("<img src='"+k+"?imgmax="+a.albumThumbSize+"&crop="+a.albumCrop+"'/>"),a.showAlbumTitles&&$scAlbum.append("<br/>"+(d.feed.entry[h].title.$t.length>a.showAlbumTitlesLength?d.feed.entry[h].title.$t.substring(0,
a.showCaptionLength):d.feed.entry[h].title.$t)+"<br/>"+(a.showAlbumdate?i:"")+(a.showAlbumPhotoCount?"&nbsp;&nbsp;&nbsp;&nbsp;"+d.feed.entry[h].gphoto$numphotos.$t+" "+a.labels.photos:"")),g.append($scAlbum);h++}g.append("<div style='clear: both;height:0px;'/>");if(e>a.albumsPerPage){h=e/a.albumsPerPage;f=b("<div class='pwi_prevpage'/>").text(a.labels.prev);e=b("<div class='pwi_nextpage'/>").text(a.labels.next);$navRow=b("<div class='pwi_pager'/>");a.albumPage>1&&f.addClass("link").bind("click.pwi",
function(b){b.stopPropagation();a.albumPage=parseInt(a.albumPage,10)-1;c(d);return!1});$navRow.append(f);for(f=1;f<h+1;f++)tmp=f==a.albumPage?"<div class='pwi_pager_current'>"+f+"</div> ":b("<div class='pwi_pager_page'>"+f+"</div>").bind("click.pwi",f,function(b){b.stopPropagation();a.albumPage=b.data;c(d);return!1}),$navRow.append(tmp);a.albumPage<h&&e.addClass("link").bind("click.pwi",function(b){b.stopPropagation();a.albumPage=parseInt(a.albumPage,10)+1;c(d);return!1});$navRow.append(e);$navRow.append("<div style='clear: both;height:0px;'/>");
$navRow.length>0&&(a.showPager==="both"||a.showPager==="top")&&g.append($navRow);$navRow.length>0&&(a.showPager==="both"||a.showPager==="bottom")&&g.prepend($navRow.clone(!0))}a.albumstore=d;o(!1,g)}function f(c){var d,h;h="";var e=c.feed.openSearch$totalResults.$t,f="",i="",k=c.feed.gphoto$location===void 0?"":c.feed.gphoto$location.$t,l=c.feed.subtitle===void 0?"":c.feed.subtitle.$t,m=j(c.feed.gphoto$timestamp===void 0?"":c.feed.gphoto$timestamp.$t),q=e=="1"?!1:!0;f=c.feed.title==="undefined"||
a.albumTitle.length>0?a.albumTitle:c.feed.title.$t;d=b("<div/>");a.mode!="album"&&a.mode!="keyword"&&(h=b("<div class='pwi_album_backlink'>"+a.labels.albums+"</div>").bind("click.pwi",function(a){a.stopPropagation();p();return!1}),d.append(h));if(a.showAlbumDescription){h=b("<div class='pwi_album_description'/>");h.append("<div class='title'>"+f+"</div>");h.append("<div class='details'>"+e+" "+(q?a.labels.photos:a.labels.photo)+(a.showAlbumdate?", "+m:"")+(a.showAlbumLocation&&k?", "+k:"")+"</div>");
h.append("<div class='description'>"+l+"</div>");if(a.showSlideshowLink&&!(a.mode==="keyword"||a.keyword!==""))try{h.append("<div><a href='http://picasaweb.google.com/"+a.username+"/"+c.feed.gphoto$name.$t+""+(a.authKey!==""?"?authkey="+a.authKey:"")+"#slideshow/"+c.feed.entry[0].gphoto$id.$t+"' rel='gb_page_fs[]' target='_new' class='sslink'>"+a.labels.slideshow+"</a></div>")}catch(r){}d.append(h)}if(e>a.maxResults){$pageCount=e/a.maxResults;h=b("<div class='pwi_prevpage'/>").text(a.labels.prev);
f=b("<div class='pwi_nextpage'/>").text(a.labels.next);i=b("<div class='pwi_pager'/>");a.page>1&&h.addClass("link").bind("click.pwi",function(b){b.stopPropagation();a.page=parseInt(a.page,10)-1;n();return!1});i.append(h);for(k=1;k<$pageCount+1;k++)h=k==a.page?"<div class='pwi_pager_current'>"+k+"</div> ":b("<div class='pwi_pager_page'>"+k+"</div>").bind("click.pwi",k,function(b){b.stopPropagation();a.page=b.data;n();return!1}),i.append(h);a.page<$pageCount&&f.addClass("link").bind("click.pwi",function(b){b.stopPropagation();
a.page=parseInt(a.page,10)+1;n();return!1});i.append(f);i.append("<div style='clear: both;height:0px;'/>")}i.length>0&&(a.showPager==="both"||a.showPager==="top")&&d.append(i);for(h=(a.page-1)*a.maxResults;h<a.maxResults*a.page&&h<e;)f=g(c.feed.entry[h]),d.append(f),h++;i.length>0&&(a.showPager==="both"||a.showPager==="bottom")&&d.append(i.clone(!0));a.photostore[a.album]=c;c=b(".pwi_photo",d).css(a.thumbCss);typeof a.popupExt==="function"?a.popupExt(c.find("a[rel='lb-"+a.username+"']")):typeof a.onclickThumb!=
"function"&&b.slimbox&&c.find("a[rel='lb-"+a.username+"']").slimbox(a.slimbox_config);o(!1,d)}function k(c){for(var d=b("<div/>"),h=c.feed?c.feed.entry.length:0,f=0;f<a.maxResults&&f<h;){var e=g(c.feed.entry[f]);d.append(e);f++}d.append("<div style='clear: both;height:0px;'> </div>");c=b("div.pwi_photo",d).css(a.thumbCss);typeof a.popupExt==="function"?a.popupExt(c.find("a[rel='lb-"+a.username+"']")):typeof a.onclickThumb!="function"&&b.slimbox&&c.find("a[rel='lb-"+a.username+"']").slimbox(a.slimbox_config);
o(!1,d)}function l(b){b.stopPropagation();b.preventDefault();a.onclickThumb(b)}function p(){a.albumstore.feed?c(a.albumstore):(o(!0,""),b.getJSON("http://picasaweb.google.com/data/feed/api/user/"+a.username+"?kind=album&access="+a.albumTypes+"&alt=json","callback=?",c));return m}function n(){if(a.photostore[a.album])f(a.photostore[a.album]);else{var c="http://picasaweb.google.com/data/feed/api/user/"+a.username+(a.album!==""?"/album/"+a.album:"")+"?kind=photo&alt=json"+(a.authKey!==""?"&authkey="+
a.authKey:"")+(a.keyword!==""?"&tag="+a.keyword:"");o(!0,"");b.getJSON(c,"callback=?",f)}return m}function o(a,b){a?document.body.style.cursor="wait":(document.body.style.cursor="default",m.html(b))}var m,a={};e=b.extend({},b.fn.pwi.defaults,e);i=this;a=e;ts=(new Date).getTime();a.id=ts;m=b("<div id='pwi_"+ts+"'/>").appendTo(i);m.addClass("pwi_container");if(a.username==="")alert("Make sure you specify at least your username.\nSee http://pwi.googlecode.com for more info");else switch(a.mode){case "latest":o(!0,
"");b.getJSON("http://picasaweb.google.com/data/feed/api/user/"+a.username+(a.album!==""?"/album/"+a.album:"")+"?kind=photo&max-results="+a.maxResults+"&alt=json&q="+(a.authKey!==""?"&authkey="+a.authKey:"")+(a.keyword!==""?"&tag="+a.keyword:""),"callback=?",k);break;case "album":n();break;case "keyword":n();break;default:p()}};b.fn.pwi.defaults={mode:"albums",username:"",album:"",authKey:"",albums:[],keyword:"",albumCrop:1,albumTitle:"",albumThumbSize:160,albumMaxResults:999,albumsPerPage:999,albumPage:1,
albumTypes:"public",page:6,photoSize:800,maxResults:50,showPager:"top",thumbSize:160,thumbCrop:0,thumbCss:{margin:"7px"},onclickThumb:"",onclickAlbumThumb:"",popupExt:"",showAlbumTitles:!0,showAlbumTitlesLength:9999,showAlbumThumbs:!0,showAlbumdate:!0,showAlbumPhotoCount:!0,showAlbumDescription:!0,showAlbumLocation:!0,showSlideshowLink:!1,showPhotoCaption:!1,showPhotoCaptionDate:!1,showCaptionLength:9999,showPhotoDownload:!1,showPhotoDate:!0,labels:{photo:"photo",photos:"photos",albums:"Back to albums",
slideshow:"Display slideshow",loading:"PWI fetching data...",page:"Page",prev:"Previous",next:"Next",devider:"|"},months:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],slimbox_config:{loop:!1,overlayOpacity:0.6,overlayFadeDuration:400,resizeDuration:400,resizeEasing:"swing",initialWidth:250,initlaHeight:250,imageFadeDuration:400,captionAnimationDuration:400,counterText:"{x}/{y}",closeKeys:[27,88,67,70],prevKeys:[37,80],nextKeys:[39,83]},blockUIConfig:{message:"<div class='lbLoading pwi_loader'>loading...</div>",
css:"pwi_loader"},albumstore:{},photostore:{},token:""}})(jQuery);
(function(b){function i(e){var d=e||window.event,g=[].slice.call(arguments,1),c=0,f=0,i=0;e=b.event.fix(d);e.type="mousewheel";e.wheelDelta&&(c=e.wheelDelta/120);e.detail&&(c=-e.detail/3);i=c;d.axis!==void 0&&d.axis===d.HORIZONTAL_AXIS&&(i=0,f=-1*c);d.wheelDeltaY!==void 0&&(i=d.wheelDeltaY/120);d.wheelDeltaX!==void 0&&(f=-1*d.wheelDeltaX/120);g.unshift(e,c,f,i);return b.event.handle.apply(this,g)}var e=["DOMMouseScroll","mousewheel"];b.event.special.mousewheel={setup:function(){if(this.addEventListener)for(var b=
e.length;b;)this.addEventListener(e[--b],i,!1);else this.onmousewheel=i},teardown:function(){if(this.removeEventListener)for(var b=e.length;b;)this.removeEventListener(e[--b],i,!1);else this.onmousewheel=null}};b.fn.extend({mousewheel:function(b){return b?this.bind("mousewheel",b):this.trigger("mousewheel")},unmousewheel:function(b){return this.unbind("mousewheel",b)}})})(jQuery);
