/*
jquery function to handle changes in the form
*/
 

$(document).ready(function() {
	$('#toggleBut').removeAttr("disabled");
	
	// when Show All/One button pressed, show all table rows or just one row
	$('#toggleBut').click(function() {
    $("tr").css("display","");
    $("thead tr").css("display","");
    $('#paperType').val('-- Please Select --'); 
    $('#toggleBut').attr("disabled", "disabled");
    $('#toggleBut').css("color", "#ccc");


   });
	
	
	$('#paperType').change(function() {
		// create dummy variable
		var row_index
		
		// hide any currently shown table row
		$("tr").css("display","none");
		
		// but show the table header row
		$("thead tr").css("display","");
		
		/* take the value attribute from the form's select list and assign to row_index */
		row_index = $("#paperType").val();
		
		if (row_index)
		/* find the tr with a class of the row_index value
		and change the 'display' css property to an empty value
		*/
		$("tr." + row_index).css("display","");
		$('#toggleBut').removeAttr("disabled");
		$('#toggleBut').css("color", "#5c5c5c");
		
		
	});    
});
