$(function() {
   // handeling the search form	$('#search_form select').change( function() {		// switch keywords availibility
      if ($('#manufacturer')[0].value!='' || $('#body')[0].value!='' || $('#start_price')[0].value!='0' || $('#end_price')[0].value!='0')
         $('#keywords')[0].disabled = true;
      else $('#keywords')[0].disabled = false;
      var changed_el = this;
      $('#search_form select').not('#change_currency_select').not('#'+changed_el.name).each(function (el) {
      	   this.disabled=true;
      	   $('#'+this.name).load('inc/get_search_list.php', {      	   	manufacturer: $('#manufacturer')[0].value,
      	   	body: $('#body')[0].value,
      	   	start_price: $('#start_price')[0].value,
      	   	end_price: $('#end_price')[0].value,
      	   	get_type: this.name},
      	   	function() {      	   		this.disabled=false;
      	   		//changed_el.selected

      	   	}
      	   );
		});
	});
	//if ($('#manufacturer')[0].value!='') $('#search_form select').trigger('change');


	// dealer select
	$('#dealer_select').change( function() {		/*var url;
		url = this[this.selectedIndex].text;
		url = url.replace(/([^a-zA-Z\-])/g,'-');
		url = url.replace(/\-+/g,'-'); */
		//url = url.replace('[^a-zA-Z\-]','-');
		//url = url.replace(' ','-');
		//url = url.replace(' ','-');
		//alert(this.selectedIndex);
		if (this.selectedIndex==0) window.location = 'index.html';
	   else window.location = 'dealer_' + this[this.selectedIndex].value+'.html';
	});

	$('#change_currency_select').change( function() {      $('#change_currency')[0].value = this[this.selectedIndex].value;
      $('#form_usd').submit();
	});

});
