$(document).ready(function(){
	$("#products").change(function() {
		var loc;
		if($("#type").val() == "all") {
			loc = "/products/" + $(this).val();
		} else {
			loc = "/products/" + $(this).val() + "/type/" + $("#type").val();
		}
		formGo(loc);
	});

	$("#type").change(function() {
		var loc;
		loc = "/products/" + $("#products").val() + "/type/" + $(this).val();
		formGo(loc);
	});

	$("#multisubmit").click(function() {
		$("#products").attr('disabled', true);
		var loc;
		loc = "/products/" + $("#products").val() + "/type/" + $("#type").val();
		formGo(loc);
	});

	//$(".filters").$("#view").change(function() {
	//	alert($(this).val());
	//});

});

function formGo(loc) {
	$("#products").attr('disabled', true);
	$("#type").attr('disabled', true);
	$("#multisubmit").attr('disabled', true);
	window.location.pathname = loc;
	// shouldn't get here
	//$("#multisearchform").attr("action", loc);
	//$("#multisearchform").submit();
}

