$(function()
{
	
	/*
	$('#indexnavRight ul li')
		.mouseover(function()
		{
			$(this).append('<img class="sideEnd" src="/img/sideNavTabEnd.gif" alt="" style="display:block;position:absolute;left:-17px;top:10%;" />')
			.css({'position':'relative', 'left':'-25px', 'width':'257px'});

			// ftw.
			if ( $.browser.msie )
			{
				$(this).css({'margin-bottom':'-4px'});
			}
			
		})
		.mouseout(function()
		{
			$('img.sideEnd', $(this)).remove();
			$(this).css({'left':'0', 'width':'222px'});
			
			// ftw.
			if ( $.browser.msie )
			{
				$(this).css({'margin-bottom':'0'});
			}
			
		})
	;
	*/

	

	$('.mini').css({'opacity':'0.7'});
	
	

	
	
	
	$('#copyAddressToDeliveryButton').click(function()
	{
		copyAddressToDelivery();
	});
	
	
	
	
	
	
	// go through each form assigning a handler to save buttons
	// making sure that all labels 
	var errorAlert = '<div id="errorAlert">\
						<strong>Error</strong><br/>\
						Please fill in all required fields (marked with a <img src="/admin/img/icons/bullet_red.png" />) before submitting the form.\
						</div>';

	//$('form input:submit').click(function()
	$('form').submit(function()
	{
		var ret = true;
		var f = $(this).parent();
		$('label[class="required"]').each(function()
		{
			var lf = $(this).attr('for');
			var e = $('*[name="' + lf + '"]', f);
			var v = e.val();
			if ( v == '' )
			{
				e.addClass('errorInput').effect("pulsate", { times: 3 }, 150);
				$('#errorAlert').remove();
				$('p.adminDescription').after(errorAlert);
				$('#errorAlert').show();
				ret = false;
			}
			else
			{
				$('#errorAlert').hide();
				e.removeClass('errorInput');
				// ret = true;
			}
		});
		return ret;
	});
	
	
	
	
	
	
	// center and vertically align:middle the images for cats, subs and groups.
	setTimeout("centerCenterImage()", 500);
	
	
	
	
	// ie7 fixes
	if ( $.browser.msie && $.browser.version <= 7 )
	{
		$('#builderLeft').css({'width': '520px'});
		$('#builderRight').css({'width': '382px', 'float':'right'});
		$('#navigationWrap').css({'background': 'black'});
		// $('#navigationWrap img').css({'display': 'none'});
	}
	
	
});