function init_textarea_autosize(max_height) {
	var l = document.getElementsByTagName("TEXTAREA")
	for(var i=0; i<l.length; i++ ) {
		l[i].attachEvent("onchange", textarea_autosize)	
		l[i].attachEvent("onkeypress", textarea_autosize)
		l[i].attachEvent("onkeydown", textarea_autosize)

		l[i].max_height = max_height
		var d = l[i].style.display 
		l[i].style.display = 'block'
		textarea_autosize(l[i]) 
		l[i].style.display = d
	}
}


function textarea_autosize(event) {
	var obj = event.srcElement || event.target || event
	if (parseInt(obj.style.height) == obj.max_height) return true 
	if (obj.scrollHeight > obj.offsetHeight) obj.style.height = obj.scrollHeight + 'px' 
	if (parseInt(obj.style.height) > obj.max_height) obj.style.height = obj.max_height + 'px'
	return true 
}

