jQuery(document).ready(function() {
	populate_select(jQuery('#f_search_make'), guideauto[guide_auto_edition]);

	jQuery('#f_search_make').change(function() {
		if (typeof(guideauto[guide_auto_edition]) != 'object') return;
		o = jQuery('#f_search_model').empty();
		populate_select(o, guideauto[guide_auto_edition][this.value]);
	});

	jQuery('#f_search .submit').click(function() {
		try {
			if (typeof(guideauto[guide_auto_edition]) != 'object') return;
			make  = jQuery('#f_search_make' ).find('option:selected').attr('value');
			model = jQuery('#f_search_model').find('option:selected').attr('value');
			m = guideauto[guide_auto_edition][make][model]['id'];
			if (m) window.location = site_w_path +'articles/'+ m +'/';
		}
		catch(e) {}
	});
});
