$(document).ready(function(){	
	$('header .step').click( function (){
			$('.step').removeClass('active');
			$(this).addClass('active');
			
			thisclass = $(this).find('a').attr('class');
			thisheight = $('#slider .' + thisclass).height();
			
			if (!$('#slider').find('.' + thisclass).is(":visible")) {
				$('#slider article').fadeOut(1);
				$('#slider').delay(1).animate({'min-height': thisheight});
				$('#slider').find('.' + thisclass).delay(1).fadeIn();
				if ($(window).scrollTop() < 100) {
					$('html, body').animate({scrollTop:1}, 'slow');
				}
				return false;
			}
		});
		
		initFancy();
		
});

function initFancy(){
	//$("a#contacto").fancybox();
	
	
	$("a#contacto").fancybox({
				'width'				: 750,
				'height'			: 770,
				'autoScale'			: false,
				'transitionIn'		: 'none',
				'transitionOut'		: 'none',
				'type'				: 'iframe'
				
		});
		
		
	$("a#restaurantes").fancybox({
				'width'				: 750,
				'height'			: 770,
				'autoScale'			: false,
				'transitionIn'		: 'none',
				'transitionOut'		: 'none',
				'type'				: 'iframe'
				
		});
		
		$("a#restaurantes1").fancybox({
				'width'				: 750,
				'height'			: 770,
				'autoScale'			: false,
				'transitionIn'		: 'none',
				'transitionOut'		: 'none',
				'type'				: 'iframe'
				
		});
		
		$("a#tostadora").fancybox({
				'width'				: 750,
				'height'			: 810,
				'autoScale'			: false,
				'transitionIn'		: 'none',
				'transitionOut'		: 'none',
				'type'				: 'iframe'
				
		});
		
		$("a#tostadora1").fancybox({
				'width'				: 750,
				'height'			: 810,
				'autoScale'			: false,
				'transitionIn'		: 'none',
				'transitionOut'		: 'none',
				'type'				: 'iframe'
				
		});
		
		$("a#productos").fancybox({
				'width'				: 750,
				'height'			: 770,
				'autoScale'			: false,
				'transitionIn'		: 'none',
				'transitionOut'		: 'none',
				'type'				: 'iframe'
				
		});
		
		$("a#productos1").fancybox({
				'width'				: 750,
				'height'			: 770,
				'autoScale'			: false,
				'transitionIn'		: 'none',
				'transitionOut'		: 'none',
				'type'				: 'iframe'
				
		});
}

function initJscroll()
{
	$(function()
			{
				$('.scroll-pane').jScrollPane();
				
		var settings = {
		showArrows: false,
		autoReinitialise: true
	};
	var pane = $('.scroll-pane')
	pane.jScrollPane(settings);


			});
			
}

function initSubcategoryDetail()
{
	
	initTabModule();
}



function activateTabModule()
{
	var sTab = $(this).attr("rel");
	if(sTab != null && sTab != "")
	{
		$(this).parents(".TabModule").find(".breadcrumb,.TabControl").find("a.active").removeClass("active");
		$(this).parents(".TabModule").find(".Tab.active").fadeOut(0,function(){
			$(this).removeClass("active");
			$(this).parents(".TabModule").find(".breadcrumb,.TabControl").find("a[rel="+sTab+"]").addClass("active");
			$(this).parents(".TabModule").find(".Tab."+sTab).fadeIn(0,function(){$(this).addClass("active");});
		});
		
		

	}
}

function initTabModule(sel,callback)
{
	if(sel == null) sel = "";
	$(sel+" .TabModule").each(function(){
		$(".TabControl a:not(.disabled)",$(this)).click(activateTabModule);
		$(".breadcrumb a:not(.disabled)",$(this)).click(activateTabModule);
		$(".Tab:not(.active)",$(this)).hide();
		$(".Tab",$(this)).css("position","relative");
		$(this).css("visibility","visible");
	});
}
