
function add_contact_news()
{
	
	var email = $('#news-email').val();
	
	if($('#news-name').val() == '' || $('#news-name').val() == 'Tu nombre')
	{
		//jQuery('#contact_alert').text('');
		alert('Por favor verifica tu nombre.');
		return false;
	}
	
	function isText( formfield)
{
	if( formfield.value == ''){
		return false;
	}
	return true;
}
function isValidEmail(str) {
	if(!str)
		return false;
   return (str.indexOf(".") > 2) && (str.indexOf("@") > 0);

}

function isMail( formfield)
{
	var str=formfield.value;
	var filter=/^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)jQuery/i
	
	if (filter.test(str))
		return true;
	
	return false;
}
function isNumeric( formfield)
{
	n = formfield.value;
	return !isNaN(parseFloat(n)) && isFinite(n);
}


function validateForm( e)
{
	if(customValidation( e))
	{
		// la forma se respondio correctamente
		return true;
	}
	return false;
}
	
	if(!isValidEmail(email))
	{
		//jQuery('#contact_alert').text('');
		alert('Por favor ingresa un correo válido.');
		return false;
	}
	jQuery.post("management/index.php?a=news&c=db:js_add", 
	{ name: jQuery('#news-name').val(),email1: jQuery('#news-email').val() },
	function(data){
		//alert(data);

		//console.log(data);
		
		var id = null;
		var name = null;
		var email1 = null;
	
		var response = jQuery.parseJSON(data);
		var id = response.id;
		var name = response.name;
		var email1 = response.email1;

    //alert(name);

		
		return false;   
		
	});    
	   jQuery('#newsletter_form').hide();
		jQuery('#feedback').show();
	return false;
}


$(document).ready( function(){
  $('#suscribe').click(function(event){
  //$('#newsletter_form').submit();
		        return add_contact_news(); 
		//alert('Newsletter');
})
});
