$().ready(function(){init_timeline()});function toggle_category(){$('.overlay').hide();var cat="li."+$(this).attr('class');$('span',this).toggleClass('on');$(cat,'#timeline').toggle();return false}function build_popups(){$('.dialog').addClass('overlay').hide();$('.overlay h3').append('<span/>').click(hide_popup);$('.overlay p.top a').text('Close').attr('href','#').click(hide_popup);$('.overlay .content a.popup').click(open_popup)}function open_popup(){$('.overlay').hide();var href=$(this).attr('href').split('#')[1];href='#'+href;$(this).addClass('popup-visited');var $this=$('a[href='+href+']');var LI_position=$this.parent('li').position();var position={};position.left=64;position.top=LI_position.top+55;$(href).css(position).show();return false}function hide_popup(){$(this).parents('.overlay').hide();return false}function init_visited_links(VISITED_POPUPS){if(VISITED_POPUPS){$('.dialog a.photo').each(function(){if(VISITED_POPUPS[this.hash.replace('#','')]===true){$(this).addClass('photo-visited')}});$('.dialog a.popup').each(function(){if(VISITED_POPUPS[this.hash.replace('#','')]===true){$(this).addClass('popup-visited')}})}}function init_timeline(){var VISITED_POPUPS=$.parseJSON($.cookie('thestoryofindia.VISITED_POPUPS'));if(VISITED_POPUPS===null){VISITED_POPUPS={}}init_visited_links(VISITED_POPUPS);build_popups();$('#timeline a.more').click(open_popup);$('#episodes dl').prepend('<dt>Display (click to hide/unhide): </dt>');$('#episodes dd').css('cursor','pointer').click(toggle_category).find('span').addClass('on');$('#episodes,#timeline').syncHeight();if(location.hash){$('#timeline a.more[href='+location.hash+']').click();return false}}(function($){$.fn.syncHeight=function(settings){var max=0;var browser_id=0;var property=[['min-height','0px'],['height','1%']];if($.browser.msie&&$.browser.version<7){browser_id=1}$(this).each(function(){$(this).css(property[browser_id][0],property[browser_id][1]);var val=$(this).height();if(val>max){max=val}});$(this).each(function(){$(this).css(property[browser_id][0],max+'px')});return this}})(jQuery);