function fnRoll(imgName,strSrc) {if (document.images) document[imgName].src = strSrc;}
function MM_preloadImages() { //v3.0
	var d=document;
	if (d.images) {
		if (!d.MM_p) d.MM_p=new Array();
		var i,j=d.MM_p.length,a=MM_preloadImages.arguments;
		for (i=0; i<a.length; i++) if (a[i].indexOf("#")!=0) {
			d.MM_p[j]=new Image;
			d.MM_p[j++].src=a[i];
		}
	}
}
window.onload = function() {
	MM_preloadImages(
		'/images/year1_on.gif',
		'/images/year2_on.gif',
		'/images/year_beyond_on.gif',
		'/images/cat_button_on.png'
	);
};
var ResizingTextArea = Class.create();

ResizingTextArea.prototype = {
	defaultRows: 1,

	initialize: function(field)
	{
		this.defaultRows = Math.max(field.rows, 1);
		this.resizeNeeded = this.resizeNeeded.bindAsEventListener(this);
		Event.observe(field, "click", this.resizeNeeded);
		Event.observe(field, "keyup", this.resizeNeeded);
	},

	resizeNeeded: function(event)
	{
		var t = Event.element(event);
		var lines = t.value.split('\n');
		var newRows = lines.length + 1;
		var oldRows = t.rows;
		for (var i = 0; i < lines.length; i++)
		{
			var line = lines[i];
			if (line.length >= t.cols) newRows += Math.floor(line.length / t.cols);
		}
		if (newRows > t.rows) t.rows = newRows;
		if (newRows < t.rows) t.rows = Math.max(this.defaultRows, newRows);
	}
}
