	$(document).ready(function(){
		$("#Principal").pngFix();

		/* Comportamiento Botones Menu */
		$("#Menu>ul>li>ul>li>a").hover(
			function() {

				$(this)
				.stop(false, true)
				.animate({ color : "#A8302D", backgroundPosition : "-4px 0" , backgroundColor: "#F2C742"},{duration: 400, easing: "easeInOutExpo"});
			},
			function() {
				$(this)
				.stop(false, true)
				.animate({ color : "#DAA03B", backgroundPosition : "-30px 0", backgroundColor: "#932B27" },{duration: 600, easing: "easeInExpo"});
			}
		);
		$("#Menu>ul>li>a").hover(
			function() {

				$(this)
				.stop(false, true)
				.animate({ color : "#A8302D", backgroundPosition : "-10px 0" , backgroundColor: "#F2C742"},{duration: 400, easing: "easeInOutExpo"});
			},
			function() {
				$(this)
				.stop(false, true)
				.animate({ color : "#E4CAC9", backgroundPosition : "-30px 0", backgroundColor: "#932B27" },{duration: 600, easing: "easeInExpo"});
			}
		);

		/* Comportamiento Botones Contacto */

		$(".ro").hover(
			function(e) {
				this.src = this.src.replace("_off","_on");
			},
			function(e) {
				this.src = this.src.replace("_on","_off");
			}
		);
		$("#Contacto .botonContacto").click(
			function(e) {
				e.preventDefault();
				$("#Contacto .botonContacto").hide();
				$("#Contacto .botonCerrarContacto").show();
				$("#Contacto").animate({ top : "8px" }, {duration: 1000, easing: "easeInOutExpo"});
				return false;
			}
		);
		$("#Contacto .botonCerrarContacto").click(
			function(e) {
				e.preventDefault();
				$("#Contacto .botonCerrarContacto").hide();
				$("#Contacto .botonContacto").show();
				$("#Contacto").animate({ top : "-175px" }, {duration: 600, easing: "easeOutCubic"}); /* top = ( height - 25 ) * -1 */
				return false;

			}
		);

		$("#enviar, .botonEspecial")
		.hover(
			function() {
				$(this).stop(false, true)
					.animate( { color: "#A8302D" , backgroundColor: "#DAA03B"}, {duration: 300});

			},
			function() {
				$(this).stop(false, true)
					.animate( { color: "#DAA03B" , backgroundColor: "#A8302D"}, {duration: 400});
			}
		);
		
		$("#enviar")
		.click(
			function(e) {
				e.preventDefault();
				$("#msgContacto").fadeIn(1000);
				$.post("/tools/mail.php", $("#formContacto").serializeArray(), function(datos) {
					$("#msgContacto").css("backgroundImage","none").html(datos);
				});
				return false;
			}		
		);

		/* Rollover Fotos Portada */

		$(".fotosPortada, .fotosPortada2").each( function() {
			img = $(this).find("img");
			title = $(img).attr("title");
			alt = $(img).attr("alt");
			$(this)
				.prepend('<div class="tituloImagen"><span>' + title + '</span></div>')
				.append('<div class="descripImagen"><span>' + alt + '</span></div>');			

		});

		$(".fotosPortada, .fotosPortada2").hover(
			function() {				
				$(this)
					.children("div:first")
						.stop(false,true)
						.animate({top:0}, {duration: 400, easing: "easeOutQuart"})
					.end()
					.children("div:last")
						.stop(false,true)
						.animate({bottom:0}, {duration: 1000, easing: "easeOutQuart"})
					.end()
						.children("img")
						.stop(false, true)
						.fadeTo(400, 0.7);
			},
			function() {
				$(this).children("div:first").stop(false,true).animate({top:-50}, { duration: 400, easing: "easeOutQuart"} );
				$(this).children("div:last").stop(false,true).animate({bottom:-100}, { duration: 400, easing: "easeOutQuart"} );
				$(this).children("img").fadeTo(400, 1);
			}

		);
	});

