//////////////////////////////////
// Morpheus Javascript Functions//
//////////////////////////////////

function autoSize(id, maxHeight){
   var text = id && id.style ? id : document.getElementById(id);
   if ( !text ) return;

   var adjustedHeight = text.clientHeight;
   if ( !maxHeight || maxHeight > adjustedHeight ){
	  adjustedHeight = Math.max(text.scrollHeight, adjustedHeight);
	  if ( maxHeight )
		 adjustedHeight = Math.min(maxHeight, adjustedHeight);
	  if ( adjustedHeight > text.clientHeight )
		 text.style.height = adjustedHeight + 5 + "px";
   }
}