$(document).ready(function () {
$("#add_student").click(function() {
     $('.studentEntry:last').clone(false).insertAfter('.studentEntry:last');
     var currentCount = $('.studentEntry').length - 1;
     $('#student_name:last','.studentEntry:last').attr('name', 'student[' + currentCount + '][name]');
     $('#student_entries:last','.studentEntry:last').attr('name', 'student[' + currentCount + '][entries]');
   });
});

window.onload = rolloverInit;

function rolloverInit() {
	for (var i=0; i<document.images.length; i++) {
		if (document.images[i].parentNode.tagName == "A") {
			setupRollover(document.images[i]);
		}
	}
}

function setupRollover(thisImage) {
	thisImage.outImage = new Image();
	thisImage.outImage.src = thisImage.src;
	thisImage.onmouseout = rollOut;

	thisImage.overImage = new Image();
	thisImage.overImage.src = "images/" + thisImage.id + "_2.png";
	thisImage.onmouseover = rollOver;	
}

function rollOver() {
	this.src = this.overImage.src;
}

function rollOut() {
	this.src = this.outImage.src;
}

