$(document).ready(function(){       
	// controls the slidedown/up of custom select menus
	$('.select, .wine_select').not('.acclaim_select').hover(
		function () {
	        $(this).find('ul').show();
	      }, 
	      function () {
	        $(this).find('ul').hide();
	      }
	);
	
	// set acclaim selects to open on click (instead of hover)
	$('.acclaim_select').click(function(){
		if ($(this).hasClass('acclaimOpen')) {
			$(this).removeClass('acclaimOpen').find('ul').slideUp('fast');
		} else {
			$('.acclaimOpen').removeClass('acclaimOpen').find('ul').slideUp('fast');
			$(this).addClass('acclaimOpen').find('ul').slideDown('fast');
		}
		return false;
	});
	
	// sets the choice from a custom select to a hidden input
	var value = null;
	$('.select_item').click(function() {
		value    = $(this).attr('rel');
		var item = $(this).attr('class').split(" ");
		var text = $(this).text();
		item     = item[0];
		$('#'+item+'First').text(text);
		$(this).parent().parent().slideUp('fast');
		$('label[for*='+item+'Input]').hide(); // this is a hack that hides the jquery validation plugin's error fields upon selection.
		$('#'+item+'Input').val(value).focus().blur();
	});
	
	//all outbound links target new
	$('a[href*=http://]').attr('target','_blank');
	
	//all store links target self
	$('a[href*=store.]').attr('target','_self');
	
});