$(function(){
	
	$('.intro').mouseenter(function(){
		$(this).find('a img.image').css('background-color','#e8bd96');
	}).mouseleave(function(){
		if($(this).hasClass('active')){
			$(this).find('a img.image').css('background-color','#e8bd96');
		}else{
			$(this).find('a img.image').css('background-color','#FFF');
		}	
	}).click(function(){
		$('.content div.intro').removeClass('active');
		if($(this).not('.active')){
			$(this).addClass('active');
		}
	});
	
	$('.restaurante .menu-entradas').fadeIn('slow');
	$('a[name="entradas"]').addClass('active');
	
	$('.barra-menu > div').fadeOut('slow');
	$('.barra-menu div:eq(0)').fadeIn('slow');
	
	$('.terraza-menu > div').fadeOut('slow');
	$('.terraza-menu div:eq(0)').fadeIn('slow');
	
	$('.restaurante-menu > div').fadeOut('slow');
	$('.restaurante-menu div:eq(0)').fadeIn('slow');
});


//my tabs
function tabThis(where,what,who){
	if($(where+' div').not(what) && $(where+' div').not('[id^=\'pagination\']')){
		$(where+' div').fadeOut('fast');
		$('ul[class^=menu-]').fadeOut('fast');
		$('.intro .image').css('background','#FFF');
	}	
	if($(where+' ul[class^=menu-]').not(what)){
		$(where+' ul[class^=menu-]').fadeOut('fast');
	}
	
	if($(where +' '+ what + ' ul[class^=menu-]:eq(0)').is(':hidden')){
		$(where +' '+ what + ' ul[class^=menu-]:eq(0)').fadeIn('slow');
	}
	
	$(where+' a').removeClass('active');
		
	$(where +' '+ what).fadeIn('slow');
	
	$('#'+where.replace('.','')+'-intro .image').css('background','#e8bd96');
	$('#'+what.replace('.','')+'-intro .image').css('background','#e8bd96');
	
	$(where +' ul.submenu li:first-child a').addClass('active');
	
	if($(where+' a').is('[name="'+who+'"]')){
		$(where +' ul.submenu li:first-child a').removeClass('active');
		$(where+' a[name="'+who+'"]').addClass('active');
	}
	
}
