if (typeof jQuery == 'undefined') {
    var headID = document.getElementsByTagName("head")[0];
    var newScript = document.createElement('script');
    newScript.type = 'text/javascript';
    newScript.src = 'http://ajax.googleapis.com/ajax/libs/jquery/1.2.6/jquery.min.js';
    headID.appendChild(newScript);
}

function Inscribe(){
      var url = $("#urlAjax").val();
      var messagenote = $("#messagenote").val();
      var paso = true;

      if ($("#directionInput").length > 0) {
          var directionInput = $("#directionInput").val();
      }else{
          var directionInput = "";
      }
      if ($("#companyInput").length > 0) {
          var companyInput = $("#companyInput").val();
      }else{
          var companyInput = "";
      }
      if ($("#countryInput").length > 0) {
          var countryInput = $("#countryInput").val();
      }else{
          var countryInput = "";
      }
      if ($("#nameInput").length > 0) {
          var nameInput = $("#nameInput").val();
      }else{
          var nameInput = "";
      }
      if ($("#legalnote").length > 0) {
          if ($("#legalnote").attr('checked')){
              
          }else{
              alert(messagenote);
              paso = false;
          }
      }else{
          var enterpriseInput = "";
      }
      
      if (paso == false){
        console.log("PASO FALSE");        
      }else{
          var url = $("#urlAjax").val();
          $.ajax({
                type: "POST",
                url: url,
                data: "acc=add_member&company="+companyInput+"&country="+countryInput+"&direction="+directionInput+"&name="+nameInput+"&email="+jQuery("#emailInput").val()+"&newsletter="+jQuery("#newsletterHidden").val()+"&lista="+jQuery("#listSuscribes").val(),
                beforeSend: function(objeto){
                                     $("#resultado").html('<img  src="'+jQuery("#loadingurl").val()+'" >');
                },
                success: function(datos){
                    
                    $("#resultado").html(datos);
                }
          });
     }
}

