
/* Link Nudge */

$.fn.nudge = function(params) {
	//set default parameters
	params = $.extend({
		amount: 8,				//amount of pixels to pad / marginize
		duration: 300,			//amount of milliseconds to take
		property: 'margin', 	//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 $t = $(this);
		var $p = params;
		var dir = $p.direction;
		var prop = $p.property + dir.substring(0,1).toUpperCase() + dir.substring(1,dir.length);
		var initialValue = $t.css(prop);
		/* fx */
		var go = {}; go[prop] = parseInt($p.amount) + parseInt(initialValue);
		var bk = {}; bk[prop] = initialValue;
		
		//Proceed to nudge on hover
		$t.hover(function() {
					$t.stop().animate(go, $p.duration, '', $p.toCallback);
				}, function() {
					$t.stop().animate(bk, $p.duration, '', $p.fromCallback);
				});
	});
	return this;
};
$(document).ready(function() {
	$('#Header #Submenu ul li a').nudge();
});

$(document).ready(function() {
	$('#Submenu ul li a').mouseover(function(){
		switch_tabs($(this));
	});
	switch_tabs($('.defaulttab'));
});
function switch_tabs(obj) {
	$('.TabContent').hide();
	$('.tabs a').removeClass("selected");
	var id = obj.attr("rel");
	$('#'+id).show();
	obj.addClass("selected");
}
