// JavaScript Document

var site = {
	slideShow : function() {
	
		$('#slider a').css({opacity: 0.0});
		$('#slider a:first').css({opacity: 1.0});
		$('#slider .caption2').css({opacity: 0.8});
		//$('#slider .caption2').css({width: $('#slider a').find('img').css('width')});
		$('#slider .content2').html($('#slider a:first').find('img').attr('rel'))
			.animate({opacity: 0.7}, 400);
			/*@@SETINTERVAL*/
			setInterval(site.slider,4000);
	},
	slider : function() {
			var current = ($('#slider a.show')?  $('#slider a.show') : $('#slider a:first'));
			var next = ((current.next().length) ? ((current.next().hasClass('caption2'))? $('#slider a:first') :current.next()) : $('#slider a:first'));	
			var caption = next.find('img').attr('rel');	
			
			next.css({opacity: 0.0})
				.addClass('show')
				.animate({opacity: 1.0}, 1000);
				
			current.animate({opacity: 0.0}, 1000)
				.removeClass('show');
				
				$('#slider .caption2').animate({opacity: 0.0}, { queue:false, duration:0 }).animate({height: '1px'}, { queue:true, duration:300 });	
			if(caption.length > 0){
				$('#slider .caption2').animate({opacity: 0.8},100 ).animate({height: '40px'},500 );
				$('#slider .content2').html(caption);
			}
	},
	
	bannersHover : function() {
		$("#bannersRight IMG").hover(function() {
			$(this).animate({opacity: 0.5}, 100);
		  },function() {
			$(this).animate({opacity: 1}, 100); 
		  });
	},
	
	contatoForm : function() {
		$("input,textarea,select").focus(function() {
				$(this).addClass("focus");
		});
		$("input, select, textarea").blur(function() {
				$(this).removeClass("focus");
		});
	}
}

$(document).ready(function() {
	site.contatoForm();
	site.slideShow();
	site.bannersHover();
	
});
