// JavaScript Document

jQuery.fn.fadeToggle = function(speed, easing, callback) {

	if(jQuery.browser.msie){
	  return this.toggle();
	} else {
 	  return this.animate({opacity: 'toggle'}, speed, easing, callback);
	};

}; 
	
$(document).ready(function(){
						   
	$("#btnMostraContacto").click(function(){
  
			$.scrollTo(2000)
			$("#formContactoFloat").toggle();
			$("#boxEventosHide").toggle();


	});
						   
	$("#areaItems").hide();
	$("#inputOutro").hide();
	
	$("#btnToggleContacto").click(function(){
								
			$.scrollTo(2000)
			$("#formContactoFloat").toggle();
			$("#fotoEvento").toggle();
			

		

	});
	
	$("#btnArea").click(function(){
		$("#areaItems").fadeToggle();
		}
	);
	
	$("#btnZoomPorto").click(function(){
		$("#mapaPortugal").hide();
		$("#mapaPorto").show();	  
	});
	$("#btnZoomLisboa").click(function(){
		$("#mapaPortugal").hide();
		$("#mapaLisboa").show();	  	  
	});
	$("#btnZoomPortugal").click(function(){
		$("#mapaPorto").hide();
		$("#mapaLisboa").hide();	  	
		$("#mapaPortugal").show();	
	});
	$("#btnZoomPortugal2").click(function(){
		$("#mapaPorto").hide();
		$("#mapaLisboa").hide();	  	
		$("#mapaPortugal").show();	
	});
	
	$(document).click(function(event){
		if(event.target.id != "btnArea"){
			if(jQuery.browser.msie){
				$("#areaItems").hide();
			} else {
				$("#areaItems").fadeOut();
			}
		}
	});
	
	$("#btnNext").click(function(){
		$(".tab1").hide();
		$(".tab5").show();
		$("#btnPrevProdutos a").show();
		$("#btnNextProdutos a").hide();
	});
	$("#btnPrev").click(function(){
		$(".tab5").hide();
		$(".tab1").show();
		$("#btnPrevProdutos a").hide();
		$("#btnNextProdutos a").show();
	});
	
	$("#bgItems ul li a").click(function(){
		var txt = $(this).html();
		$(this).parent().parent().find('.selected').removeClass("selected");
		$(this).addClass("selected");
		$(this).parent().parent().parent().parent().parent().find('span').html(txt);
		$(this).parent().parent().parent().parent().parent().find('input').val(txt);
	});
	
	$("#optionOutros").click(function(){
		$("#inputOutro").fadeIn();
	});
	$("#option1").click(function(){
		$("#inputOutro").fadeOut();
	});
	$("#option2").click(function(){
		$("#inputOutro").fadeOut();
	});
	$("#option3").click(function(){
		$("#inputOutro").fadeOut();
	});
	$("#option4").click(function(){
		$("#inputOutro").fadeOut();
	});
	
	
	$(".btnNewsletter").fancybox({
				'width'				: 355,
				'height'			: 139,
				'autoScale'			: false,
				'transitionIn'		: 'fade',
				'transitionOut'		: 'fade',
				'type'				: 'iframe',
				'padding'			: 0,
				'overlayOpacity'	: '0.6'
	});

});
