$(document).ready(function() {
	
	$('.add-event-field').click(function() {
		$(this).parent().prev().children('table').append('<tr><td><input type="text" name="Institution[]" /></td><td><input type="text" name="Mneumonic[]" /></td><td><input type="text" name="Catalog_Number[]" /></td><td><input type="text" name="Semester[]" /></td></tr>').prev().children('table input:first').focus();
		return false;
	});
	
	$('.add-fac-event-field').click(function() {
		$(this).parent().prev().children('table').append('<tr><td><input type="text" name="Institution[]" /></td><td><input type="text" name="Mneumonic[]" /></td><td><input type="text" name="Catalog_Number[]" /></td><td><input type="text" name="Semester[]" /></td><td><input type="text" name="Room_Name[]" /></td><td><input type="text" name="Alias[]" /></td></tr>').prev().children('table input:first').focus();
		return false;
	});
	
	$('.add-event-row-field').click(function() {
		$(this).parent().prev().children('table').append('<tr><td><input type="text" name="Semester[]" /></td><td><input type="text" name="Course[]" /></td><td><input type="text" name="Instructor[]" /></td><td><input type="text" name="Days[]" /></td><td><input type="text" name="Start[]" /></td><td><input type="text" name="End[]" /></td><td><input type="text" name="Room[]" class="wider" /></td></tr>').prev().children('table input:first').focus();
		return false;
	});
	
	$('.add-event-row-field2').click(function() {
		$(this).parent().prev().children('table').append('<tr><td><input type="text" name="Semester[]" /></td><td><input type="text" name="Course[]" class="wider" /></td><td><input type="text" name="Instructor[]" /></td><td><input type="text" name="Days[]" /></td><td><input type="text" name="Start[]" /></td><td><input type="text" name="End[]" /></td><td><input type="text" name="Room[]" class="wider" /><td><input type="text" name="Credit_Type[]" /></td></tr>').prev().children('table input:first').focus();
		return false;
	});
	
});