function ScreenHandler() {
  
  this.arrElements = new Array();
  
  /**
   * Voeg een element toe aan de screenhandler
   */
  this.addElement = function(psID, pOnClick, pOnChange) {
    
    if (psID == undefined || psID == '' || psID == null) {
      return false;
    }
    objElement = new ScreenElement();
    objElement.setElement( psID );
    if (pOnClick != undefined && pOnClick != '' && pOnClick != null) {
      objElement.addOnClick( pOnClick );
    }
    if (pOnChange != undefined && pOnChange != '' && pOnChange != null) {
      objElement.addOnChange( pOnChange );
    }
    
    this.arrElements.push( objElement );
  };
  
}

function ScreenElement() {
  
  this.id = '';
  this.domElement = null;
  this.onClick = null;
  this.onChange = null;
  this.bChanged = false;
  
  this.setElement = function( psID ) {

    this.id = '';
    this.domElement = null;
    this.onClick = null;
    this.onChange = null;
    this.bChanged = false;
    
    if (psID != undefined && psID != '') {
      this.id = psID;
      this.domElement = $("#" + psID);
    }
    
  };
  
  this.addOnClick = function( pOnClickFunction ) {
    if (this.domElement == null || pOnClickFunction == null) {
      return;
    }  
    
    this.onClick = pOnClickFunction;
    this.domElement.click( this.onClick );
  };

  this.addOnChange = function( pOnChangeFunction ) {
    if (this.domElement == null || pOnChangeFunction == null) {
      return;
    }  
    
    this.onChange = pOnChangeFunction;
    
    this.domElement.change( function() {
      this.bChanged = true;  
      if (this.onChange != null) {
        this.onChange;
      }      
    });
  };
  

}
