jQuery(document).ready(function() {
	jQuery('#archives div.archives_year').hide();
	y = jQuery('#f_archives_ym_years option:selected').attr('value');
	jQuery('#archives div.archives_year').filter('#archives_ym_'+ y).show();

	jQuery('#f_archives_ym_years').change(function() {
		jQuery('.archives_year')
			.hide()
			.filter('#archives_ym_'+ jQuery(this).find('option:selected').attr('value'))
			.fadeIn()
			.focus();
	});

	jQuery('#f_archives_ym_cat').submit(function() {
		ym  = jQuery(this).find('select[name=ym]  option:selected').attr('value');
		cat = jQuery(this).find('select[name=cat] option:selected').attr('value');
		window.location = site_w_path +'news/'+ (cat ? cat +'/' : '') + (ym ? '?ym='+ ym : '');
		return false;
	});

	populate_select(jQuery('#f_vehiculezone_make'), makes);
	jQuery('#f_vehiculezone_make').change(function() {
		o = jQuery('#f_vehiculezone_model').empty();
		populate_select(o, makes[this.value]);
	});
	jQuery('#f_vehiculezone .submit').click(function() {
		try {
			make  = jQuery('#f_vehiculezone_make' ).find('option:selected').attr('value');
			model = jQuery('#f_vehiculezone_model').find('option:selected').attr('value');
			window.location = site_w_path +'makes/'+ make +'/'+ model +'/';
		}
		catch(e) {}
	});
	
});
