// toggle an element
function tog(id,erfa_id) {
	var ajax_url = $("#ajax_url").attr("value");
	$('#t' + id).load(ajax_url + "?erfa_summary=" + erfa_id);

	// JQuery toggle method apparently does not work in IE8 for TR's defined as "display: none"
	var cv = $('#h' + id);
	if(cv.hasClass("visible")) {
		cv.removeClass("visible");
		cv.hide();
	} else {
		cv.addClass("visible");
		cv.show();
	}
}

function show_receipt() {
	// redirect to the receipt page, which will immediately handle the stored request.
	var receipt_url = $("#receipt_url").attr("value");
	window.location = receipt_url;
}

// submit the form which will request CVs
function submit_consultant_form() {
	// store the request for CVs in the session, using AJAX.
	var options = {'complete' : function(request, status) {show_receipt();} };
	$("#consultants_form").ajaxSubmit(options);
}

function submit_consultant_search_form() {
	if(document.getElementById('formjobbranch').selectedIndex>0 && document.getElementById('formjobregion').selectedIndex>0 && document.getElementById('formjobtype').selectedIndex>0) {
		document.consultantSearch.submit();
	}
}

$(document).ready(function() { 
	// only show the table after onload, as the table will be split into pages by tablesorter
	$("#jlist_container").show();

/*
	// show table with tablesorter
	$("table") 
		.tablesorter({widthFixed: true}) 
		.tablesorterPager({container: $("#pager"), positionFixed: false, seperator: ' af ', size: 20}); 
	
	// do not allow sorting of table columns
	$("#jlist_container th").unbind();
*/
}); 

