/*var inner = $(".subselect a");
  $('#loadingDiv')
    .hide()  // hide it initially
    .ajaxStart(function() {
        $(this).show();
    })
    .ajaxStop(function() {
        $(this).hide();
    })
;

  
  $(function(){
	$('select#model').selectmenu({
		width: 160,
		select: function(event, options) {
			$("#centremain").html('<div id="loadingDiv"></div>');
			$("#loadingDiv").html('<img src="images/spinner.gif" alt="Wait" /><br/>Please wait, fetching results');
			$.ajax({
				type: "GET",
				url: "modelcats.php",
				async: false,
				data: "model=" + options.value,
				success: function(value) {
					// add the returned HTML 
					$("#centremain").hide();
					$("#centremain").html(value).find(".subselect a").click(function(){
						$("#centremain").html('<div id="loadingDiv"></div>');
						$("#loadingDiv").html('<img src="images/spinner.gif" alt="Wait" /><br/>Please wait, fetching results');
						$.ajax({
							type: "GET",
							url: "deptcats.php",
							async: false,
							data: $(this).attr("rel"),
							success: function(value) {
								//alert("it is doing something");
								// add the returned HTML 
								$("#centremain").html(value).find(".search a").click(function(){
									$("#centremain").html('<div id="loadingDiv"></div>');
									$("#loadingDiv").html('<img src="images/spinner.gif" alt="Wait" /><br/>Please wait, fetching results');
									$.ajax({
										type: "GET",
										url: "results.php",
										async: false,
										data: $(this).attr("rel"),
										success: function(value) {
											//alert("it is doing something");
											// add the returned HTML 
											//alert("it is doing something");
											// add the returned HTML 
											$("#centremain").html(value).find("select#department").selectmenu({
												width: 160,
												select: function(event, options) {
													
													$("#centremain").html('<div id="loadingDiv"></div>');
													$("#loadingDiv").html('<img src="images/spinner.gif" alt="Wait" /><br/>Please wait, fetching results');
													$.ajax({
														type: "GET",
														url: "filterdept.php",
														async: false,
														data: "department=" + options.value,
														success: function(value) {
															$("#centremain").hide();
															$("#centremain").show("slow");
															$("#loadingDiv").hide();
															alert("department=" + options.value);
														}
													});
												}
											});
												$("#deptholder").show("slow");
												$("#typeholder").show("slow");
											$("#centremain").html(value).find("select#type").selectmenu({
												width: 160,
												select: function(event, options) {
													
													$("#centremain").html('<div id="loadingDiv"></div>');
													$("#loadingDiv").html('<img src="images/spinner.gif" alt="Wait" /><br/>Please wait, fetching results');
													$.ajax({
														type: "GET",
														url: "results.php",
														async: false,
														data: "department=" + options.value,
														success: function(value) {
															$("#centremain").hide();
															$("#centremain").show("slow");
															$("#loadingDiv").hide();
															alert("department=" + options.value);
														}
													});
												}
											});
											$("#centremain").show("slow");
										}
									});
									return false;
								});
								$("#centremain").show("slow");
							}
						});
						return false;
					});
					$("#centremain").show("slow");
					$("#loadingDiv").html('');
				}
			});

			$.ajax({
						type: "GET",
						url: "filterdept.php",
						data: "cPath=" + options.value,
						success: function(value) {
							// add the returned HTML (the new select)
							$("#deptholder").hide();
							$("#deptholder").html(value).find("select").selectmenu({
								width: 160,
								select: function(event, options) {
									$.ajax({
										type: "GET",
										url: "filter.php",
										data: "cPath=" + options.value,
										success: function(value) {
											// add the returned HTML (the new select)
											$("#typeholder").hide();
											$("#typeholder").html(value).find("select").selectmenu({
												width: 160,
												select: function(event, options) {
													$.ajax({
														type: "GET",
														url: "filtercond.php",
														data: "cPath=" + options.value,
														success: function(value) {
															// add the returned HTML (the new select)
															$("#condholder").hide();
															$("#condholder").html(value).find("select").selectmenu({
															width: 160
														});
															$("#condholder").show("slow");
														}
													});
												}
											});
											$("#typeholder").show("slow");
											$("#condholder").hide();
										}
									});
								}
							});
							$("#deptholder").show("slow");
							$("#typeholder").hide();
							$("#condholder").hide();
							
						}
					});
		}
	});

			$('select#department').selectmenu({
				width: 160
			});
			$('select#condition').selectmenu({
				width: 160
			});
			$('select#type').selectmenu({
				width: 160
			});

  });*/
  
  $(function(){

			$('select#department').selectmenu({
				width: 160,
				select: function(event, options) {
					$("#quick_find1").submit();
				}
			});
			
			$('select#type').selectmenu({
				width: 160,
				select: function(event, options) {	
					$("#quick_find1").submit();
				}
			});

			
			
			$('select#model').selectmenu({
				width: 160,
				select: function(event, options) {
					//$("#quick_find1").submit();
				}
			});
			
			$('select#department').selectmenu({
				width: 160
			});
			$('select#condition').selectmenu({
				width: 160,
				select: function(event, options) {	
					$("#quick_find1").submit();
				}
			});
				
			
			$('select#condition2').selectmenu({
				width: 160,
				select: function(event, options) {	
				
					$('select#condition').val($(this).val());
					$("#quick_find1").submit();
				}
			
			});
			$('select#type').selectmenu({
				width: 160
			});

  });
