//Cufon
Cufon.replace('h3');
Cufon.replace('h1');

// Co-workers Picture
$(document).ready(function () {
	
	// Get all the thumbnail
	$('#coworkers li').mouseenter(function(e) {

		// Calculate the position of the image tooltip


		// Set the z-index of the current item, 
		// make sure it's greater than the rest of thumbnail items
		// Set the position and display the image tooltip
		$(this).css('z-index','15')
		.children("div.tooltip")
		.css({'top': -4,'left':-144,'display':'block'});
		
	}).mousemove(function(e) {
		
		// Calculate the position of the image tooltip			

		
		// This line causes the tooltip will follow the mouse pointer
		$(this).children("div.tooltip").css({'top': y + 10,'left': x + 20});
		
	}).mouseleave(function() {
		
		// Reset the z-index and hide the image tooltip 
		$(this).css('z-index','1')
		.children("div.tooltip")
		.animate({"opacity": "hide"}, "fast");
	});

});

//  Position of container

(function ($) {
$.fn.vAlign = function() {
	return this.each(function(i){
	var h = $(this).height();
	var oh = $(this).outerHeight();
	var mt = (h + (oh - h)) / 2;	
	$(this).css("margin-top", "-" + mt + "px");	
	$(this).css("top", "50%");
	$(this).css("position", "absolute");	
	});	
};
})(jQuery);

(function ($) {
$.fn.hAlign = function() {
	return this.each(function(i){
	var w = $(this).width();
	var ow = $(this).outerWidth();	
	var ml = (w + (ow - w)) / 2;	
	$(this).css("margin-left", "-" + ml + "px");
	$(this).css("left", "50%");
	$(this).css("position", "absolute");
	});
};
})(jQuery);

$(document).ready(function() {
	$("#wrapper").vAlign();
	$("#wrapper").hAlign();
});

//
$(document).ready(function() {
    var hide = false;
    $("#bird-link-top").hover(function(){
        if (hide) clearTimeout(hide);
        $("#bird-quote-top").fadeIn();
    }, function() {
        hide = setTimeout(function() {$("#bird-quote-top").fadeOut("slow");}, 250);
    });
    $("#bird-quote-top").hover(function(){
        if (hide) clearTimeout(hide);
    }, function() {
        hide = setTimeout(function() {$("#bird-quote-top").fadeOut("slow");}, 250);
    });
});