var PICFOG;PICFOG=function(){return{copy:{liveflow:"Live flow",enterkeyword:"Enter keyword..."},focus:1,fromPFR:false,pixw:0,pixh:0,prepad:0,slide:{nextrandom:"",auto:false,autoTimer:null,currid:""},query:{},user:{pending:true,leech:false},cache:{},regexp_pic:/http:\/\/(?:www.|)(twitpic.com|yfrog.com|tweetphoto.com|twitgoo.com)\/([0-9a-z]+)([\s\.\,]|$)/,thumbnail:{width:150,height:150,border:5,bwidth:160,bheight:160},indexpage:function(){if(PICFOG.query.processed.mode==="near_index"){$("#continent-selector a").click(function(a){a.preventDefault();$(this).addClass("active").siblings().removeClass("active");if($(this).text()==="World"){$("#near_index .linklist a").show()}else{$("#near_index .linklist a").hide();$('#near_index .linklist a[data-continent="'+$(this).text()+'"]').show()}})}},inittooltip:function(){var b,a;b=$("#popular a, #results div.th, .hc_narrow label, .tooltip");a=function(f){var e,d,c;if($("#tooltip").length==0&&f.type==="mouseover"){$("body").prepend('<div id="tooltip"></div>')}if(f.type==="mouseout"){$("#tooltip").hide();return}c=$("#tooltip").width()+12;d=f.pageX+12+c>PICFOG.viewport.width()?f.pageX-c:f.pageX+12;$("#tooltip").css({"margin-top":f.pageY+12,"margin-left":d});if(f.type==="mouseover"){if($(this).hasClass("th")){$(this).attr("title","");tt=["@"+PICFOG.results.pics[$(this).attr("id")].from_user,PICFOG.results.pics[$(this).attr("id")].text]}else{if(!$.data($(this)[0],"htmltooltip")){$.data($(this)[0],"htmltooltip",$(this).attr("title"));$(this).attr("title","")}tt=$.data($(this)[0],"htmltooltip").split(" / ");if(tt.length===1){tt=$.data($(this)[0],"htmltooltip").split(". ")}}if(tt[0]){e=tt.shift();$("#tooltip").html("<b>"+(e||"")+"</b><br />"+(tt.join(" / ")||""));$("#tooltip").show()}}};b.live("mouseover",a);b.live("mousemove",a);b.live("mouseout",a)},settings:function(){$("#picfog_h1").html("My <b>PicFog</b> settings");if(PICFOG.user.pending){return}$("#results_postpad").remove();if($("#settings").length==0){$("#results").after('<div id="settings" class="infopage"></div>')}$("#settings").html((PICFOG.user.screen_name?('<h1>Follow <a href="http://twitter.com/picfog">@PicFog</a> on twitter</h1><p class="desc">Not only can have the warm, fuzzy feeling of <strong>helping PicFog</strong> without giving a penny, but you give us permission to talk to you when it\'s very important. Don\'t worry, we have no plans to <em>bother</em> you.</p><p><label><input type="checkbox" id="settings_follow" /> Follow @PicFog on twitter</label><span></span></p>'):"")+(PICFOG.user.screen_name?('<h1>Tweet when I add a new page to my favorites</h1><p class="desc">Simple thing: when you add a search page to your favorites (by clicking at the little <span class="fav"></span> next to its name), a tweet flies out automatically - so your friends will know. But only if you enable this.</p><p><label><input type="checkbox" id="settings_tweet" /> Tweet when I add a search page to my favorites</label></p>'):"")+'<h1>Subscribe to PicFog newsletter</h1><p class="desc">Be the first to know about <strong>new features, breaking news and the Inside Story of PicFog</strong> by subscribing for the PicFog newsletter. You don\'t need any special equipment. Just an email address:</p><table border=0 style="margin: 10px; border: 1px solid #cccccc; background-color: #fff; padding: 5px; font-size: 14px;" cellspacing=0><tr><td style="padding: 10px 0 0 10px;"><img src="http://groups.google.co.uk/intl/en/images/logos/groups_logo_sm.gif" height=30 width=140 alt="Google Groups"></td></tr><tr><td style="padding-left: 10px"> <b>Subscribe to PicFog newsletter</b> </td></tr><tr><td style="padding: 10px;"><form action="http://groups.google.co.uk/group/picfog/boxsubscribe"> Email: <input type=text name=email> <input type=submit name="sub" value="Subscribe"></form></td></tr><tr><td align=right style="padding: 3px;"> <a href="http://groups.google.co.uk/group/picfog">Visit this group</a> </td></tr></table>'+(PICFOG.user.screen_name?('<h1>Aaand, that\'s it!</h1><p class="desc">You\'re done, you don\'t have to save anything, it\'s already taken care of. If you still have two minutes, can you fill this <a href="http://survey.io/survey/d2c0d" target="_new">8-question survey</a>? (Opens in a new tab.)</p><p class="desc">Otherwise, go back to the <a href="/">homepage</a>.</p><h1>Delete my account</h1><p class="desc">Oh, that\'s heartbreaking. If you have 15 seconds, we\'d love to know why you decided to leave us: <a href="http://spreadsheets.google.com/viewform?formkey=dGxmOFZndTBLV1doN1hNRVRYeEJJRnc6MQ" target="_new">15-second survey on leaving PicFog</a> (opens in a new tab).</p><p><input type="button" value="Delete my PicFog account." id="settings_delete" /> <span></span></p>'):('<h1>You can set a lot more things if you sign in</h1><p class="desc">This is very easy - if you have a twitter account, you have a PicFog account. This link will take you to twitter to do some handshaking and bring you back here. Are you ready? <a href="/cgi-bin/login.rb">Sign in with twitter</a></p>')));if(!PICFOG.user.pending){$("#settings_tweet").attr("checked",PICFOG.user.tweet);$("#settings_follow").attr("checked",PICFOG.user.follows);if(PICFOG.user.follows){$("#settings_follow").parent().next().html(' &laquo; We <span class="love active"></span> you for that!')}else{$("#settings_follow").parent().next().html("")}}else{return}$("#settings_tweet").click(function(b){var a=$(this).attr("checked")?"tweet":"donttweet";$.getJSON("http://picfog.com/cgi-bin/check.rb?mode=tweet&do="+a+"&callback=?",function(c){})});$("#settings_follow").click(function(b){var a;a=$(this).attr("checked")?"follow":"unfollow";if(a==="follow"){$("#settings_follow").parent().next().html(' &laquo; Wow, that\'s very kind of you... <span class="love active"></span>')}else{$("#settings_follow").parent().next().html("")}$.getJSON("http://picfog.com/cgi-bin/check.rb?mode=follow&do="+a+"&callback=?",function(c){})});if($.cookie("nsfw")=="enabled"){$("#settings_liveflow").attr("checked","checked").parent().after(' <span class="none">Go <a href="/">live flow &raquo;</a></span>')}$("#settings_liveflow").click(function(b){$.cookie("nsfw",$(this).attr("checked")?"enabled":"disabled",{expires:90,path:"/",domain:"picfog.com"});if($(this).attr("checked")){$(this).parent().after(' <span class="none">Okay, go <a href="/">live flow &raquo;</a></span>')}else{$(this).parent().parent().find("span.none").remove()}try{pageTracker._trackEvent("Live flow",$(this).attr("checked")?"Enabled":"Disabled","",0)}catch(a){}});$("#settings_delete").click(function(a){a.preventDefault();$(this).next().html("");if(confirm("Do you really want to delete your PicFog account with all your saved searches? There's no undo.")){$(this).next().html("Deleting...").addClass("loading");$.getJSON("http://picfog.com/cgi-bin/check.rb?mode=deleteme&callback=?",function(c){document.location="/settings";PICFOG.user.out();try{pageTracker._trackEvent("Logout","Delete","",0)}catch(b){}})}else{$(this).next().html("Ooooh, that's a relief...")}})},resize:function(c){if(!c&&PICFOG.query.processed.mode!=="normal"){return}var b,a;a=PICFOG.pixw;PICFOG.pixw=Math.max(3,Math.min(10,Math.floor(($(window).width()-($("#wrapper_menu:visible").width()||0)-(typeof(window.orientation)!=="number"?10:0))/PICFOG.thumbnail.bwidth)));if($("#wrapper").hasClass("picfog-prolifics")){PICFOG.pixw=Math.max(3,Math.min(10,Math.floor((PICFOG.viewport.width()-50)/PICFOG.thumbnail.bwidth)))}PICFOG.pixh=Math.ceil((PICFOG.viewport.height()-$("#header").height()-PICFOG.thumbnail.border*2)/PICFOG.thumbnail.bheight)+2;if(PICFOG.pixw*PICFOG.pixh>100){PICFOG.pixw=Math.min(Math.floor(100/PICFOG.pixh),1)}b=PICFOG.pixw*PICFOG.thumbnail.bwidth;if(a!==PICFOG.pixw){$("#results").width(b+"px")}if(typeof(window.orientation)!=="number"){if($("#wrapper_menu").height()<PICFOG.viewport.height()-60){$("#wrapper_menu").css({position:"fixed"});$("#wrapper_content").css({"margin-left":"221px"})}else{$("#wrapper_menu").css({position:"static"});$("#wrapper_content").css({"margin-left":"0"})}}},scroll:function(){if(PICFOG.query.processed.mode!=="normal"){return}var a;a=PICFOG.prepad;PICFOG.prepad=Math.floor(Math.max(0,PICFOG.viewport.scrollTop()-$("#header").height())/PICFOG.thumbnail.bheight);if(PICFOG.results.complete){PICFOG.prepad=Math.min(PICFOG.prepad,Math.floor((PICFOG.results.picsflow.length-1)/PICFOG.pixw))}if(PICFOG.prepad!==a){$("#results").css({"margin-top":(PICFOG.prepad*PICFOG.thumbnail.bheight)+"px"});PICFOG.postflow.cursorset(PICFOG.prepad*PICFOG.pixw);PICFOG.postflow.repaint()}if(PICFOG.viewport.scrollTop()===0){PICFOG.Fetcher.fetchqueueset("newer",1);PICFOG.Fetcher.fetchnow()}else{PICFOG.Fetcher.fetchqueueset("newer",0)}PICFOG.scrollpostpad()},scrollpostpad:function(){if($("#results_holder > #adzone_468").length){PICFOG.results.extraheight=$("#results_holder > #adzone_468")?70:0}if(PICFOG.pixw>0){$("#results_holder").height(Math.max(PICFOG.results.extraheight,Math.ceil(PICFOG.results.picsflow.length/PICFOG.pixw)*PICFOG.thumbnail.bheight+PICFOG.results.extraheight));if(PICFOG.results.complete&&PICFOG.postflow.lastshown()){$("#results_postpad").html('<em class="done">'+(PICFOG.results.picsflow.length||"No")+"</em> pictures found."+(PICFOG.results.picsflow.length?"":' <a href="/">Broaden your scope</a> or  watch the <a href="/liveflow/">live flow</a>.'))}}},flow:function(a){if(a){PICFOG.Fetcher.flowcontrol(a)}if(PICFOG.Fetcher.flowcontrol()&&PICFOG.focus===1){$(".buttons a span.play").parent().addClass("pressed");$(".buttons a span.pause").parent().removeClass("pressed")}else{$(".buttons a span.play").parent().removeClass("pressed");$(".buttons a span.pause").parent().addClass("pressed")}},inittop:function(){$("#popular").css("float","left");$("#popular").css("font-size","100%");$("#popular").css("font-size",Math.min(250,Math.floor($("#breaking").width()/$("#popular").width()*100+0.5))+"%");$("#popular").css("float","none");$("#popular li a").each(function(){if($(this).attr("href")===PICFOG.query.canonize.link()){$(this).addClass("active")}})},init:function(){PICFOG.viewport=$(window);var b,a,c;if(PICFOG.fromPFR){if($("#results_holder > #adzone_468").length){PICFOG.results.extraheight=70}PICFOG.resize(true);PICFOG.results.picswindow=PFR.results.picsflow.slice(PFR.results.cursor,PFR.results.cursor+PICFOG.pixw*PICFOG.pixh);PICFOG.postflow.repaint()}setTimeout(function(){$(".leftlinkzone").fadeIn(500)},3000);PICFOG.user.process();PICFOG.query.process();if(PICFOG.query.processed.pending){PICFOG.query.display()}if($("#tabzone a").length<1){$.get("/inc/pop1.html",function(d){$("#tabzone").prepend(d+" ")})}$("#extendsearch a").click(function(d){d.preventDefault();if($(this).hasClass("extend_near")){$("#do_narrow_near").addClass("added").slideDown(100).find("input").focus()}if($(this).hasClass("extend_users")){$("#do_narrow_users").addClass("added").slideDown(100).find("input").focus()}$("#extendsearch").slideUp(100)});$("#toggle_menu").click(function(d){d.preventDefault();if($("#wrapper_menu:visible").length){$("#wrapper_menu").hide();$(this).html("Show menu &raquo;").animate({left:"3px"},100)}else{$("#wrapper_menu").show();$(this).html("&laquo; Hide menu").animate({left:"159px"},100)}PICFOG.resize()});$("#form_picfog span.i_plus").click(function(d){d.preventDefault();$(this).parent().removeClass("added");$(this).siblings("input").val("");if($(this).parent().hasClass("hc_narrow")){$(this).parent().slideUp(100);$("#extendsearch").slideDown(100)}if($(this).siblings("input").attr("id")=="hc_narrow_near_input"){$("#picfog-map").slideUp();$("#picfog-map-buttons").hide()}$("#form_picfog").submit()});$("#commentlink").click(function(d){d.preventDefault();PICFOG.viewport.scrollTop(0);$("#disqus_thread_container").show()});$("#disqus_nav_close").click(function(d){d.preventDefault();$("#disqus_thread_container").hide()});if(typeof(window.orientation)!=="number"){if($("#wrapper_menu:visible").length){$("#toggle_menu").html("&laquo; Hide menu")}else{$("#toggle_menu").html("Show menu &raquo;")}$("a.icon_twitter").live("click",function(i){if(!$(this).hasClass("picretweet")&&!$(this).hasClass("button")){return true}if($(this).hasClass("noapi")){return true}var g,f,h,d;f=this;h=$(this).attr("href").match(/\/statuses\/(.+)/);if(h&&!PICFOG.user.screen_name){$("#loginzone a").addClass("important");alert("You have to log in with your twitter account to RT! You can still use the repost button.");i.preventDefault()}if($(this).hasClass("follow")){if(!PICFOG.user.screen_name){i.preventDefault();if(confirm("You have to log in with your twitter account to follow someone. Do you want to do that now?")){$("#tpdialog a.jqmClose").click();$("#link-signin").click();document.location="/cgi-bin/login.rb"}}else{i.preventDefault();h=$(this).attr("href").match(/twitter.com\/(.+?)$/);if(h[1]){$(this).addClass("pending");$.getJSON("http://picfog.com/cgi-bin/check.rb?mode=followuser&id="+h[1]+"&callback=?",function(e){$(f).removeClass("pending");$(f).text("Followed")})}}}if(PICFOG.user.screen_name){i.preventDefault();if(h){$(this).addClass("pending");$.getJSON("http://picfog.com/cgi-bin/check.rb?mode=retweet&id="+h[1]+"&callback=?",function(e){$(f).removeClass("pending")});return}g=decodeURIComponent(($(this).attr("href").split("http://twitter.com/home?status="))[1]);g=prompt("Edit your tweet :)",g);if(g){$(this).addClass("pending");d=$(this).attr("id");if(d&&d.indexOf("tweet_")>-1){d="&id="+d.substr(6)}else{d=""}$.getJSON("http://picfog.com/cgi-bin/check.rb?status="+encodeURIComponent(g)+d+"&callback=?",function(e){$(f).removeClass("pending")})}}});$("#slide_auto").live("click",PICFOG.slide.toggleAuto);$("#results div.th").live("mousedown",PICFOG.postflow.popup);$("#results div.th").live("click",function(d){d.preventDefault()});$("#fb-share-pic").live("click",function(e){var d;e.preventDefault();d=PICFOG.slide.currid;FB.ensureInit(function(){$("#tpdialog").jqmHide();FB.Connect.streamPublish("",{name:"Check out "+PICFOG.query.canonize.title()+" on PicFog",description:"Click on the picture for high res or to the link above for more results.",href:"http://picfog.com"+PICFOG.query.canonize.link(),media:[{type:"image",src:PICFOG.results.pics[d].thumbnail,href:PICFOG.results.pics[d].picurl}]},null,null,"Share this picture on Facebook",function(g,f){PICFOG.postflow.popup(null,d)})})});$("#results div.th").live("mouseover",function(d){var f,e;PICFOG.cache=this;f=this;setTimeout(function(){if(f===PICFOG.cache){e=$(f).attr("id");PICFOG.postflow.getpic(e)}},3000)});$("#results div.th").live("mouseout",function(d){delete PICFOG.cache});PICFOG.inittooltip();$("#slideshow").click(function(d){d.preventDefault();PICFOG.slide.setAuto(true);PICFOG.slide.next()})}else{$("#results div.th").live("click",PICFOG.postflow.popup);$("a").live("click",function(f){if($(this).hasClass("ajax")){return}var d;if($(this).parents("#popular").length){$(this).addClass("ihover");d=($(this).attr("title")+" / ").split(" / ");d.shift();if(!confirm(d.join(" / ")+"\n\nShall we proceed?")){f.preventDefault();return false}}if($(this).attr("href").substr(0,1)==="/"){f.preventDefault();document.location=$(this).attr("href")}})}$("#favorites_list span.fav.do").live("click",function(d){d.preventDefault();$("#picfog_h1 a.fav").click()});$("#picfog_h1 a.fav").live("click",function(f){f.preventDefault();if(!PICFOG.user.screen_name){alert("You have to sign in with your twitter account to save favorites!");$("#loginzone a").addClass("important");return}$("#favorites_list li span.fav.do").parent().remove();$("#favorites_list").prepend('<li class="loading">Loading...</li>');var d={},g=$(this);$(this).addClass("loading");d.favorite="pages";d.mode=$(this).hasClass("active")?"rem":"add";d.title=$(this).prev().text();d.link=$(this).prev().attr("href");PICFOG.favorites.message(d,g)});PICFOG.viewport.unload(function(d){PICFOG.viewport.scrollTop(0)});PICFOG.viewport.resize(function(){PICFOG.resize();PICFOG.scroll()});PICFOG.viewport.scroll(function(){PICFOG.scroll()});$(window).keyup(function(e){var d;d=$("#form_picfog input.i_t:focus");if(d.length===1){if(d.val()!==""){$("#form_picfog .hc_narrow").removeClass("added");d.parent().addClass("added")}else{d.parent().removeClass("added");setTimeout(function(){if(d.val()===""){d.parent().slideUp(100);$("#extendsearch").slideDown(100)}},1500);if(d.attr("id")==="hc_narrow_near_input"){$("#picfog-map").slideUp();$("#picfog-map-buttons").hide()}}return}d=$("#hashcode:focus");if(d.length===1){if(d.val()!==""&&d.val()!==PICFOG.copy.liveflow&&d.val()!==PICFOG.copy.enterkeyword){d.parent().addClass("added")}else{d.parent().removeClass("added")}}});$(window).keydown(function(e){var d,f;if($("#disqus_thread_container:visible").length&&e.keyCode===27){e.preventDefault();$("#disqus_thread_container").hide();return}if($(".jqmOverlay:visible").length==1){if(e.keyCode===27){$("#tpdialog").jqmHide();PICFOG.slide.currid="";PICFOG.slide.setAuto(false)}if($("#tpdialog").hasClass("nolive")){return}if(e.keyCode==32){e.preventDefault();PICFOG.slide.setAuto(false);PICFOG.slide.next()}if(e.keyCode==38){$("#tpdialog").jqmHide();PICFOG.slide.currid="";PICFOG.slide.flip(1)}if(e.keyCode==39||e.keyCode==37){PICFOG.slide.setAuto(false);PICFOG.slide.flip(e.keyCode===39?1:-1)}}else{if(!$("input:focus,textarea.focus").length){if(e.keyCode==74){f=Math.floor((PICFOG.viewport.scrollTop()-PICFOG.results.extraheight)/PICFOG.thumbnail.bwidth);$("html,body").stop().animate({scrollTop:(f+PICFOG.pixh-3)*PICFOG.thumbnail.bwidth+PICFOG.results.extraheight},150)}else{if(e.keyCode==75){f=Math.ceil((PICFOG.viewport.scrollTop()-PICFOG.results.extraheight)/PICFOG.thumbnail.bwidth);$("html,body").stop().animate({scrollTop:(f-PICFOG.pixh+3)*PICFOG.thumbnail.bwidth+PICFOG.results.extraheight},50)}}}if(e.keyCode==13&&$("#form_picfog input:focus").length>0){$("#form_picfog").submit();return}if(e.keyCode==32){if($("#form_picfog input:focus, #widget_index form input:focus").length>0){return}e.preventDefault();PICFOG.slide.next()}else{if(e.keyCode===35){e.preventDefault();d=Math.floor((PICFOG.results.picsflow.length+PICFOG.pixw-1)/PICFOG.pixw);if(PICFOG.results.complete){d=Math.floor((PICFOG.results.picsflow.length+PICFOG.pixw-1)/PICFOG.pixw-PICFOG.pixh+2)}$("#results").css({"margin-top":d*PICFOG.thumbnail.bheight});PICFOG.viewport.scrollTop(d*PICFOG.thumbnail.bheight+$("#header").height()-20)}}}});PICFOG.viewport.blur(function(){PICFOG.focus=0;PICFOG.flow()});PICFOG.viewport.focus(function(){PICFOG.focus=1;PICFOG.flow()});$("#hashcode").hover(function(){if($("#hashcode:focus").length===0&&$(this).val()===PICFOG.copy.liveflow){$(this).val(PICFOG.copy.enterkeyword)}},function(){if($("#hashcode:focus").length===0&&$(this).val()===PICFOG.copy.enterkeyword){$(this).val(PICFOG.copy.liveflow)}});$("#form_picfog input").focus(function(){if($(this).attr("id")=="hashcode"&&$(this).hasClass("liveflow")){$(this).removeClass("liveflow");$(this).val("")}PICFOG.focus=0;PICFOG.flow()});$("#form_picfog input").blur(function(){if($(this).attr("id")=="hashcode"&&($(this).val()==""||$(this).val()===PICFOG.copy.liveflow||$(this).val()===PICFOG.copy.enterkeyword)){$(this).addClass("liveflow");$(this).val(PICFOG.copy.liveflow)}PICFOG.focus=1;PICFOG.flow()});$("#form_picfog").submit(function(d){d.preventDefault();if(PICFOG.query.canonize.link()===PICFOG.query.canonize.formlink()){return}else{document.location=PICFOG.query.canonize.formlink()}});$(".buttons a").click(function(d){if($(this).parent().attr("id")==="picfog-map-buttons"){return}d.preventDefault();if($(this).find("span").hasClass("play")){if(PICFOG.query.canonize.link()!==PICFOG.query.canonize.formlink()){$("#form_picfog").submit();return}}if($(this).hasClass("pressed")){return}if($(this).find("span").hasClass("play")){PICFOG.viewport.scrollTop(0);PICFOG.flow("resume")}if($(this).find("span").hasClass("pause")){PICFOG.flow("pause")}});PICFOG.inittop();PICFOG.resize()},initgo:function(){if(PICFOG.query.processed.mode==="settings"){PICFOG.settings();return}if(PICFOG.query.processed.mode==="about"||PICFOG.query.processed.mode==="donothing"||PICFOG.query.processed.mode==="near_index"||PICFOG.query.processed.mode==="users_index"||PICFOG.query.processed.mode==="search_index"){PICFOG.indexpage();return}PICFOG.query.display();PICFOG.scrollpostpad();PICFOG.flow("resume");PICFOG.Fetcher.init();if($("ul#popular li").length===0){$.get("/inc/pop10.html",function(a){$("ul#popular").html(a);PICFOG.inittop()})}setInterval(function(){$.get("/inc/pop10.html",function(a){$("ul#popular").html(a);PICFOG.inittop()})},60000*5)}}}();PICFOG.results=(function(){if(typeof(PFR)=="object"&&PFR.results){PICFOG.fromPFR=true;return PFR.results}return{flow:[],pics:{},picsflow:[],picsflow_epicenter:0,complete:false,cursor:0,picswindow:[],ori_max_id:0,curr_page:0,extraheight:0}}());PICFOG.query.display=function(){var c,b,a;if(PICFOG.query.processed.loki){if(PICFOG.query.processed.pending){$("#results_postpad").html('<em>Fetching</em> location data powered by <a href="http://loki.com/"><em class="done">loki</em></a>. This may take a while.')}else{$("#results_postpad").html("<em>PicFog</em> real time image search")}}if(!PICFOG.query.processed.pending&&PICFOG.query.processed.near){if($("#picfog-map").find("img").length==0){$("#picfog-map").html('<img src="http://maps.google.com/maps/api/staticmap?center='+encodeURIComponent(PICFOG.query.processed.nearcoords)+"&amp;zoom="+encodeURIComponent(PICFOG.query.processed.zoom)+"&amp;&maptype=hybrid&amp;size=214x120&amp;sensor="+(PICFOG.query.processed.near==="me"?"true":"false")+'" />')}$("#picfog-map-buttons").show().html($.map(PICFOG.query.processed.distances||[],function(e,d){return'<a href="/near/'+encodeURIComponent(PICFOG.query.processed.near)+"/"+e+"km"+(PICFOG.query.processed.word?"/"+encodeURIComponent(PICFOG.query.processed.word):"/")+'"'+(e===parseInt(PICFOG.query.processed.distance,10)?' class="pressed"':"")+">"+e+"km</a>"}).join(" "));if(PICFOG.query.processed.loki){$("#picfog-map").before('<p class="scribe">Location data powered by <a href="http://loki.com/">LOKI</a></p>')}}$("#picfog_h1").html('<a href="'+PICFOG.query.canonize.link()+'">'+PICFOG.query.canonize.title()+"</a>");if(PICFOG.query.processed.word||PICFOG.query.processed.near||PICFOG.query.processed.user){c=PICFOG.query.canonize.title(true);document.title=c+" on PicFog";$("#picfog_h1").append(' <a class="fav tooltip" title="Save"></a> ');c="http://twitter.com/home?status="+encodeURIComponent("Check out "+c+" on PicFog: http://picfog.com"+PICFOG.query.canonize.link());$("#button_tweet a").attr("href",c)}if(typeof(window.orientation)==="number"){$.cookie("lastlocation","picfog.com"+PICFOG.query.canonize.link(),{expires:90,path:"/",domain:"picfog.com"})}if(!PICFOG.query.processed.near&&PICFOG.query.processed.word&&typeof(google)!=="undefined"){b=new google.maps.Geocoder();a=PICFOG.query.processed.word;a=a.replace(/^\#/g,"");b.geocode({address:a},function(d,e){if(e==google.maps.GeocoderStatus.OK&&d.length&&e!=google.maps.GeocoderStatus.ZERO_RESULTS){if(d[0]&&d[0]["formatted_address"]&&d[0]["formatted_address"].toLowerCase().match(a.toLowerCase())&&$("#didyoumean").length==0){$("#hashcode").parent().after('<p id="didyoumean"><a href="/near/'+encodeURIComponent(a)+'"><strong>Near</strong> '+a+"</a>, you mean?</p>")}}})}if(!PICFOG.query.processed.pending&&PICFOG.query.processed.word&&!PICFOG.query.processed.near&&!PICFOG.query.processed.user){if(PICFOG.query.processed.word.match(/^\@/)){if($("#didyoumean").length==0){$("#hashcode").parent().after('<p id="didyoumean"><a href="/users/'+PICFOG.query.processed.word.substr(1)+'/"><strong>By</strong> '+a+"</a>, you mean?</p>")}}}if(PICFOG.query.processed.user){$("#hc_narrow_user_input").val(PICFOG.query.processed.user).parent().addClass("added")}if(PICFOG.query.processed.near){$("#hc_narrow_near_input").val(PICFOG.query.processed.near).parent().addClass("added")}if(PICFOG.query.processed.word){$("#hashcode").val(PICFOG.query.processed.word).removeClass("liveflow").parent().addClass("added")}else{if($("#hashcode:focus").length===0){$("#hashcode").val(PICFOG.copy.liveflow)}}if(PICFOG.query.processed.user){$("#boxdesc").append(PICFOG.query.canonize.description())}};PICFOG.query.canonize={formlink:function(){var a={word:($("#hashcode").val()===PICFOG.copy.liveflow||$("#hashcode").val()===PICFOG.copy.enterkeyword)?"":$("#hashcode").val(),user:$("#hc_narrow_user_input").val(),near:$("#hc_narrow_near_input").val()};a.word=a.word.replace(/^\#/,"H-");if(a.user!==""){return"/users/"+a.user+(a.word!==""?"/"+encodeURIComponent(a.word):"/")}if(a.near!==""){return"/near/"+encodeURIComponent(a.near)+(a.word!==""?"/"+encodeURIComponent(a.word):"/")}return a.word!==""?"/search/"+encodeURIComponent(a.word):"/"},link:function(b){var a;a=PICFOG.query.processed.word?PICFOG.query.processed.word.replace(/^\#/,"H-"):null;if(PICFOG.query.processed.user){return"/users/"+PICFOG.query.processed.user+(PICFOG.query.processed.word?"/"+encodeURIComponent(a):"/")}if(PICFOG.query.processed.near){return"/near/"+encodeURIComponent(PICFOG.query.processed.near)+(PICFOG.query.processed.defaultdistance?"":"/"+PICFOG.query.processed.distance)+(a?"/"+encodeURIComponent(a):"/")}return a?"/"+(b?"s":"search")+"/"+encodeURIComponent(a):"/"},title:function(a){if(!PICFOG.query.processed){return document.title}var b="";if(PICFOG.query.processed.user){if(PICFOG.query.processed.word){b="<b>"+PICFOG.query.processed.word.split(" OR ").join("</b> OR <b>")+"</b> pictures by <b>@"+PICFOG.query.processed.user+"</b>"}else{b="Pictures by <b>@"+PICFOG.query.processed.user+"</b>"}}else{if(PICFOG.query.processed.near){if(PICFOG.query.processed.word){b="<b>"+PICFOG.query.processed.word.split(" OR ").join("</b> OR <b>")+"</b> pictures near <b>"+PICFOG.query.processed.near+"</b>"+(PICFOG.query.processed.defaultdistance?"":", within <b>"+PICFOG.query.processed.distance+"</b>")}else{b="Pictures near <b>"+PICFOG.query.processed.near+"</b>"+(PICFOG.query.processed.defaultdistance?"":", within <b>"+PICFOG.query.processed.distance+"</b>")}}else{if(PICFOG.query.processed.word){b="<b>"+PICFOG.query.processed.word.split(" OR ").join("</b> OR <b>")+"</b> pictures"}else{b="Live flow"}}}if(a){return b.replace(/<.+?>/g,"")}else{return b}},description:function(){if(PICFOG.query.processed.user){return'<a href="http://twitter.com/'+PICFOG.query.processed.user+'" class="button icon_twitter follow" target="_blank">Follow</a> <a href="http://twitter.com/'+PICFOG.query.processed.user+'" class="button icon_twitter noapi" target="_blank">@'+PICFOG.query.processed.user+"</a> "}},searchquery:function(d,b,a){var c="http://search.twitter.com/search.json?result_type=recent&"+d;if(PICFOG.query.processed.near){c+="&geocode="+encodeURIComponent(PICFOG.query.processed.nearcoords+","+PICFOG.query.processed.distance)}c+="&q=";if(PICFOG.query.processed.user){c+="from%3A"+PICFOG.query.processed.user+"%20"}if(PICFOG.query.processed.word){c+=encodeURIComponent(PICFOG.query.processed.word)+"%20"}if(PICFOG.query.processed.near){c+="(twitpic.com+OR+tweetphoto.com)"}else{c+="(twitpic.com+OR+twitgoo.com+OR+yfrog.com+OR+tweetphoto.com)"}c+="&rpp="+b+(a?"":"&callback=?");return c}};PICFOG.query.process=function(b,d){var a,c;if(typeof(b)==="function"){d=b;b=false}PICFOG.query.processed={};PICFOG.query.callback=d||PICFOG.initgo;if(!b){b=document.location}b+="";b=(b+"?").split("?")[0];a=b.match(/^http\:\/\//);if(a){b=b.substr(7)}if(typeof(document)!=="undefined"&&document.referrer===""&&typeof(window.orientation)==="number"&&(b+"").split("/")[1]===""){if($.cookie("lastlocation")){document.location="http://"+$.cookie("lastlocation")}else{document.location="http://picfog.com/"}}a=b.match(/^(?:(.+?)\.)picfog.com/);if(a){if(a[1]!=="www"){PICFOG.query.processed.source=a[1]}}if(b.substr(-1)!=="/"){b+="/"}c=b.split("/");c.shift();if(c[0]==="settings"){PICFOG.query.processed.mode="settings"}else{if(c[0]==="widget"){PICFOG.query.processed.mode="donothing"}else{if(c[0]==="about"){PICFOG.query.processed.mode="about"}else{if(c[1]===""&&(c[0]==="near"||c[0]==="search"||c[0]==="users")){PICFOG.query.processed.mode=c[0]+"_index"}else{PICFOG.query.processed.mode="normal";if(c[0]===""||c[0]==="liveflow"){}else{if(c[0]==="near"){c.shift();PICFOG.query.processed.near=decodeURIComponent(c[0]);PICFOG.query.processed.defaultdistance=true;c.shift();if(c[0]){a=c[0].match(/(\d+km)/);if(a){PICFOG.query.processed.defaultdistance=false;PICFOG.query.processed.distance=a[1];c.shift()}if(c[0]){PICFOG.query.processed.word=decodeURIComponent(c[0]).replace(/^H-/,"#")}}if((PICFOG.query.processed.near.toLowerCase()==="london"||PICFOG.query.processed.near.toLowerCase()==="sydney"||PICFOG.query.processed.near.toLowerCase()==="melbourne")&&PICFOG.query.processed.defaultdistance){PICFOG.query.processed.distance="20km"}PICFOG.query.processed.pending=true;if(PICFOG.query.processed.near.toLowerCase()==="me"){if(navigator.geolocation){navigator.geolocation.getCurrentPosition(function(e){PICFOG.query.processed.nearcoords=e.coords.latitude+","+e.coords.longitude;PICFOG.query.locationprocess()},function(e){PICFOG.query.locationfail()})}else{PICFOG.query.processed.loki=true;$.ajax({url:"http://loki.com/plugin/files/loki.js",dataType:"script",cache:true,success:function(){var e;e=PICFOG.query.processed.loki=LokiAPI();e.onSuccess=function(f){PICFOG.query.processed.nearcoords=f.latitude+","+f.longitude;PICFOG.query.locationprocess()};e.onFailure=function(f){PICFOG.query.locationfail()};e.setKey("picfog.com");e.requestLocation(true,PICFOG.query.processed.loki.NO_STREET_ADDRESS_LOOKUP)}})}}else{PICFOG.query.locationprocess()}}else{if(c[0]==="users"){c.shift();PICFOG.query.processed.user=decodeURIComponent(c[0]);c.shift();if(c[0]){PICFOG.query.processed.word=decodeURIComponent(c[0]).replace(/^H-/,"#")}}else{if(c[0]==="search"){c.shift()}if(c[0]){PICFOG.query.processed.word=decodeURIComponent(c[0]).replace(/^H-/,"#")}}}}}}}}if(!PICFOG.query.processed.pending){PICFOG.query.callback()}};PICFOG.query.locationfail=function(){alert("Couldn't determine location. :(");delete (PICFOG.query.processed.near);delete (PICFOG.query.processed.distance);delete (PICFOG.query.processed.pending);PICFOG.query.callback()};PICFOG.distance=function(g,i,e,h){var f,k,b,m,l,j;f=6371;k=(e-g)*Math.PI/180;b=(h-i)*Math.PI/180;g=g*Math.PI/180,e=e*Math.PI/180;m=Math.sin(k/2)*Math.sin(k/2)+Math.cos(g)*Math.cos(e)*Math.sin(b/2)*Math.sin(b/2);l=2*Math.atan2(Math.sqrt(m),Math.sqrt(1-m));j=f*l;return j};PICFOG.query.locationprocess=function(){var e,a,d,c,b;if(PFR.near){if(PFR.near.nearcoords!==""){PICFOG.query.processed.nearcoords=PFR.near.nearcoords;PICFOG.query.processed.zoom=PFR.near.zoom;PICFOG.query.processed.distance=PFR.near.distance;a=[1,2,5,10,20,50,100,200,400,825];d=parseInt(PICFOG.query.processed.distance,10);for(c in a){if(d<a[c]&&d>a[c-1]){a.splice(c,0,d)}if(a[c]===d){b=Math.min(Math.max(0,c-1),a.length-3);PICFOG.query.processed.distances=a.slice(b,b+3);break}}delete (PICFOG.query.processed.pending);PICFOG.query.callback()}else{PICFOG.query.locationfail()}return}e=new google.maps.Geocoder();e.geocode({address:PICFOG.query.processed.nearcoords||PICFOG.query.processed.near},function(k,l){var g,n,f,j,m,h;if(l==google.maps.GeocoderStatus.OK&&k.length&&l!=google.maps.GeocoderStatus.ZERO_RESULTS){if(!k[0].geometry.bounds){n=k[0].geometry.location;PICFOG.query.processed.distance=PICFOG.query.processed.distance||"2km";PICFOG.query.processed.nearcoords=n.lat()+","+n.lng()}else{g=k[0].geometry.bounds;n=g.getCenter();PICFOG.query.processed.distance=PICFOG.query.processed.distance||Math.min(825,Math.max(2,Math.floor(PICFOG.distance(g.getSouthWest().lat(),g.getSouthWest().lng(),g.getNorthEast().lat(),g.getNorthEast().lng())/2)))+"km";PICFOG.query.processed.nearcoords=n.lat()+","+n.lng()}f=[1,2,5,10,20,50,100,200,400,800];m=parseInt(PICFOG.query.processed.distance,10);for(j in f){if(m<f[j]&&m>f[j-1]){f.splice(j,0,m)}if(f[j]===m){h=Math.min(Math.max(0,j-1),f.length-3);PICFOG.query.processed.distances=f.slice(h,h+3);break}}PICFOG.query.processed.zoom=Math.max(0,Math.min(18,13-Math.floor(Math.log(parseInt(PICFOG.query.processed.distance,10))/Math.log(2)+0.5)));delete (PICFOG.query.processed.pending);PICFOG.query.callback()}else{PICFOG.query.locationfail()}})};PICFOG.slide.toggleAuto=function(a){a.preventDefault();PICFOG.slide.setAuto(!PICFOG.slide.auto)};PICFOG.slide.setAuto=function(a){if(a){$("#slide_auto").addClass("slide_on");$("#slide_auto .slideshow_progress span").stop().css({height:0}).animate({height:"100%"},6000)}else{$("#slide_auto").removeClass("slide_on")}$("#slide_auto b").html(a?"ON":"OFF");PICFOG.slide.auto=a;if(a){PICFOG.slide.autoTimer=setInterval(PICFOG.slide.next,7000)}else{if(PICFOG.slide.autoTimer){clearInterval(PICFOG.slide.autoTimer);PICFOG.slide.autoTimer=null}}};PICFOG.slide.flip=function(b){var c,a;c=-1;if(PICFOG.slide.currid!==""){for(a=0;a<PICFOG.results.picsflow.length;a++){if(PICFOG.results.picsflow[a]===PICFOG.slide.currid){c=a;break}}}if(!PICFOG.results.picsflow[c+b]){if(b===1){c=-1}else{c=PICFOG.results.picsflow.length}}if(PICFOG.results.picsflow[c+2*b]){PICFOG.postflow.getpic(PICFOG.results.picsflow[c+2*b])}PICFOG.postflow.popup(null,PICFOG.results.picsflow[c+b])};PICFOG.slide.next=function(){PICFOG.slide.flip(1)};PICFOG.user.process=function(){var a,d,c,e;c='<a href="" class="dropdown" id="dropdown-fav"><span class="fav active"></span></a><span class="dropdown-content-holder"><div class="dropdown-content"><ul id="favorites_list" class="linklist"></ul></div></span>';d=$.cookie("_PicFog");if(!d||d==="NULL"){PICFOG.user.out();try{pageTracker._trackEvent("Logout","No cookie","",0)}catch(b){}}else{$("#user_logout").live("click",function(g){g.preventDefault();PICFOG.user.out();try{pageTracker._trackEvent("Logout","Logoutlink","",0)}catch(f){}document.location=PICFOG.query.canonize.formlink()});$("#favorites_list span.fav_remove").live("click",function(g){g.preventDefault();$(this).parent().addClass("loading");var f={};f.favorite="pages";f.mode="rem";f.title="";f.link=$(this).next().attr("href");PICFOG.favorites.message(f)});e=function(){$("#loginzone").html("Logged in as <b>"+PICFOG.user.screen_name+"</b>. "+c+' <a href="/users/'+PICFOG.user.screen_name+'/" class="un dropdown">My account<span class="dropdown-arrow">▼</span></a><span class="dropdown-content-holder"><div class="dropdown-content"><ul class="linklist" id="settings_list">'+(PICFOG.user.follows?"":'<li><a href="#" class="icon_twitter" id="lzb_follow">Follow us :)</a></li>')+'<li><a href="/settings">Settings</a></li>'+(PICFOG.user.widget?('<li><a href="/widget/"><b>My widgets</b></a></li>'):"")+'<li><a href="/users/'+PICFOG.user.screen_name+'/">My pictures</a></li><li><a href="" id="user_logout">&times; Log out</a></li></ul></div></a>');$("#lzb_follow").click(function(f){f.preventDefault();$(this).removeClass("icon_twitter").html('Thanks :) <span class="love active"></span>').fadeOut(500);$.getJSON("http://picfog.com/cgi-bin/check.rb?mode=follow&do=follow&callback=?",function(g){})})};PICFOG.user.screen_name=$.cookie("_PicFog_unc");if(PICFOG.user.screen_name==="NULL"){PICFOG.user.screen_name=null}if(PICFOG.user.screen_name){e()}a=(document.location+"&oauth_verifier=").split("oauth_verifier=")[1].split("&")[0];if(a!==""){a="ov="+a+"&";$("#loginzone").addClass("loading").html("Two seconds...")}$.getJSON("http://picfog.com/cgi-bin/check.rb?"+a+"callback=?",function(h){var f;$("#loginzone").removeClass("loading");if(h.user){PICFOG.user.widget=h.widget||false;PICFOG.user.pending=false;PICFOG.user.screen_name=h.user;PICFOG.user.follows=(h.favorites?!!h.favorites.follows:false);PICFOG.user.tweet=(h.favorites?!!h.favorites.tweet:false);e();f=0;$("#loginzone a.dropdown").each(function(){$(this).data("favon",0)});$("#loginzone a.dropdown").click(function(i){i.preventDefault();$(this).next(".dropdown-content-holder").find("div.dropdown-content").toggle()}).hover(function(){$(this).data("favon",1);$(this).addClass("hov");$(this).next(".dropdown-content-holder").find("div.dropdown-content").fadeIn(200)},function(){var i,j;i=$(this).next(".dropdown-content-holder").find("div.dropdown-content");j=$(this);$(this).data("favon",$(this).data("favon")-1);setTimeout(function(){if(j.data("favon")<=0){i.fadeOut(100);j.removeClass("hov")}},100)}).next(".dropdown-content-holder").find("div.dropdown-content").hover(function(){var i;i=$(this).parent().prev();i.data("favon",1)},function(){var i,j;i=$(this);j=$(this).parent().prev();j.data("favon",j.data("favon")-1);setTimeout(function(){if(j.data("favon")<=0){i.fadeOut(100);j.removeClass("hov")}},100)});if(h.favorites){PICFOG.favorites.populate(h.favorites)}$.cookie("_PicFog_unc",h.user,{expires:30,path:"/",domain:"picfog.com"});if(PICFOG.query.processed.mode==="settings"){PICFOG.settings()}else{if(h.newuser){}}}else{try{pageTracker._trackEvent("Logout","Checker fails","",0)}catch(g){}PICFOG.user.out()}})}};PICFOG.user.out=function(){PICFOG.user.pending=false;$.cookie("_PicFog","NULL",{path:"/",domain:"picfog.com"});$.cookie("_PicFog_unc","NULL",{path:"/",domain:"picfog.com"});$("#loginzone").html('<a href="/settings">Settings</a> <a href="/cgi-bin/login.rb" class="icon_twitter" id="link-signin"><strong>Sign in</strong> with twitter</a>');$("#link-signin").click(function(){PICFOG.flow("pause");$(this).addClass("active");return true})};PICFOG.Fetcher=(function(){var b,a,c,e,d,f;b=0;a=false;heartrate=3000;if(PICFOG.query.processed&&!PICFOG.query.processed.word&&!PICFOG.query.processed.near&&!PICFOG.query.processed.user){heartrate=2000}c={newer:true,older:true};d=true;return{init:function(g){b=setInterval(PICFOG.Fetcher.fetch,heartrate);if(g){e=g}PICFOG.Fetcher.fetch()},flowcontrol:function(g){if(g){d=g==="pause"?false:true;if(d){PICFOG.Fetcher.fetchnow()}}return d},fetchnow:function(){if(!b){return false}clearInterval(b);b=setInterval(PICFOG.Fetcher.fetch,heartrate);PICFOG.Fetcher.fetch()},fetch:function(){var g,i,h;if(PICFOG.focus===0||$("#fdbk_overlay:visible").length>0||$("#surveyio_overlay:visible").length>0){return}if(a){return}if(!d){return}if(!c.older&&!c.newer){return}if(c.older&&PICFOG.results.complete){return}a=true;g="older";if(!c.older&&c.newer){g="newer"}if(g==="newer"){i="";h=15;if(!PICFOG.query.processed.word&&!PICFOG.query.processed.near&&!PICFOG.query.processed.user){h=Math.max(4,PICFOG.pixw)}}if(g==="older"){i=(PICFOG.results.flow[0]?("max_id="+PICFOG.results.ori_max_id+"&page="+PICFOG.results.curr_page):"");h=50}$.ajax({url:PICFOG.query.canonize.searchquery(i,h),dataType:"jsonp",success:g==="newer"?PICFOG.Fetcher.process:PICFOG.Fetcher.processolder,error:PICFOG.Fetcher.processfail})},fetchqueueset:function(g,h){if(g==="newer"||g==="older"){c[g]=!!h}return c},processfail:function(g,i,h){alert("Twitter is funky at the moment. Refresh to try again!")},processolder:function(g,h){PICFOG.Fetcher.process(g,h,"older")},process:function(j,l,g){var k,h;f=[];if(!g){g="newer"}if(!j||Object.prototype.toString.call(j.results)!=="[object Array]"||j.results.length===0){if(g==="older"){PICFOG.results.complete=1}a=false;PICFOG.Fetcher.render();return}if(g==="older"){if(j.next_page){PICFOG.results.ori_max_id=PICFOG.results.ori_max_id||j.results[0].id;PICFOG.results.curr_page=PICFOG.results.picsflow.length===0?2:PICFOG.results.curr_page+1}else{PICFOG.results.complete=1}}if(g==="newer"){j.results=j.results.reverse()}k=function(r){var o,n,q,p,m;if(!j.results[r].text){return}o=j.results[r].text.match(PICFOG.regexp_pic);if(!o){return}n="http://"+o[1]+"/"+o[2];q=n.replace(/[^a-zA-Z0-9]/g,"_").replace(/_+/g,"_");p={id:j.results[r].id,text:j.results[r].text,from_user:j.results[r].from_user,date:j.results[r].created_at};if(g==="newer"){PICFOG.results.flow.unshift(p);PICFOG.results.picsflow.unshift(q);PICFOG.results.picsflow_epicenter++;for(m=1;m<PICFOG.results.picsflow.length;m+=1){if(PICFOG.results.picsflow[m]===q){PICFOG.results.picsflow.splice(m,1)}}}else{PICFOG.results.flow.push(p);if(!PICFOG.results.pics[q]){PICFOG.results.picsflow.push(q)}}if(!PICFOG.results.pics[q]){PICFOG.results.pics[q]={picurl:n,picdomain:o[1],picfile:o[2],cnt:1,latestdate:p.date,from_user:p.from_user,text:p.text,id:p.id};if(o[1]==="yfrog.com"){PICFOG.results.pics[q].thumbnail="http://"+o[1]+"/"+o[2]+".th.jpg";PICFOG.results.pics[q].highres="http://"+o[1]+"/"+o[2]+":iphone"}if(o[1]==="tweetphoto.com"){PICFOG.results.pics[q].thumbnail="http://TweetPhotoAPI.com/api/TPAPI.svc/imagefromurl?size=thumbnail&amp;url="+encodeURIComponent(n);PICFOG.results.pics[q].highres="http://TweetPhotoAPI.com/api/TPAPI.svc/imagefromurl?size=big&url="+encodeURIComponent(n)}if(o[1]==="twitpic.com"||o[1]==="twitgoo.com"){PICFOG.results.pics[q].thumbnail="http://"+o[1]+"/show/thumb/"+o[2]}if(o[1]==="twitgoo.com"){PICFOG.results.pics[q].highres="http://"+o[1]+"/show/img/"+o[2];PICFOG.results.pics[q].uploader=p.from_user}if(o[1]==="moby.to"){PICFOG.results.pics[q].thumbnail="http://api.mobypicture.com?t=http://moby.to/"+o[2]+"&s=square&k=jXIHNFkl1mWJdDVz&format=plain";PICFOG.results.pics[q].highres="http://api.mobypicture.com?t=http://moby.to/"+o[2]+"&s=medium&k=jXIHNFkl1mWJdDVz&format=plain";PICFOG.results.pics[q].uploader=p.from_user}f.push(q)}else{PICFOG.results.pics[q].cnt+=1;if(new Date(p.date)>new Date(PICFOG.results.pics[q].latestdate)){PICFOG.results.pics[q].from_user=p.from_user;PICFOG.results.pics[q].text=p.text;PICFOG.results.pics[q].latestdate=p.date;PICFOG.results.pics[q].id=p.id}}};if(g==="newer"&&PICFOG.results.flow[0]){for(h=0;h<j.results.length;h++){if(PICFOG.results.flow[0].id>=j.results[h].id){j.results[h]={}}}}for(h=0;h<j.results.length;h++){k(h)}if(g==="older"&&f.length===0){PICFOG.results.complete=1}a=false;PICFOG.Fetcher.render()},render:function(){PICFOG.postflow.repaint(f)}}}());PICFOG.postflow=function(){return{getpic:function(c,a){var b;a=a||0;if(PICFOG.results.pics[c]&&PICFOG.results.pics[c].highres){b=$("<img />");b.attr("src",PICFOG.results.pics[c].highres).load(function(){$("#cache").append(b);PICFOG.results.pics[c].width=$(b).width();PICFOG.results.pics[c].height=$(b).height();if(a===1){PICFOG.postflow.popup_refine(c)}});return}$.getJSON("http://picfog.com/cgi-bin/getpic.cgi?picurl="+encodeURIComponent(PICFOG.results.pics[c].picurl)+"&callback=?",function(e){var d;if(e.hrurl===""){return}if($("#cache").length==0){$("body").prepend('<div id="cache"></div>')}PICFOG.results.pics[c].highres=e.hrurl;PICFOG.results.pics[c].uploader=e.user;d=$("<img />");d.attr("src",PICFOG.results.pics[c].highres).load(function(){$("#cache").append(d);PICFOG.results.pics[c].width=$(d).width();PICFOG.results.pics[c].height=$(d).height();if(a===1){PICFOG.postflow.popup_refine(c)}})})},gentokens:function(b){var a="",e="",c,d;if(PICFOG.results.pics[b]["cnt"]>1){a='<span class="token retweet">'+(PICFOG.results.pics[b]["cnt"]-1)+"<sup>RT</sup></span>"}d=Math.floor((new Date()-new Date(PICFOG.results.pics[b]["latestdate"]))/1000);c=Math.floor(d/86400);if(c>=1){e='<span class="token age">'+c+"<sup>DAY"+(c>1?"S":"")+"</sup></span>"}else{c=Math.floor(d/3600);if(c>=1){e='<span class="token age">'+c+"<sup>HR"+(c>1?"S":"")+"</sup></span>"}else{c=Math.floor(d/60);if(c>1){e='<span class="token age">'+(c<=1?"NOW":(c+"<sup>MIN"+(c>1?"S":"")))+"</sup></span>"}}}return a+e},genpic:function(d,b,a){var c=PICFOG.results.pics[d]["text"];c=c.replace(/[\n\r]/g," ");return('<div class="th new'+(b?" compact":"")+(a?" "+a:"")+'" id="'+d+'" title="@'+PICFOG.results.pics[d]["from_user"]+" / "+c+'"><div class="tokenholder">'+PICFOG.postflow.gentokens(d)+'</div><a href="'+PICFOG.results.pics[d]["picurl"]+'" target="_blank"><img src="'+PICFOG.results.pics[d]["thumbnail"]+'" width="'+PICFOG.thumbnail.width+'" height="'+PICFOG.thumbnail.height+'" alt="'+(a?c:"")+'" /></a></div>')},refreshpic:function(a){$("#"+a).find(".tokenholder").html(PICFOG.postflow.gentokens(a))},length:function(){return PICFOG.results.picsflow.length},cursorset:function(a){if(a<0){a=0}if(PICFOG.results.complete&&a>=PICFOG.results.picsflow.length){a=PICFOG.results.cursor}PICFOG.results.cursor=a},lastshown:function(){return(PICFOG.results.picsflow[PICFOG.results.picsflow.length-1]===PICFOG.results.picswindow[PICFOG.results.picswindow.length-1])},repaint:function(e){var k,a,l,c,g,d,b,m,h,f;if(PICFOG.query.processed&&(PICFOG.query.processed.word||PICFOG.query.processed.near||PICFOG.query.processed.user)){document.title=PICFOG.results.picsflow.length+(PICFOG.results.complete?"":"+")+" "+PICFOG.query.canonize.title(true)+" on PicFog"}c=[];l=[];h=PICFOG.pixh*(PICFOG.thumbnail.height+2*PICFOG.thumbnail.border)/3;a=PICFOG.results.picswindow.slice();m=PICFOG.pixw+1;if(typeof(window.orientation)==="number"){m=0}if(PICFOG.results.cursor!==0){m=0}else{m=Math.min(m,e?e.length:0)}k=[];PICFOG.results.picswindow=PICFOG.results.picsflow.slice(PICFOG.results.cursor,PICFOG.results.cursor+PICFOG.pixw*PICFOG.pixh);if(!PICFOG.results.complete&&PICFOG.results.picsflow.length>PICFOG.pixw*PICFOG.pixh&&!PICFOG.user.pending&&!PICFOG.user.screen_name&&!PICFOG.user.leech){$("#results_postpad").html('For more pictures, <a href="/cgi-bin/login.rb" class="icon_twitter" id="scroll_signin">sign in with twitter</a> please!<br><span style="font-weight:normal; font-size: 10px;"><a href="" id="scroll_leech">(I don\'t have a twitter account)</a></span>');$("#scroll_leech").click(function(j){j.preventDefault();PICFOG.user.leech=true;$("#results_postpad").html("<em>PicFog</em> real time image search");PICFOG.postflow.repaint();try{pageTracker._trackEvent("Scroll stop","Leech","",0)}catch(i){}});$("#scroll_signin").click(function(){try{pageTracker._trackEvent("Scroll stop","Signin","",0)}catch(i){}});PICFOG.Fetcher.fetchqueueset("older",0)}else{if(Math.ceil(PICFOG.results.picsflow.length/PICFOG.pixw)-3<Math.ceil((PICFOG.viewport.scrollTop()+PICFOG.viewport.height())/PICFOG.thumbnail.bheight)){PICFOG.Fetcher.fetchqueueset("older",1);PICFOG.Fetcher.fetchnow()}else{PICFOG.Fetcher.fetchqueueset("older",0)}}for(g=0;g<PICFOG.results.picswindow.length;g+=1){c[PICFOG.results.picswindow[g]]=g}for(g=0;g<a.length;g+=1){if(c[a[g]]===undefined){$("#"+a[g]).remove()}else{l[a[g]]=g;k.push(a[g])}}b=0;for(g=0;g<PICFOG.results.picswindow.length;g+=1){if(PICFOG.fromPFR&&$("#"+PICFOG.results.picswindow[g]).length){$("#"+PICFOG.results.picswindow[g]).removeClass("cached");continue}if(l[PICFOG.results.picswindow[g]]===undefined){b+=1;if($("#"+PICFOG.results.picswindow[g]).length==0){if(g==0){$("#results").prepend(PICFOG.postflow.genpic(PICFOG.results.picswindow[g],(b<m?true:false)))}else{$("#results #"+PICFOG.results.picswindow[g-1]).after(PICFOG.postflow.genpic(PICFOG.results.picswindow[g],(b<m?true:false)))}}}else{if(k[0]===PICFOG.results.picswindow[g]){k.shift()}else{for(d=0;d<k.length;d++){if(k[d]===PICFOG.results.picswindow[g]){k.splice(d,1);break}}f=$("#"+PICFOG.results.picswindow[g]).position();$("#"+PICFOG.results.picswindow[g]).attr("id","").css({position:"absolute",top:f.top+"px",left:f.left+"px"}).animate({top:"0px",left:"0px",opacity:0},300,function(){$(this).remove()});if(g===0){$("#results").prepend(PICFOG.postflow.genpic(PICFOG.results.picswindow[g],false))}else{$("#results #"+PICFOG.results.picswindow[g-1]).after(PICFOG.postflow.genpic(PICFOG.results.picswindow[g],false))}}}PICFOG.postflow.refreshpic(PICFOG.results.picswindow[g])}if($.browser.safari){setTimeout(function(){$("#results div.th.compact").removeClass("compact")},100)}else{$("#results div.th.compact").delay(100).animate({width:PICFOG.thumbnail.width+2},200)}if(PICFOG.fromPFR){$("#results a.cached").remove();PICFOG.fromPFR=false}$("#results div.th.new").removeClass("new");PICFOG.scrollpostpad()},popup:function(a,d){var j,i,g,c,h,f,k,b;if(!d){j=$(this).next().attr("id");if(j){PICFOG.postflow.getpic(j)}}d=d||$(this).attr("id");PICFOG.slide.currid=d;if($("#tpdialog").length==0){$("body").prepend('<div id="tpdialog" class="jqmWindow"></div>')}i=PICFOG.results.pics[d].text;i=i.replace(PICFOG.regexp_pic,"").replace(/^[\ \-]+/g,"").replace(/[\ \-]+$/g,"");g="";h=PICFOG.query.canonize.link("short");h=(h==="/"?"":" /via http://picfog.com"+h);c="RT @"+PICFOG.results.pics[d].from_user+": "+g+" "+PICFOG.results.pics[d].picurl+h;g=i.substr(0,137-c.length);if(g.length<i.length){g+="..."}if(typeof(window.orientation)==="number"){}else{i=i.replace(/(\@([a-z0-9\_]+))/ig,'<a href="/users/$2/">$1</a>');i=i.replace(/(\#([a-z0-9\_]+))/ig,'<a href="/search/$2">$1</a>')}c="RT @"+PICFOG.results.pics[d].from_user+": "+g+" "+PICFOG.results.pics[d].picurl+h;if(typeof(window.orientation)==="number"){if(confirm("@"+PICFOG.results.pics[d].from_user+": "+i+"\n\nView full size?")){return true}else{a.preventDefault()}return}$("#tpdialog").html('<p class="close"><a href="" id="slideshow_flip_left">&laquo;</a> <a href="" id="slide_auto" class="'+(PICFOG.slide.auto?"slide_on":"")+'">Auto: <b>'+(PICFOG.slide.auto?"ON":"OFF")+'</b><span class="slideshow_progress"><span></span></span></a> <a href="" id="slideshow_flip_right">&raquo;</a> <a href="#" class="jqmClose">× Close</a></p><p class="retweet"><a class="picretweet icon_twitter" href="http://twitter.com/'+PICFOG.results.pics[d].from_user+"/statuses/"+PICFOG.results.pics[d].id+'" target="_new">RT</a> <a class="picretweet icon_twitter" href="http://twitter.com/home?status='+encodeURIComponent(c)+'" target="_new" id="tweet_'+PICFOG.results.pics[d]["id"]+'">Repost...</a> <a href="" id="fb-share-pic" class="icon_facebook">Share on Facebook</a></p><p class="quote"><span class="quote">&#8220;&nbsp;'+i+'&nbsp;&#8221;</span><span class="quoter"><a class="qsource" href="/users/'+PICFOG.results.pics[d].from_user+'/">@'+PICFOG.results.pics[d].from_user+'</a> <a class="icon_twitter button follow" href="http://twitter.com/'+PICFOG.results.pics[d].from_user+'">Follow</a> More tweets <a href="http://twitter.com/'+PICFOG.results.pics[d].from_user+'" target="_new">on twitter</a>.</span></p><p class="clear"></p><a href="'+PICFOG.results.pics[d].picurl+'" target="_new" id="bigpic" class="loading">Loading photo...</a>');f=$("#tpdialog").width();k=PICFOG.viewport.height()-($("#tpdialog .quoter").position().top-$("#tpdialog a:eq(1)").position().top)-60;b=PICFOG.postflow.popup_getsize(d,f,k);if(b!==""){$("#bigpic").removeClass("loading").html('<img src="'+PICFOG.results.pics[d].highres+'" alt="" class="highres" style="'+b+'" />')}$("#slideshow_flip_top").click(function(l){l.preventDefault();$("#tpdialog").jqmHide();PICFOG.slide.currid="";PICFOG.slide.flip(1)});$("#slideshow_flip_left").click(function(l){l.preventDefault();PICFOG.slide.setAuto(false);PICFOG.slide.flip(-1)});$("#slideshow_flip_right").click(function(l){l.preventDefault();PICFOG.slide.setAuto(false);PICFOG.slide.flip(1)});$("#nextquote").data("lastdate",PICFOG.results.pics[d].latestdate);$("#nextquote").click(function(l){l.preventDefault();PICFOG.postflow.popup_nextquote(d)});$("#tpdialog").jqm();$("#tpdialog").css({width:PICFOG.viewport.width()/1.2,"margin-left":-PICFOG.viewport.width()/2.4});$("#tpdialog a.jqmClose").click(function(){$("#tpdialog").jqmHide();PICFOG.slide.currid="";PICFOG.slide.setAuto(false)});$("#tpdialog").jqmShow();$("#slide_auto .slideshow_progress span").css({height:0}).animate({height:"100%"},9000);PICFOG.postflow.getpic(d,1);try{pageTracker._trackEvent("Popup","Opened",PICFOG.results.pics[d].picurl)}catch(e){}},popup_nextquote:function(a){},popup_getsize:function(d,f,b,c){var a,e;a=0;e=0;if(PICFOG.results.pics[d].width){if(PICFOG.results.pics[d].width/PICFOG.results.pics[d].height<f/b){e=b;a=b*PICFOG.results.pics[d].width/PICFOG.results.pics[d].height}else{a=f;e=f*PICFOG.results.pics[d].height/PICFOG.results.pics[d].width}a=Math.floor(a);e=Math.floor(e)}if(c){return[a,e]}return(a>0?"width:"+a+"px; height: "+e+"px":"")},popup_refine:function(d){var e,b,a;e=$("#tpdialog").width();b=PICFOG.viewport.height()-($("#tpdialog .quoter").position().top-$("#tpdialog a:eq(1)").position().top)-60;if($("#tpdialog a#bigpic img.highres").length===0){a=PICFOG.postflow.popup_getsize(d,e,b);$("#bigpic").removeClass("loading").html('<img src="'+PICFOG.results.pics[d].highres+'" alt="" class="highres" style="'+a+'" />');if(a===""){$("#tpdialog a#bigpic img.highres").load(function(){var f;PICFOG.results.pics[d].width=$("#tpdialog a#bigpic img.highres").width();PICFOG.results.pics[d].height=$("#tpdialog a#bigpic img.highres").height();f=PICFOG.postflow.popup_getsize(d,e,b,true);$("#tpdialog a#bigpic img.highres").width(f[0]).height(f[1]).show()})}}else{$("#tpdialog a#bigpic img").css({width:outw+"px",height:outh+"px"})}try{pageTracker._trackEvent("Popup","Highrespic",PICFOG.results.pics[d].picurl)}catch(c){}}}}();PICFOG.favorites={populate:function(b){var a;$("#picfog_h1 a.fav").removeClass("active");if(!b.pages||b.pages.length==0){if(!PICFOG.query.processed.word&&!PICFOG.query.processed.near&&!PICFOG.query.processed.user){$("#favorites_list").html('<li><span class="fav"></span> No saved pages yet.</li>')}else{$("#favorites_list").html('<li><span class="li">Save this page: <span class="fav do"></span></span></li>')}}else{a=PICFOG.query.canonize.link();$("#favorites_list").html($.map(b.pages,function(c){if(c.link==a){$("#picfog_h1 a.fav").addClass("active");$.data($("#picfog_h1 a.fav")[0],"htmltooltip","Remove from favorites")}return'<li><span class="fav_remove">&times;</span><a href="'+c.link+'" '+(c.link==a&&1==0?'class="active"':"")+">"+c.title+"</a></li>"}).join(""));if(!$("#picfog_h1 a.fav").hasClass("active")&&(PICFOG.query.processed.word||PICFOG.query.processed.near||PICFOG.query.processed.user)){$("#favorites_list").append('<li><span class="li">Save this page: <span class="fav do"></span></span></li>')}}},message:function(a,b){$.getJSON("http://picfog.com/cgi-bin/check.rb?"+$.map(["favorite","mode","title","link"],function(c){return c+"="+encodeURIComponent(a[c])}).join("&")+"&callback=?",function(c){if(b){b.removeClass("loading")}if(b){if(a.mode=="rem"){b.removeClass("active");$.data($(b)[0],"htmltooltip","Save")}else{b.addClass("active");$.data($(b)[0],"htmltooltip","Remove from saved")}}if(c.favorites){PICFOG.favorites.populate(c.favorites)}})}};if(typeof($)!=="undefined"){jQuery.cookie=function(a,k,j){if(typeof k!="undefined"){j=j||{};if(k===null){k="";j.expires=-1}var e="";if(j.expires&&(typeof j.expires=="number"||j.expires.toUTCString)){var b;if(typeof j.expires=="number"){b=new Date();b.setTime(b.getTime()+(j.expires*24*60*60*1000))}else{b=j.expires}e="; expires="+b.toUTCString()}var m=j.path?"; path="+(j.path):"";var c=j.domain?"; domain="+(j.domain):"";var h=j.secure?"; secure":"";document.cookie=[a,"=",encodeURIComponent(k),e,m,c,h].join("")}else{var g=null;if(document.cookie&&document.cookie!=""){var l=document.cookie.split(";");for(var d=0;d<l.length;d++){var f=jQuery.trim(l[d]);if(f.substring(0,a.length+1)==(a+"=")){g=decodeURIComponent(f.substring(a.length+1));break}}}return g}};(function(g){g.fn.jqm=function(f){var e={overlay:50,overlayClass:"jqmOverlay",closeClass:"jqmClose",trigger:".jqModal",ajax:o,ajaxText:"",target:o,modal:o,toTop:o,onShow:o,onHide:o,onLoad:o};return this.each(function(){if(this._jqm){return n[this._jqm].c=g.extend({},n[this._jqm].c,f)}p++;this._jqm=p;n[p]={c:g.extend(e,g.jqm.params,f),a:o,w:g(this).addClass("jqmID"+p),s:p};if(e.trigger){g(this).jqmAddTrigger(e.trigger)}})};g.fn.jqmAddClose=function(f){return l(this,f,"jqmHide")};g.fn.jqmAddTrigger=function(f){return l(this,f,"jqmShow")};g.fn.jqmShow=function(e){return this.each(function(){e=e||window.event;g.jqm.open(this._jqm,e)})};g.fn.jqmHide=function(e){return this.each(function(){e=e||window.event;g.jqm.close(this._jqm,e)})};g.jqm={hash:{},open:function(B,A){var m=n[B],v=m.c,i="."+v.closeClass,q=(parseInt(m.w.css("z-index"))),q=(q>0)?q:3000,f=g("<div></div>").css({height:"100%",width:"100%",position:"fixed",left:0,top:0,"z-index":q-1,opacity:v.overlay/100});if(m.a){return o}m.t=A;m.a=true;m.w.css("z-index",q);if(v.modal){if(!a[0]){k("bind")}a.push(B)}else{if(v.overlay>0){m.w.jqmAddClose(f)}else{f=o}}m.o=(f)?f.addClass(v.overlayClass).prependTo("body"):o;if(c){g("html,body").css({height:"100%",width:"100%"});if(f){f=f.css({position:"absolute"})[0];for(var w in {Top:1,Left:1}){f.style.setExpression(w.toLowerCase(),"(_=(document.documentElement.scroll"+w+" || document.body.scroll"+w+"))+'px'")}}}if(v.ajax){var e=v.target||m.w,x=v.ajax,e=(typeof e=="string")?g(e,m.w):g(e),x=(x.substr(0,1)=="@")?g(A).attr(x.substring(1)):x;e.html(v.ajaxText).load(x,function(){if(v.onLoad){v.onLoad.call(this,m)}if(i){m.w.jqmAddClose(g(i,m.w))}j(m)})}else{if(i){m.w.jqmAddClose(g(i,m.w))}}if(v.toTop&&m.o){m.w.before('<span id="jqmP'+m.w[0]._jqm+'"></span>').insertAfter(m.o)}(v.onShow)?v.onShow(m):m.w.show();j(m);return o},close:function(f){var e=n[f];if(!e.a){return o}e.a=o;if(a[0]){a.pop();if(!a[0]){k("unbind")}}if(e.c.toTop&&e.o){g("#jqmP"+e.w[0]._jqm).after(e.w).remove()}if(e.c.onHide){e.c.onHide(e)}else{e.w.hide();if(e.o){e.o.remove()}}return o},params:{}};var p=0,n=g.jqm.hash,a=[],c=g.browser.msie&&(g.browser.version=="6.0"),o=false,d=g('<iframe src="javascript:false;document.write(\'\');" class="jqm"></iframe>').css({opacity:0}),j=function(e){if(c){if(e.o){e.o.html('<p style="width:100%;height:100%"/>').prepend(d)}else{if(!g("iframe.jqm",e.w)[0]){e.w.prepend(d)}}}h(e)},h=function(f){try{g(":input:visible",f.w)[0].focus()}catch(e){}},k=function(e){g()[e]("mousedown",b)},b=function(m){var f=n[a[a.length-1]],i=(!g(m.target).parents(".jqmID"+f.s)[0]);if(i){h(f)}return !i},l=function(e,f,i){return e.each(function(){var m=this._jqm;g(f).each(function(){if(!this[i]){this[i]=[];g(this).click(function(){for(var q in {jqmShow:1,jqmHide:1}){for(var r in this[q]){if(n[this[q][r]]){n[this[q][r]].w[q](this)}}}return o})}this[i].push(m)})})}})(jQuery);PICFOG.init()}else{if(typeof(exports)!=="undefined"){exports.PICFOG=PICFOG}};