function muda(val2){
	$("body").fadeOut(500, function(){
		window.location = val2;		
	});
	return false;
}

$(document).ready(function(){
	$('#banner ul').tabs({ fx: { opacity: 'toggle' } }).tabs('rotate', 5000, 'true').tabs('disabled.tabs', []);
	$('body').fadeOut(0);
	$('body').fadeIn(500);
			$(function(){  
				$("#contatoform").validate({
				submitHandler: function(form) {  
					$(form).ajaxSubmit({  
						dataType: 'html',  
						success: response  
					});  
				},  
				rules: {  
				 nomeform: 'required',  
				 emailform: {  
					 required: true,  
					 email: true  
				 },
				 msgform:  'required'
				}, messages: {
					nomeform: {  
						required: '<span style="color: red;float: right;">*</span>'
					},  
					emailform: {  
						required: '<span style="color: red;float: right;">*</span>',  
						email: '<span style="color: red;float: right;">*</span>'  
					},msgform: {  
						required: '<span style="color: red;margin-top: 0px;float: right;">*</span>'
					}
				}
				});  
			function response(data) {  
		   	alert(data);
				$("#contatoform").resetForm();
		  }
		});
	$('#menuSlt2 li.chat a').hover(function(){
		$("#menuSlt2 li.chat a").animate({ 
			marginTop: "0px"
		}, 400 );
	});
        $('#menuSlt2 li.chat a').mouseleave(function(){
		$("#menuSlt2 li.chat a").animate({ 
			marginTop: "-50px"
		}, 400 );
	});
});

$(document).ready(function(){

	$("ul.subnav").parent().append("<span></span>"); //Only shows drop down trigger when js is enabled (Adds empty span tag after ul.subnav*)

	$("ul.topnav li a").mouseover(function() { //When trigger is clicked...

		//Following events are applied to the subnav itself (moving subnav up and down)
		$(this).parent().find("ul.subnav").slideDown(100).show(); //Drop down the subnav on click

		$(this).parent().hover(function() {
		}, function(){
			$(this).parent().find("ul.subnav").slideUp(100); //When the mouse hovers out of the subnav, move it back up
		});

		//Following events are applied to the trigger (Hover events for the trigger)
		}).hover(function() {
			$(this).addClass("subhover"); //On hover over, add class "subhover"
		}, function(){	//On Hover Out
			$(this).removeClass("subhover"); //On hover out, remove class "subhover"
	});
	
	$("ul.subnav li a").mouseover(function() { //When trigger is clicked...

		//Following events are applied to the subnav itself (moving subnav up and down)
		$(this).parent().find("ul.subsubnav").slideRight().show(); //Drop down the subnav on click

		$(this).parent().hover(function() {
		}, function(){
			$(this).parent().find("ul.subsubnav").slideLeft(); //When the mouse hovers out of the subnav, move it back up
		});

		//Following events are applied to the trigger (Hover events for the trigger)
		}).hover(function() {
			$(this).addClass("subsubnav"); //On hover over, add class "subhover"
		}, function(){	//On Hover Out
			$(this).removeClass("subsubnav"); //On hover out, remove class "subhover"
	});
	

});

jQuery.fn.extend({
  slideRight: function() {
    return this.each(function() {
      jQuery(this).animate({
				width: 'show',
				opacity: 'toggle'
			}, 300);
    });
  },
  slideLeft: function() {
    return this.each(function() {
      jQuery(this).animate({
				width: 'hide',
				opacity: 'toggle'
				}, 100);
    });
  },
  slideToggleWidth: function() {
    return this.each(function() {
      var el = jQuery(this);
      if (el.css('display') == 'none') {
        el.slideRight();
      } else {
        el.slideLeft();
      }
    });
  }
});


