function enable_item(link, item)	{
	item.hide();
	link.show().click(function(){
		item.show();
		$(this).hide();
		return false;
	});
}

$(document).ready (function()	{
	$('.menu li').hover (function()	{
		$(this).children('ul').show();
	},function () {
		$(this).children('ul:not(.current)').hide();
	});
	$('.menu a[href=' + location.pathname + location.search + ']').addClass ('current').parents('ul').addClass('current').parent('li').children('a').addClass('current');
	$('.shopping_cart #billtoship').click (function()	{
		if ($(this).is(':checked'))	{
			$('.shipping_address').hide();
		} else {
			$('.shipping_address').show();
		}
	});
	$('.wholesale #billtoship').click (function()	{
		if ($(this).is(':checked'))	{
			$('.billing_address input').each(function()	{
				$('.shipping_address input[name="shipping['+$(this).attr('name').replace('billing[','').replace(']','')+']"]').attr('value',$(this).attr('value'));
			});
		} else {
			$('.shipping_address input').attr('value','');
		}
	});
	$('#wine-club #billtoship').click (function()	{
		if ($(this).is(':checked'))	{
			$('.billing_address input').each(function()	{
				$('.shipping_address input[name="shipping['+$(this).attr('name').replace('billing[','').replace(']','')+']"]').attr('value',$(this).attr('value'));
			});
		} else {
			$('.shipping_address input').attr('value','');
		}
	});
	$('input').checkBox();
	$('#bill_cc').click(function(){
		$('.credit_input').show();
		$('.billing_address').show();
		$('.shipping_address').show();
	});
	$('#bill_auto').click(function(){
		$('.credit_input').hide();
		$('.billing_address').show();
		$('.shipping_address').show();
	});
	$('#bill_file').click(function(){
		$('.billing_address').hide();
		$('.shipping_address').hide();
		$('.credit_input').hide();
	});
	$('#pick_up').click(function()	{
		if ($(this).is(':checked'))	{
			$('.shipping_address').hide();
			$('#dest_type_container').hide();
			$('#billtoship_container').hide();
		} else	{
			$('.shipping_address').show();
			$('#dest_type_container').show();
			$('#billtoship_container').show();
		}
	});
	enable_item($('#enable_edit_password'),$('.edit_password'));
	enable_item($('#enable_edit_cc'),$('.edit_cc'));	
});
