var currentSlide;var currentPage;function handle_links(){$("#nav a").click(function(){$("#nav a").removeClass("selected");$(this).addClass("selected");var a=$(this).attr("href");location.hash="#"+a;load_page(a);return false})}function load_page(a){$("#slideshow").fadeOut("slow",function(){$.post(a,{ajax:true},function(b){$("#slideshow").html(b);$("#slideshow").fadeIn("slow");prepare_slides();Cufon.replace("h1,p,h3",{hover:true})})})}function select_link(a){$("#nav a").each(function(){if($(this).attr("href")==a){$(this).addClass("selected")}else{$(this).removeClass("selected")}})}function prepare_slides(){var a=0;$("#gallery img").each(function(){$(this).css("position","absolute");if(a){$(this).css("display","none")}a++});currentSlide=$("#gallery img").first();$("#next").click(function(){var b=currentSlide.next();if(b.length){$("#prev").fadeIn();b.fadeIn();currentSlide=b;if(!b.next().length){$(this).fadeOut(300)}}});$("#prev").click(function(){var b=currentSlide.prev();if(b.length){$("#next").fadeIn(300);currentSlide.fadeOut(300);currentSlide=b;if(!b.prev().length){$(this).fadeOut(300)}}});currentPage=$(".page").first();$("#next-page").click(function(){var b=currentPage.next();if(b.length){$("#prev-page").fadeIn();currentPage.fadeOut(300,function(){b.fadeIn("slow");currentPage=b;if(!b.next().length){$("#next-page").fadeOut(300)}})}});$("#prev-page").click(function(){var b=currentPage.prev();if(b.length){$("#next-page").fadeIn(300);currentPage.fadeOut(300,function(){b.fadeIn(300);currentPage=b;if(!b.prev().length){$("#prev-page").fadeOut()}})}});$("#prev-page,#next-page,#prev,#next").hover(function(){if($(this).is(":visible")){$(this).fadeTo(100,0.3)}},function(){if($(this).is(":visible")){$(this).fadeTo(100,1)}});$(document).keyup(function(b){if(b.keyCode==39){if($("#next-page").length&&$("#next-page").is(":visible")){$("#next-page").click()}if($("#next").length&&$("#next").is(":visible")){$("#next").click()}}if(b.keyCode==37){if($("#prev-page").length&&$("#prev-page").is(":visible")){$("#prev-page").click()}if($("#prev").length&&$("#prev").is(":visible")){$("#prev").click()}}})}function check_hash(){var a=location.hash.replace("#","");if(a!=""){$("#slideshow").hide();load_page(a);select_link(a)}}$(document).ready(function(){Cufon.replace("h1,p",{hover:true});check_hash();prepare_slides();handle_links();$("#wrapper").fadeIn();setTimeout("set_time()",1000)});function set_time(){$("#time p").html(getCalendarDate()+"<br /> &mdash; "+getClockTime());Cufon.replace("#time p");setTimeout("set_time()",1000)}function getCalendarDate(){var b=new Array(13);b[0]="January";b[1]="February";b[2]="March";b[3]="April";b[4]="May";b[5]="June";b[6]="July";b[7]="August";b[8]="September";b[9]="October";b[10]="November";b[11]="December";var c=new Array(7);c[0]="Sunday";c[1]="Monday";c[2]="Tuesday";c[3]="Wednesday";c[4]="Thursday";c[5]="Friday";c[6]="Saturday";var a=new Date();var g=c[a.getDay()];var d=a.getMonth();var e=b[d];var i=a.getDate();var f=a.getYear();if(f<2000){f=f+1900}var h=g+" "+i+" "+e+", "+f;return h}function getClockTime(){var c=new Date();var a=c.getHours();var f=c.getMinutes();var b=c.getSeconds();var d="am";if(a>11){d="pm"}if(a>12){a=a-12}if(a==0){a=12}if(a<10){a="0"+a}if(f<10){f="0"+f}if(b<10){b="0"+b}var e=a+":"+f+":"+b+" "+d;return e};
