$(document).ready( function () {
 
	$(document.body).addClass('js');
	
	$('#landing .nav li a.blog').hover (
		function () {$(this).stop().animate({ height: '265', lineHeight: '265' }, 250);},
		function () {$(this).stop().animate({ height: '215', lineHeight: '215' }, 250);}
	);
	$('#landing .nav li a.work').hover (
		function () {$(this).stop().animate({ height: '265', lineHeight: '265' }, 250);},
		function () {$(this).stop().animate({ height: '215', lineHeight: '215' }, 250);}
	);
	$('#landing .nav li a.photo').hover (
		function () {$(this).stop().animate({ height: '265', lineHeight: '265' }, 250);},
		function () {$(this).stop().animate({ height: '215', lineHeight: '215' }, 250);}
	);
	$('#landing .nav li a.info').hover (
		function () {$(this).stop().animate({ height: '265', lineHeight: '265' }, 250);},
		function () {$(this).stop().animate({ height: '215', lineHeight: '215' }, 250);}
	);

	Cufon('.gbold', { hover: true, fontFamily: 'gbold' });
	Cufon('.gthin', { hover: true, fontFamily: 'gthin' });
  Cufon.now();
	
	$(".flickr li").each(function(i, o){

  		if (i == 2 || i == 5 || i == 8) {
  			$(this).addClass('last');
  		}
  });
  
  $("ul.flickr li a").hover(function(){
    $(this).children('span').stop().animate({ bottom: "0", opacity: "0.9" }, 400 );
  }, function() {
    $(this).children('span').stop().animate({ bottom: "58px", opacity: "1" }, 200 );
  });

  $("#photobar ul.photos li a").hover(function(){
    $(this).children('.date').stop().animate({ top: "0", opacity: "0.9" }, 400 );
  }, function() {
    var photoheight = $(this).children('.date').height();
    $(this).children('.date').stop().animate({ top: "-" + (photoheight - 2), opacity: "1" }, 200 );
  });
  
  $("#work ul#workgrid li a").hover(function(){
    $(this).children('.title').stop().animate({ bottom: "0", opacity: "0.9" }, 400 );
  }, function() {
    $(this).children('.title').stop().animate({ bottom: "154px", opacity: "1" }, 400);
  });
  
});

function jsonFlickrApi(rsp) {
 if (rsp.stat != "ok"){
  return;
 }
 
 var s = "";
 
 for (var i=0; i < 9; i++) {
  photo = rsp.photos.photo[ i ];
  
  s_url = "http://farm" + photo.farm + 
  ".static.flickr.com/" + photo.server + "/" + 
  photo.id + "_" + photo.secret + "_" + "s.jpg";
    
  p_url = "http://www.flickr.com/photos/" + 
  photo.owner + "/" + photo.id;
  
  s +=  '<li><a onclick="window.open(this.href); return false;" class="photo" href="' + p_url + '">' + '<img alt="'+ 
  photo.title + '"src="' + s_url + '" width="60" height="60"/>' + '<span>' + photo.title + '</span></a>';
 }
 document.writeln(s);
}