//tab effects

var TabbedContent = {
	init: function() {	
		$(".tab_item").mouseover(function() {
		
			var background = $(this).parent().find(".moving_bg");
			
			$(background).stop().animate({
				left: $(this).position()['left']
			}, {
				duration: 300
			});
			
			TabbedContent.slideContent($(this));
			
		});
	},
	
	slideContent: function(obj) {
		
		var margin = $(obj).parent().parent().find(".slide_content").width();
		margin = margin * ($(obj).prevAll().size() - 1);
		margin = margin * -1;
		
		$(obj).parent().parent().find(".tabslider").stop().animate({
			marginLeft: margin + "px"
		}, {
			duration: 300
		});
	}
}

$(document).ready(function() {
	TabbedContent.init();
});



/*
 * 	GARAGEDOOR MENU 
 * 	A Javascript jQuery script by Gaya Kessler
 * 	Version 1.0
 * 	Date: 08-04-09
 * 
 */

var GarageDoor = {
	
	scrollY: 0,
	scrollX: 0,
	
	setBindings: function(id) {
		$("#" + id + " .mouse").each(function(i){
			$(this).bind("mouseenter", function(e){
				GarageDoor.hideDoor(this);
			});
			$(this).bind("mouseleave", function(e){
				GarageDoor.showDoor(this);
			});
			
			$(this).bind("click", function(e){
				window.location = this.parentNode.title;
			});
		});
	},
	
	hideDoor: function(obj) {
		var xs = GarageDoor.scrollX;
		var ys = GarageDoor.scrollY;
		
		$(obj).parent().find(".overlay").each(function(i) {
			$(this).stop().animate({
				marginTop: ys + "px"
			}, 200);
		});
	},
	
	showDoor: function(obj) {		
		$(obj).parent().find(".overlay").each(function(i) {
			$(this).stop().animate({
				marginTop: "0px"
			}, 500);
		});
	}
}