$(document).ready(function() { 

	$('#leftNavSub').hide();
	$('#leftNavSub').css('margin-left','-300px');
	$('#leftNavigation').css('width', '25px');
	
	if($.cookie('navExpandCount') == "NaN") {		
		var navExpandCount = 0;
	} else {
		var navExpandCount = parseInt($.cookie('navExpandCount'));
	}	

   if (navExpandCount <=1) {
       leftNavOver();
       setTimeout(leftNavOut, 4000);
   }
   navExpandCount++;
   
   $.cookie('navExpandCount', navExpandCount, { path: '/' });  
	
	function leftNavOver(){
		$('#leftNavigation').css('width', '254px');
		$('#leftNavSub').show();
		$('#leftNavSub').stop().animate({'marginLeft':'-1px'},600);
	
		$('#leftNavSub .car').each(function(i){
			if ($(this).hasClass("johncooperworks"))
				$(this).addClass('flames');
				
			$(this).css('margin-left', -200);
			$(this).stop().delay(i*100).animate({'marginLeft':'0px'},600);
		});
	}

	function leftNavOut(){
		$('#leftNavSub .car').each(function(i){
			$(this).stop().delay(i*100).animate({'marginLeft':'-200px'},600 );
		}); 
		$('#leftNavSub').stop().animate({'marginLeft':'-300px'},600);		
		setTimeout (resetSize, 600);
	}
	
	function resetSize() {
		$('#leftNavigation').css('width', '25px');
	}

	var lnConfig = {    
		sensitivity: 2,  
		interval: 100,  
		over: leftNavOver,     
		timeout: 700,
		out: leftNavOut 
	};

	$("#leftNavigation").hoverIntent(lnConfig);

});

