/*
 * JQuery commands for new job search.
 * itomic 05/2009 alexb
 */

$j(document).ready(function() {
  
	// Let's strip out whats in the form first!
	$j("select#sectorfield").removeOption(/./);
	$j("select#sectorfield").addOption("", "All Sectors");
	$j("select#subsec").removeOption(/./);
	$j("select#subsec").addOption("", "All SubSectors");
	
	// Let's dynamically get the parent categories.
	$j("select#sectorfield").ajaxAddOption("../ajax/select.php", {'type':'parent'}, false);

	// Let's now attach the events.
	$j("select#sectorfield").change(function(){
		$j("select#subsec").removeOption(/./);
		$j("select#subsec").addOption("", "All SubSectors");
		$j("select#subsec").ajaxAddOption("../ajax/select.php", {'type':'child','sect':$j("select#sectorfield").val()}, false);
	})
});
