function writeAutoTabBCInput(name, size, maxlength, value, clas) {
    size = convertSize(size, "input");
    var props = ' id="' + name + '" name="' + name + '" size="' + size + '" maxlength="' + maxlength + '"' + ((value) ? ' value="' + value + '"' : '') + ((clas) ? ' class="' + clas + '"' : '');
    var doc = document;
    doc.writeln('<input type="text" onBlur="showActiveButton();" onKeyUp="return autoTab(this, ' + maxlength + ', event);" ' + props + '>');
}

function showActiveButton(){

	var cust1 = $('CUSTBC1').value;
	var cust2 = $('CUSTBC2').value;
	var cust3 = $('CUSTBC3').value;
	var login = cust1 + cust2 + cust3;
		
		//alert(cust1);
		//alert(!isNaN(cust1));
		//alert(cust1.length);
		//alert(cust1.length==3);
	if(	login.length>=1 ){
			$('inactiveButton').hide();
			var activeButton = $('activeButton');
			activeButton.href =  
			activeButton.show();
	}else{
//alert('inactive');
			$('activeButton').hide();
			$('inactiveButton').show();
	}
}

function BCvalidate(url, redirectUrl){

		//hide the error div
		$('errorProfileNotFound').hide();
	
		var cust1 = $('CUSTBC1').value;
		var cust2 = $('CUSTBC2').value;
		var cust3 = $('CUSTBC3').value;
		var login = cust1+cust2+cust3;

      if (window.XMLHttpRequest) // Non-IE browsers
      {
        var xmlreq = new XMLHttpRequest();
        xmlreq.open("POST", url+'memberNumber='+login, true);
        xmlreq.onreadystatechange=
          function()
          {
            if (xmlreq.readyState==4)
            {

              var response = xmlreq.responseText;

              //alert(xmlreq.responseText);

              if (xmlreq.status == '200')
              {

                  if (response.indexOf("FORM_OK") > 0)
                  {
                      //open the new window
                      window.open(redirectUrl+'&noMembreAero='+login);
                  }
                  else if (response.indexOf("PROFILE_NOT_FOUND") > 0)
                  {
                      //display the error message
                      $('errorProfileNotFound').show();
                  }
              }
              else
              {
                  //alert("an Error: " + response);
                  outputResponseMsg(checkProfileErrorMsg);
              }
            }
          }
        xmlreq.send(null);
      }
      else if (window.ActiveXObject) // IE
      {
        var xmlreq = new ActiveXObject("Microsoft.XMLHTTP");
        xmlreq.open("POST", url+'memberNumber='+login, true);
        xmlreq.onreadystatechange=
          function()
          {
            if (xmlreq.readyState==4)
            {

                if (xmlreq.status == '200')
                {
                    //alert(xmlreq.responseText);
                    var response = xmlreq.responseText;


                    if (response.indexOf("FORM_OK") > 0)
                    {
                      //open the new window
                      window.open(redirectUrl+'&noMembreAero='+login);
                    }
                    else if (response.indexOf("PROFILE_NOT_FOUND") > 0)
                    {
                      //display the error message
                      $('errorProfileNotFound').show();
                    }
                }
                else
                {
                    //alert("an Error");
                    outputResponseMsg(checkProfileErrorMsg);
                }
            }
          }
        xmlreq.send();
      }
}

