// JavaScript Document

function checkEmail(inputvalue){	
    var pattern=/^([a-zA-Z0-9_.-])+@([a-zA-Z0-9_.-])+\.([a-zA-Z])+([a-zA-Z])+/;
    if(pattern.test(inputvalue)){         
		return true;   
    }else{   
		return false; 
    }
}

function suscribir(){
email = $('#mail').val();
nombre = $('#name').val();
respuesta = '';
$('#mensaje').html('Enviando datos');
if(checkEmail(email)){
$.ajax({
    type: "POST",
    url: "suscribir.php",
    data: "email="+ email+"&nombre="+nombre,
    success: function(datos){
    x1 = datos;
    //x1 = x1.split('|');
   //$('#wait').hide();
   //$('#suscripcion').show();
   //$('#mensaje').html('Los datos se procesaron correctamente.');
  },
  beforeSend: function(objeto){
        $('#formAccesos').hide();
        $('#wait').show();
    },
    complete: function(objeto, exito){
        //alert("Me acabo de completar")
        if(exito=="success"){
            if(x1 == 'ok'){
        	$('#mensaje').html('Su suscripci&oacute;n ha sido ingresada.');
            } else {
           	$('#mensaje').html('Ya existe.');
            }
			$('#bt').show();
        }
    },
    error: function(objeto, quepaso, otroobj){
        alert("Estas viendo esto por que fallé");
        alert("Pasó lo siguiente: "+quepaso);
    }
});
}else{
	alert('ingrese un email de formato valido');
}

	return false;
	document.envio = false;
}

function wall(frm)
{
if($('#opcion'+frm).val()!='') {

	$('#form'+frm).submit();

}
}

function checkForEnter (event) {
  if (event.keyCode == 13) {
 	$('#boton_enviar').focus(); 
  } 
}

function checkForEnter2 (event) {
  if (event.keyCode == 13) {
 	$('#boton_ingresar').focus(); 
  } 
}



swfobject.embedSWF("swf/botonV.swf", "enviarTranquilidad", "211", "50", "8.0.0", "expressInstall.swf");