var LiveText = new Class({

  initialize: function(inputId, outputId, defaultValue) {
 
    this.input = $(inputId);
 	this.output = $(outputId);
    this.defaultText = defaultValue;
 
    //this.input.addEvent('keydown', this.onKeyPress.bindWithEvent(this));
    this.input.addEvent('keyup', this.onKeyPress.bindWithEvent(this)); 
    this.update();
  },
 
  onKeyPress: function(event) {
    event = new Event(event);
    if(!event.shift && !event.control && !event.alt && !event.meta) this.update();
  },
 
  update: function() {
      var val = this.input.value;
	  val = (val.length > 0) ? val: this.defaultText;
	  val = str_replace("\n", '<br />', val);

	 this.output.setHTML(val);
	  $contentheight = $('content').getStyle('height');
	$('sidebar').setStyle('height', $contentheight); 
  }
});
function str_replace(search, replace, subject) {
    return subject.split(search).join(replace);
}

 