// Homepage Images
$(document).ready(function(){
	$("#imageWrapper div a").hover(function(){
		$("img", this).stop().animate({top:"-299px"},{queue:false,duration:250});
	}, function() {
		$("img", this).stop().animate({top:"0px"},{queue:false,duration:250});
	});
});

// Tooltip
this.tooltip = function(){			
xOffset = 60;
yOffset = 20;		
// these 2 variable determine popup's distance from the cursor
// you might want to adjust to get the right result				
$("a.tooltip").hover(function(e){											  
this.t = this.title;
this.title = "";									  
$("body").append("<p id='tooltip'>"+ this.t +"</p>");
$("#tooltip")
.css("top",(e.pageY - xOffset) + "px")
.css("left",(e.pageX + yOffset) + "px")
.fadeIn("fast");		
},

function(){
this.title = this.t;		
$("#tooltip").remove();
});	
$("a.tooltip").mousemove(function(e){
$("#tooltip")
.css("top",(e.pageY - xOffset) + "px")
.css("left",(e.pageX + yOffset) + "px");
});			
};

// Tooltip
$(document).ready(function(){
tooltip();
});

// Fade in
$(document).ready(function() {
$( '#content' ).fadeIn('1000');
$( '.post' ).fadeIn('1000');		
$( '.page' ).fadeIn('1000');
});

// Scroll
$(document).ready(function(){
jQuery.localScroll();
});

// Link Nudge
$(document).ready(function() {

$('.post ul li a').nudge();
$('#sidebar li a').nudge();
$('#footer ul li a').nudge();
	
});

jQuery.fn.nudge = function(params) {
	//set default parameters
	params = jQuery.extend({
		amount: 10,				//amount of pixels to pad / marginize
		duration: 300,			//amount of milliseconds to take
		property: 'padding', 	//the property to animate (could also use margin)
		direction: 'left',		//direction to animate (could also use right)
		toCallback: function() {},	//function to execute when MO animation completes
		fromCallback: function() {}	//function to execute when MOut animation completes
	}, params);
	//For every element meant to nudge...
	this.each(function() {
		//variables
		var jQueryt = jQuery(this);
		var jQueryp = params;
		var dir = jQueryp.direction;
		var prop = jQueryp.property + dir.substring(0,1).toUpperCase() + dir.substring(1,dir.length);
		var initialValue = jQueryt.css(prop);
		/* fx */
		var go = {}; go[prop] = parseInt(jQueryp.amount) + parseInt(initialValue);
		var bk = {}; bk[prop] = initialValue;
		
		//Proceed to nudge on hover
		jQueryt.hover(function() {
					jQueryt.stop().animate(go, jQueryp.duration, '', jQueryp.toCallback);
				}, function() {
					jQueryt.stop().animate(bk, jQueryp.duration, '', jQueryp.fromCallback);
				});
	});
	return this;
};

// Colorbox
$(document).ready(function(){
$(".zoom").colorbox({maxWidth:"80%", maxHeight:"80%"});

});

