
//=======================================================//
// nav_overlay menu structure //
//=======================================================//
$(function() {
	var $oe_menu		= $('#oe_menu');
	var $oe_menu_items	= $oe_menu.children('li');
	var $oe_overlay		= $('#oe_overlay');

	$oe_menu_items.bind('mouseenter',function(){
		var $this = $(this);
		$this.addClass('slided selected');
		$this.children('div').css('z-index','9999').stop(true,true).slideDown(200,function(){
			$oe_menu_items.not('.slided').children('div').hide();
			$this.removeClass('slided');
		});
	}).bind('mouseleave',function(){
		var $this = $(this);
		$this.removeClass('selected').children('div').css('z-index','1');
	});

	$oe_menu.bind('mouseenter',function(){
		var $this = $(this);
		$oe_overlay.stop(true,true).fadeTo(200, 0.6);
		$this.addClass('hovered');
	}).bind('mouseleave',function(){
		var $this = $(this);
		$this.removeClass('hovered');
		$oe_overlay.stop(true,true).fadeTo(200, 0);
		$oe_menu_items.children('div').hide();
	})
});


//=======================================================//
// accordion init //
//=======================================================//

$(function() {
	$('#accordion > li').hover(
		function () {
			var $this = $(this);
			$this.stop().animate({'width':'380px'},500);
			$('.heading',$this).stop(true,true).fadeOut();
			$('.bgDescription',$this).stop(true,true).slideDown(500);
			$('.description',$this).stop(true,true).fadeIn();
		},
		function () {
			var $this = $(this);
			$this.stop().animate({'width':'101px'},1000);
			$('.heading',$this).stop(true,true).fadeIn();
			$('.description',$this).stop(true,true).fadeOut(500);
			$('.bgDescription',$this).stop(true,true).slideUp(700);
		}
	);
});

//=======================================================//
// slideOut init //
//=======================================================//


$(function(){
	$('.slideout').tabSlideOut({
		tabHandle: '.handle',                     //class of the element that will become your tab
		pathToTabImage: 'images/tab_side.png', //path to the image for the tab //Optionally can be set using css
		imageHeight: '100px',                     //height of tab image           //Optionally can be set using css
		imageWidth: '24px',                       //width of tab image            //Optionally can be set using css
		tabLocation: 'left',                      //side of screen where tab lives, top, right, bottom, or left
		speed: 300,                               //speed of animation
		action: 'click',                          //options: 'click' or 'hover', action to trigger animation
		topPos: '185px',                          //position from the top/ use if tabLocation is left or right
		leftPos: '20px',                          //position from left/ use if tabLocation is bottom or top
		fixedPosition: true                      //options: true makes it stick(fixed position) on scroll
	});

});


//=======================================================//
// div content onChange //
//=======================================================//

$(document).ready(function() {

	//Default Action
	$(".tab_content").hide(); //Hide all content
	$("ul.tabs li:first").addClass("active").show(); //Activate first tab
	$(".tab_content:first").show(); //Show first tab content
	
	//On Click Event
	$("ul.tabs li").click(function() {
		$("ul.tabs li").removeClass("active"); //Remove any "active" class
		$(this).addClass("active"); //Add "active" class to selected tab
		$(".tab_content").hide(); //Hide all tab content
		var activeTab = $(this).find("a").attr("href"); //Find the rel attribute value to identify the active tab + content
		$(activeTab).fadeIn(); //Fade in the active content
		return false;
	});

});
