// jquery functions
$(function() {		
	
	// controls any div with id of jqdialog - used for modal alerts
	$("#jqdialog").dialog({
		autoOpen: false, resizable: true, height:400, width:400, modal: true,
		buttons: {
			Close: function() { $(this).dialog('close'); }
		}
	});		
});		

// check or uncheck all checkboxes matching paramter name
function jqCheckAll(name){
	$("INPUT[@name="+name+"][type='checkbox']").attr('checked', $('#checkAll').is(':checked'));
}

// display staff profile for user matches paramter id
function show_staff_profile_dialog(id) {
	$.post("http://www.limelightstaff.com/index.php/admin/users/test", { user_id: id },
		function(data){
			$("span#jqdialog").html( data );
			$('div#jqdialog').dialog('open');
		});
	return false;
}

$(document).ready(function() {
	$('#listToFilter').listFilter('#criteria');
	$('#sortable1').listFilter('#criteria');
	// sort table on admin staff list page - by surname(2) asc , forename(1) asc
	$("#stafflist").tablesorter( {sortList: [[2,0], [1,0]]} );
	//$("table#applications").tablesorter({ sortList:[[5,1]], headers:{0:{sorter:false}} });
	$("#accordion").accordion( {autoHeight: false, navigation: true, collapsible: true, active: false} );
});
	

