	$(document).ready(function() {
							   
		$("a.ampliar").fancybox();
		
		$(window).resize(function() {
			
			var ww = $(window).width();
			var wh = $(window).height();

			var iw = $("#image").width();
			var ih = $("#image").height();

			$("#container")
				.css("width", ww + "px")
				.css("height", wh + "px");
				
			$("#overContainer")
				.css("width", ww + "px")
				.css("height", wh + "px");
			
			var tw = ww;
			var s = tw / iw;
			var th = ih * s;
			
			if (th < wh) {
				th = wh;
				s = wh / ih;
				tw = iw * s;
			}
			
			$("#image")
				.width(tw)
				.height(th)
				.css("left", ((ww - tw) / 2) + "px")
				.css("top", ((wh - th) / 2) + "px");

		});
		
		$(window).resize();
		
		$("#ambientes").mouseover(function() {
    		$(".navigation").animate({"height" : "200px"},{queue:false, duration:300},"linear");
		});
		
		/*
		$("#catalogos").mouseover(function() {
    		$(".navigation").animate({"height" : "200px"},{queue:false, duration:300},"linear");
		});
		*/
		$(".navigation").mouseleave(function(){
			$(".navigation").animate({"height" : "62px"},{queue:false, duration:300},"linear");						 
    	});
		
		$("#btDown").click(function(){
								  var posicionPasador = parseInt($(".showNotices").css("marginTop"));
								  var totalSize = 320 * 9;
									  if (posicionPasador > "-"+totalSize) {
										$(".showNotices").animate({marginTop: "-=" + 320 + "px"}, {duration: 300} );
									  }
								  });	
		
		$("#btUp").click(function(){
								  var posicionPasador = parseInt($(".showNotices").css("marginTop"));
									  if (posicionPasador < 0) {
										$(".showNotices").animate({marginTop: "+=" + 320 + "px"}, {duration: 300} );
									  }
								  });
		
		/* PASADOR DE AMBIENTES */
		
		var totalAlbums = $(".showAmb ul").children().size();
		var currentAlbum = 0;
		var sizeAlbum = 150;
		var albumsPantalla = 5;
		
			$(".btNext:not(.catalogo)").click(function(){
				if (currentAlbum < totalAlbums - albumsPantalla){
					$(".showAmb ul").animate({marginLeft: "-=" + sizeAlbum + "px"}, {duration: 300} );
					currentAlbum = currentAlbum + 1;
				}
			});	
			
			$(".btPrev:not(.catalogo)").click(function(){
				if (currentAlbum > 0){
					$(".showAmb ul").animate({marginLeft: "+=" + sizeAlbum + "px"}, {duration: 300} );
					currentAlbum = currentAlbum - 1;
				}
			});
			
		
			

					
	});
