
		function retornoAjax(retorno)	
		{	
			if(retorno == 'true') {
				$('.txt-mensagem-newsletter-home').html($('#msg_sucesso_home').val());
				$('#alerta-newsletter-home').hide();
				$('#sucesso-newsletter-home').show('normal');
			}
			else {
				$('.txt-mensagem-newsletter-home').html($('#msg_falha_home').val() );
				$('#sucesso-newsletter-home').hide();
				$('#alerta-newsletter-home').hide();
				$('.alerta-mail-home').show('normal');
				
			}	
		}
		
		
		/**  
		 * @method requestAjax(url, method)
		 * @param  string url
		 * @param  string method
		 * @return void
		 * @desc   funo customizada   
		 */
		function requestAjax(url, method, email)
		{
			if(method == '')
				method = "";
			
			$.ajax({
				type: method,
				url:  url,
				data: "email=" + email,
				success: function(retorno) {		 	   
					retorno = retorno.replace(/^\s+|\s+$/g,"");
					retornoAjax(retorno);			
				 }
			});
		}	
		

		/**  
		 * @method checkMail(mail) 
		 * @param  obj mail
		 * @return bool
		 * @desc:   
		 */
		function checkMail(obj)
		{
			var er = new RegExp(/^[A-Za-z0-9_\-\.]+@[A-Za-z0-9_\-\.]{2,}\.[A-Za-z0-9]{2,}(\.[A-Za-z0-9])?/);
			
			if(typeof(obj) == "string"){
				if(er.test(obj)){ 
					return true; 
				}
			}
			
			else if(typeof(obj) == "object"){
				if(er.test(obj.value)){
					return true;
				}
			}
			
			else{
				return false;
			}
		}
		


		function disableEnterKey(e)
		{
			 var key;
		
			 if(window.event)
				  key = window.event.keyCode;     //IE
			 else
				  key = e.which;     //firefox
		
			 if(key == 13)
				  return false;
			 else
				  return true;
		}



		function validaFormNewsHome()
		{
			if($('#nome_news_home').val() == '' || $('#nome_news_home').val() == 'nome')
			{
				$('.txt-mensagem-newsletter-home').html($('#nome_news_home').attr('title'));
				$('#alerta-newsletter-home').show('normal');
				$('#sucesso-newsletter-home').hide();
				document.getElementById('nome_news_home').focus();
				
				return false;
			}
			
			
			// 
			if($('#email_news_home').val() == '' || $('#nome_news_home').val() == 'e-mail' || 
			!checkMail($('#email_news_home').val()) )
			{
				$('.txt-mensagem-newsletter-home').html($('#email_news_home').attr('title'));
				$('#alerta-newsletter-home').show('normal');
				$('#sucesso-newsletter-home').hide();
				document.getElementById('email_news_home').focus();
				return false;
			}
			
			return true;
		}