var interface = {
	UIHoverDisplay: function(hoverState,id){
		if(hoverState)
		{
			$('#swatch_'+id+' a').stop();
			$('#swatch_'+id+' a').animate({opacity: 0.0},700);
			$('#nav_'+id+' a').addClass('hover');
		}
		else
		{
			$('#swatch_'+id+' a').stop();
			$('#swatch_'+id+' a').animate({opacity: 1.0},700);
			$('#nav_'+id+' a').removeClass('hover');
		}
	},
	hookSwatchWithNav: function(){
		$('#nav_swatches li a, #navigation li a').hover(
			function(){
				interface.navOnHover($(this).parent());
			},
			function(){
				interface.navOffHover($(this).parent());
			}
		);
	},
	navOnHover: function(listItem){
		var listItemId = listItem.attr('id'); 
		var id = listItemId.replace("swatch_","").replace("nav_","");
		interface.UIHoverDisplay(true,id);
	},
	navOffHover: function(listItem){
		var listItemId = listItem.attr('id'); 
		var id = listItemId.replace("swatch_","").replace("nav_","");
		interface.UIHoverDisplay(false,id);
	}
}

jQuery(document).ready(function(){
	interface.hookSwatchWithNav();
});