
  var DEF_REFRESH = 4000; //milliseconds
  var DEF_VECTOR = 10; //pixels
  var DEF_MINREFRESH = 500; //milliseconds
  var DEF_MAXROTATION = 5; //zero for unlimited

  function js_textticker(ttspan) {
 
    this.vector = DEF_VECTOR; //UNUSED-->for text scrolling
    this.icurrenttextpos = -1; //UNUSED-->for text scrolling
    this.eventmovetext = -1; //UNUSED-->for text scrolling
    
    this.ttspan = ttspan; //id of span element to use
    this.refreshtime = DEF_REFRESH; //time to show each text message for
    this.textarray = []; //empty array of text messages
    this.icurrenttext = -1; //index of current text message
    this.eventnexttext = -1; //handle of timer event
    this.playcount = 0; //number of times all text messages have been shown
    this.maxplaycount = DEF_MAXROTATION; //max number of times to show all text messages
    
    this.addtext = function(text) {
      this.textarray[this.textarray.length] = text;
    }
    
    this.start = function() {
      this.nexttext();
      var oInstance=this;
      this.eventnexttext = setInterval(function(){oInstance.nexttext()}, DEF_REFRESH);
      //this.eventmovetext = setInterval(function(){oInstance.movetext()}, DEF_REFRESH);
    }
    
    this.stop = function() {
      this.icurrenttext=-1;
      //this.icurrenttextpos=-1;
      clearInterval(this.eventnexttext);
      //clearInterval(this.eventmovetext);
    }
    
    this.togglestate = function() {
      if (this.icurrenttext==-1) {
        this.start();
      } else {
        this.stop();
      }
    }
     
    this.nexttext = function() {
      this.icurrenttext++;
      if (this.icurrenttext==this.textarray.length) {
        this.icurrenttext = 0;
        this.playcount++;
        if (this.playcount==DEF_MAXROTATION) {
          this.stop();
          return false;
        }
      }
      var ttspan = document.getElementById(this.ttspan);
      ttspan.innerHTML = this.textarray[this.icurrenttext];
      //alert(ttspan.offsetWidth);
    }
     
    //this.movetext = function() {
    //  var ttspan = document.getElementById(this.ttspan);
    //  this.icurrenttextpos+=this.vector;
    //  if (this.icurrenttextpos>=ttspan.offsetWidth) {
    //    this.icurrenttext = 0;
    //    this.icurrenttextpos = 0;
    //  }
    //  ttspan.style.left = this.icurrenttextpos;
    //}
    
  }