var ExpandingTextAreas = {

		init : function() {
	
			//Prototype
			$$('.expander').each(function(textarea){ //The 100 textareas
			
			  var interval,
			      oldValue = textarea.value,
			
			      //The observer function is the same, only we're assigning
			      //it to a variable to be re-used
			      observer = function(){
			        var newValue = textarea.value;
			        if (newValue != oldValue) {//Value has changed
			          //Set the "rows" attribute to the number of lines + 2
			          textarea.writeAttribute('rows', newValue.split("\n").length+2);
			          oldValue = newValue;
			        }
			      };
			
			  //When the user focuses the textarea, create the observer interval
			  textarea.observe('focus', function(){
			    //Assign the interval to a variable so it can be removed later
			    interval = setInterval(observer, 500);//Check every 0.5s
			  });
			
			  //When the user is finished editing, remove the interval
			  textarea.observe('blur', function(){
			    clearInterval(interval);
			  });
			
			});
	}

};
