// JavaScript Document

//VARIABLES
var slideTime = 400;
var shortHeight = "130";


$(document).ready(function() {
						   
	$('#featLeft').hover(function() {
		if(typeof document.body.style.maxHeight != "undefined") {
			$('#btn_play').css({ backgroundPosition: '115px 0'  });
		}
	}, function() {
		if(typeof document.body.style.maxHeight != "undefined") {
			$('#btn_play').css({ backgroundPosition: '0 0'  });
		}
	});
	
	
	//SET ACTIVE STATE
	$('.active').children('a').css({ backgroundPosition: '0 -32px' });

	
	
	//DROPDOWN
	$('.subNav').hide();
	
	$('#mainNav ul').children('li').hover(function() {
		if (!$(this).hasClass('active')) {
			$(this).children('a').css({ backgroundPosition: '0 -32px' });	
		}
		
		//SHOW DROPDOWN
		$(this).children('.subNav').slideDown(400);
	}, function() {
		if (!$(this).hasClass('active')) {
			$(this).children('a').stop(true, true).css({ backgroundPosition: '0 0' });	
		}
		
		//HIDE DROPDOWN
		$(this).children('.subNav').stop(true, true).slideUp(400);
	});
	
	
	$('.subNav ul').children('li').hover(function() {
		thisIndx = $(this).parent('ul').children('li').index($(this));
		totalItems = $(this).parent('ul').children('li').length - 1;
		
		
		if (thisIndx == 0) {
			$(this).css({ backgroundPosition: '0 -31px' });		
		}else if (thisIndx == totalItems) {
			$(this).css({ backgroundPosition: '0 -40px' });		
		}else {
			$(this).css({ backgroundPosition: '0 -25px' });	
		}
	}, function() {
		$(this).css({ backgroundPosition: '0 0' });		
	});
	
	
	
	
	/* CASE STUDY */
	$('.csMore').hide();
	
	$('.csNav1').bind({
		click: function() {
			if (!$(this).hasClass('csMore')) {
				$(this).parent().parent().parent().prev('.csMore').slideDown(400);
				$(this).addClass('csMore');	
			}else {
				$(this).parent().parent().parent().prev('.csMore').slideUp(400);
				$(this).removeClass('csMore');		
			}
			
			
			return false;
		},
		mouseenter: function() {
			if (!$(this).hasClass('csMore')) {
				$(this).css({ backgroundPosition: '0 -32px' });	
			}else {
				$(this).css({ backgroundPosition: '0 -96px' });		
			}
		},
		mouseleave: function(){
			if (!$(this).hasClass('csMore')) {
				$(this).css({ backgroundPosition: '0 0' });	
			}else {
				$(this).css({ backgroundPosition: '0 -64px' });		
			}	
		}
	});
});
	
	
