<!-- <![CDATA[
xponsor.catcher = {
  createObject: function(elementId, config) {
    return {
      refElement: document.getElementById(elementId),
      objHighlight: xponsor.highlight.createObject(elementId, config),
      highlightOnError: ((typeof(config) != 'undefined' && typeof(config.highlightOnError) != 'undefined') ? config.highlightOnError : true),
      timer: null,
      timer2: null,
      isTxtVisible: true,
      curElementValue: null,
      invaldEmailMsg: ((typeof(config) != 'undefined' && typeof(config.invaldEmailMsg) != 'undefined') ? config.invaldEmailMsg : 'Veuillez saisir une adresse email valide. Par exemple votrenom@domaine.com'),
      defaultText: ((typeof(config) != 'undefined' && typeof(config.defaultText) != 'undefined') ? config.defaultText : 'votre email'),
      frequencyHighlight: ((typeof(config) != 'undefined' && typeof(config.frequencyHighlight) != 'undefined') ? config.frequencyHighlight : 0),

      check: function() {
        if (!xponsor.validator.isValidEmail(this.refElement.value))
        {
          if (!this.highlightOnError)
          {
            alert(this.invaldEmailMsg);
          }
          else
          {
            this.objHighlight.highlight();
          }
          return false;
        }
        return true;
      },

      blink: function() {
        if (this.isTxtVisible)
        {
          this.curElementValue = this.refElement.value;
          this.refElement.value = '';
          this.isTxtVisible = false;
        }
        else
        {
          this.refElement.value = this.curElementValue;
          this.isTxtVisible = true;
        }
      },

      stopBlink: function() {
        if (this.timer)
        {
          clearInterval(this.timer);
        }
      },

      startBlink: function() {
        if (this.refElement.value == '')
        {
          this.refElement.value = this.defaultText;
        }
        var scope = this;
        if (this.refElement.value == this.defaultText)
        {
          this.timer = setInterval(function(){ scope.blink(); }, 500);
          if (this.frequencyHighlight > 0)
          {
            this.timer2 = setInterval(function(){ scope.startHighlight(); }, this.frequencyHighlight);
          }
        }
      },

      startHighlight: function() {
        this.objHighlight.highlight();
      },

      stopHighlight: function() {
        if (this.timer2)
        {
          clearInterval(this.timer2);
        }
      },

      onFocus: function() {
        this.stopBlink();

        if (this.frequencyHighlight > 0)
        {
          this.stopHighlight();
        }

        if (this.refElement.value == this.defaultText)
        {
          this.refElement.value = '';
        }
      },

      onBlur: function() {
        if (this.refElement.value == this.defaultText || this.refElement.value == '')
        {
          this.refElement.value = this.defaultText;
          this.startBlink();
        }
      }
    }
  }
};
// ]]> -->
