// 
//	Javascripting coding for MACSE
//	Created by Rigent Inc
//	www.rigent.com
//

// document page functions
$(document).ready(function(){
	$("p.infop").hide();	
	$("fieldset.infofieldset a").click(function(){$(this).next().toggle()});
	$("#resetbttn").click(function(){
		$("#searchform")[0].reset();
	})
	if($(".viewit input:checkbox:checked")){
		$(".viewit input:checkbox:checked").parent().html("<strong>Yes</strong>")
	} 
	$(".viewit input:checkbox").parent().html("No")
	// $("#nu_submit").click(function(){alert($("form")[0])});
	$("#programform input").bind("keypress", function(e) {
 	 if (e.keyCode == 13) return false;
	});
	// Initiate table sorter
	$("#sorttable").tablesorter( {cssAsc:"sortasc",cssDesc:"sortdesc", headers: {0: {sorter: false},1: {sorter: false},4: {sorter: false},6: {sorter: false},5: {sorter: "isoDate"}}, sortList: [[2,0]], widgets: ['zebra']} );
	$("#sorttablecontact").tablesorter( {cssAsc:"sortasc",cssDesc:"sortdesc", headers: {0: {sorter: false},3: {sorter: false},4: {sorter: false}}, sortList: [[1,0]], widgets: ['zebra']} );
	// action form drop down action
	$("#actionselect").change(function(){
		if($("#actionselect").val() != 0){
			$("#actionform")[0].submit();
		}
	})
	$("#actionselecttop").change(function(){
		if($("#actionselecttop").val() != 0){
			$("#actionform")[0].submit();
		}
	})
//	$("input.cshyesno").click(function(){
//		if($("#cshyes input").is(":checked")){
//			$("#hidethese").show();
//		} else {
//			$("#hidethese").hide();
//		}
//	});
	// check on load whether to show or hide the hidden add fieldset
	if($("#cb_cshyesno").is(":checked")){
		$("#hidethese").show();
	}
	$("#cb_cshyesno").click(function(){
		$("#hidethese").toggle();
	});
})
