var feeds=new Array();var currentFeedTimestamp;var noPush=false;var skipRemove=false;var feedUrl="http://vitochin.blogspot.com/feeds/posts/default";function putFeedInto(a){var c="<br><div id='attention'>☃<br><div class = 'back'>~ <span id = 'latestlink'>latest</span> ~</span></div>";if(a=="leftbar"){currentFeedTimestamp=Date.parse(currentFeedTimestamp).addHours(-1).toString("yyyy-MM-ddTHH:mm:ss");$.getJSON(feedUrl+"?max-results=1&orderby=published&published-max="+currentFeedTimestamp+"&alt=json-in-script&jsoncallback=?");if(feeds.length==0){navigationBar("#rightbar");skipRemove=true}}else{if(a=="rightbar"){feeds.pop();var d=feeds.pop();var b=d;currentFeedTimestamp=Date.parse(b).addHours(1).toString("yyyy-MM-ddTHH:mm:ss");if(feeds.length==0){c=""}$.getJSON(feedUrl+"?max-results=1&orderby=published&published-max="+currentFeedTimestamp+"&alt=json-in-script&jsoncallback=?")}else{if(a=="back"){noPush=true;if(currentFeedTimestamp!=null){if(currentFeedTimestamp.substring(0,1)=="#"){currentFeedTimestamp=currentFeedTimestamp.substring(1)}if(feeds.length==1){c=""}currentFeedTimestamp=Date.parse(currentFeedTimestamp).addHours(1).toString("yyyy-MM-ddTHH:mm:ss");$.getJSON(feedUrl+"?max-results=1&orderby=published&published-max="+currentFeedTimestamp+"&alt=json-in-script&jsoncallback=?")}else{$.getJSON(feedUrl+"?max-results=1&alt=json-in-script&jsoncallback=?")}}else{feeds=[];c="";$.getJSON(feedUrl+"?max-results=1&alt=json-in-script&jsoncallback=?")}}}gdata={io:{handleScriptLoaded:function(h){var e="<h2>"+h.feed.entry[0].title.$t+"</h2>";publishedDate=Date.parse(h.feed.entry[0].published.$t.substr(0,19)).toString("dd MMMM yyyy");$(this).css("color","black");publishedDate="<span class='publishedDate'>Published: "+publishedDate+"</span>";var f=h.feed.entry[0].content.$t;var g="";if(h.feed.entry[0].link[1].title!="0 Comments"){g="<br><a href='"+h.feed.entry[0].link[0].href+"'>Comments</a>"}$("#main").html("<div id='feed'>"+e+publishedDate+f+g+c+"</div>");refreshHeight();backButton("#latestlink");if(noPush==false){feeds.push(h.feed.entry[0].published.$t.substr(0,h.feed.entry[0].published.$t.search(/\./)))}else{noPush=false}currentFeedTimestamp=h.feed.entry[0].published.$t.substr(0,h.feed.entry[0].published.$t.search(/\./));window.location.hash=currentFeedTimestamp;navigationBar("#leftbar");navigationBar("#rightbar");if(currentFeedTimestamp=="2007-03-03T10:26:00"){removeNavigationBar("#leftbar")}if(feeds.length>1){navigationBar("#rightbar")}else{if(skipRemove==true){skipRemove=false}else{removeNavigationBar("#rightbar")}}}}}}function loadContent(a){$.post("contents/"+a+".html",{},function(c){var b="<div id='attention'>☃<br><div class = 'back'>~ <span id = 'backlink'>blog</span> ~</span></div>";$("#main").html(c+b);refreshHeight();backButton("#backlink");removeNavigationBar("#leftbar");removeNavigationBar("#rightbar");window.location.hash=a})}$(document).ready(function(){navigationBar("#leftbar");navigationBar("#rightbar");if(location.hash==""){putFeedInto()}else{if(location.hash.match(/[a-z]/)!=null){loadContent(location.hash.substring(1))}else{currentFeedTimestamp=location.hash;putFeedInto("back")}}menuBar()});function refreshHeight(){var a=($("#main").height()+parseInt($("#thebody #main").css("padding-bottom")))/2;$("#leftbar").height(a).css("padding-top",a);$("#rightbar").height(a).css("padding-top",a)}function navigationBar(a){$(a).unbind("click").unbind("mouseover").unbind("mouseout");linkize(a);$(a).click(function(){putFeedInto($(this).attr("id"))});$(a).css({cursor:"pointer",opacity:1})}function menuBar(){var a=new Array(".menuitem");for(key in a){linkize(a[key]);$(a[key]).click(function(){loadContent($(this).attr("id"))})}}function backButton(a){var b=new Array(a);for(key in b){$(b[key]).unbind("click").unbind("mouseover").unbind("mouseout");linkize(b[key]);$(b[key]).click(function(){if(a=="#latestlink"){putFeedInto()}else{putFeedInto("back")}})}}function linkize(a){$(a).mouseover(function(){$(this).css("color","green")}).mouseout(function(){$(this).css("color","black")})}function removeNavigationBar(a){$(a).css({cursor:"default",opacity:0});$(a).unbind("click")};