	$(document).ready(function(){

	$("#btn_login").click(function(){
			var usuario,senha;
			
			usuario = $("#txt_login").val();
			senha = $("#txt_pass").val();
			
			$.post("painel/fontes/index.php",{ 'usuario': usuario, 'senha': senha },
			function (ret) {
			  if (ret=="0"){
					// Limpa os campos
					$("#usuario").val("");
					$("#senha").val("");
					window.location="painel/";
			  }else{
					window.location="painel/?ac=painel";
			  };
			}
			,"json");
	});

	$("#highlight").jCarouselLite({
		visible:1,
		circular: true,
		scroll: 1,
		start: 0,
		auto: 9000,
		speed: 0,
		beforeStart: function(a) {
			$(a).parent().fadeTo(1000, 0);
			var bg = $(a).find('img').attr('src');
			$('.anyClass').css({
				backgroundImage: "url("+bg+")"
			}, 1000);
		},
		afterEnd: function(a) {
			$(a).parent().fadeTo(1000, 1);
		}
	});

		var fixed_menu = "";
		var txt_login = "";
		var txt_name = "";
		var txt_email = "";
		$("#menu .overout").mouseover(function(){
		    
			var url = $(this).attr("src");
			var count_url = url.length;
			var url_hover = url.substr((count_url - 6),2);
			
			if (url_hover=="_h"){
				fixed_menu = url;	
				$(this).css("cursor","default");
			}else{
				$(this).attr("src",url.replace(".jpg","_h.jpg"));
				$(this).css("cursor","pointer");
			}
			
		});
		$("#menu .overout").mouseout(function(){
			var url = $(this).attr("src");
			if (url!=fixed_menu){
				$(this).attr("src",url.replace("_h.jpg",".jpg"));	
			}
		});
		
		// Limpa os campos de login e senha
		$("input,textarea").focus(function(){
			txt_login = $(this).val();
			$(this).val("");
		});
		$("input,textarea").blur(function(){
			if ($(this).val()=="") $(this).val(txt_login);							  
		});

		// Rotação dos clients
		$('#clients').cycle({ 
			fx: 'fade',
			speed:  2500
		});
		
    	
		$.jtabber({
			mainLinkTag: "#nav a", // much like a css selector, you must have a 'title' attribute that links to the div id name
			activeLinkClass: "selected", // class that is applied to the tab once it's clicked
			hiddenContentClass: "hiddencontent", // the class of the content you are hiding until the tab is clicked
			showDefaultTab: 1, // 1 will open the first tab, 2 will open the second etc.  null will open nothing by default
			showErrors: false, // true/false - if you want errors to be alerted to you
			effect: 'slide', // null, 'slide' or 'fade' - do you want your content to fade in or slide in?
			effectSpeed: 'fast' // 'slow', 'medium' or 'fast' - the speed of the effect
		})


		$("#btn_reset").click(function(){
			$("#contact")[0].reset();
		});
		
		$("#client_content").slideDown("slow");
		$(".fechar").click(function(){
			$("#client_content").slideUp("slow");							
		});
		
		
		// Corrige o layout caso seja IE7
		if ((jQuery.browser.version=="7.0" || jQuery.browser.version=="6.0") && jQuery.browser.msie==true){
			$("#bottom").css("margin-top",$(body).height()-210);	
		    $("#message_box").slideDown("slow");
			$(body).resize(function(){
		
					$("#bottom").css("margin-top",$(body).height()-210);
									
			});
		}
		$("#close_message").click(function(){
			$("#message_box").slideUp("slow");
		});

		
		// Fim da correção
		
		$("#btn_newsletter").click(function(){
			$.post("newsletter.php",{'nome':$("#txt_name").val(),'email':$("#txt_email").val()},function(ret){
				alert("Obrigado por se cadastrar em nossa Newsletter!\nThank you for registering for our newsletter!");																					 				$("#txt_name").val("");
				$("#txt_email").val("");
			});
		});
		
		$("#btn_contact_send").click(function(){
			if ($("#name").val()=="" || $("#email").val()=="" || $("#city").val()=="" || $("#phone").val()==""){
				alert("Os campos [nome],[e-mail], [cidade] e [telefone] sao necessarios!\nThe fields [name],[e-mail], [city] and [phone] are necessary!");
			}else{
				$("#contact").submit();	
			}
		});
});


	function client_site(url){
		$('html, body').animate({scrollTop:0}, 'fast');	
		setTimeout("location.href='"+url+"'",1000);
	}
	
	
	