$(document).ready(function() { 
	$('#chart').hide();

	$('#year').bind('change',function () {
		$('#comp').attr('disabled',true);
		$('#crew').attr('disabled',true);
		sel = $('#year').val();
		if (sel != 'x') {
			$('#comp').load('lib/charts-ajax.php?action=comps&y='+sel); 
			$('#comp').attr('disabled',false);
		}
	});

	$('#comp').bind('change',function () {
		$('#crew').attr('disabled',true);
		$('#chart').show();
		sel = $('#comp').val();
		if (sel != 'x') {
			swfobject.embedSWF("lib/open-flash-chart.swf", "chart", "800", "700", "9.0.0","expressinstall.swf",{"data-file":"lib/charts-ajax.php?action=eventcharts%26c=" + sel});
			$('#crew').load('lib/charts-ajax.php?action=crews&c='+sel); 
			$('#crew').attr('disabled',false);
		}
	});

	$('#crew').bind('change',function () {
		$('#chart').show();
		sel = $('#crew').val();
		if (sel != 'x' && sel != 'a') {
			swfobject.embedSWF("lib/open-flash-chart.swf", "chart", "800", "450", "9.0.0","expressinstall.swf",{"data-file":"lib/charts-ajax.php?action=crewcharts%26c=" + sel});
		}
		else if (sel != 'x') {
			sel = $('#comp').val();
			swfobject.embedSWF("lib/open-flash-chart.swf", "chart", "800", "450", "9.0.0","expressinstall.swf",{"data-file":"lib/charts-ajax.php?action=allcrewcharts%26c=" + sel});
		}
	});

});
