
$(document).ready(function(){


//<----SUBNAV DROPDOWN<----//

var dropdown = "up";

$("#navigation").mouseleave(function () {
	//alert("out");
	var $nav_bar = $('#nav_bar');
	$nav_bar.fadeOut(800);
});

$("#Intuos_link").click(function () {
	if(dropdown == "up"){
		$("#dropdown").slideDown("slow");
		dropdown = "down";
	}else if(dropdown == "down"){
		$("#dropdown").slideUp("slow");
		dropdown = "up";		
	}
});

$('#dropdown li img').hover(function(){
	var $this = $(this);
	$this.fadeOut(400);
});

$('#dropdown li').mouseleave(function(){
	$('#dropdown img').fadeIn(400);
});


//<----NAVIGATION SLIDER<----//

	var $nav_bar = $('#nav_bar'); // to avoid having to go through the DOM each time to find the element
	$('#navigation li').hover(function(){
		$nav_bar.fadeIn({ duration: 600, queue: false });
		var $this = $(this);
		var $linkWidth = $this.width();
		$nav_bar.animate({ "left": ($this.position().left) }, 300, "linear", null);  
		$nav_bar.animate({width:$linkWidth},{ duration: 300, queue: false });		
		$nav_bar.height(2);
	});

});

function updateLocaleFromFlash(lang){
	switch (lang)
	{
	case 0:
		var locale = 'en';
	    $.cookie('locale', locale);
	   	//window.location.reload();
	  break;
	case 1:
		var locale = 'fr';
	    $.cookie('locale', locale);
	    //window.location.reload();
	  break;
	case 2:
		var locale = 'es';
	    $.cookie('locale', locale);
	    //window.location.reload();
	  break;
	case 3:
		var locale = 'pt';
	    $.cookie('locale', locale);
	    //window.location.reload();
	  break;
	default:
		var locale = 'en';
	    $.cookie('locale', locale);
	    window.location.reload();
	}

}


	



