$(document).ready(function()
	{	
	
		$('#delivery-same').change(function() 
			{
				if($(this).val()=='1') {
					$('#delivery-1').val($('#billing-1').val());
					$('#delivery-2').val($('#billing-2').val());
					$('#delivery-3').val($('#billing-3').val());
					$('#delivery-4').val($('#billing-4').val());
					$('#delivery-5').val($('#billing-5').val());
					$('#delivery-6').val($('#billing-6').val());
					$('#delivery-7').val($('#billing-7').val());
					$('#delivery-8').val($('#billing-8').val());
				}
			}
		);
		
		$('#customer-reg form').submit(function()
			{
				var retval = true;
				$('#customer-reg form input').each(function()
				{
					if($(this).attr('title')=='required') {
						if($(this).val() == '') {
							alert('Please make sure you fill in all required fields');
							retval = false;
							return false;
						}
					}
					//return true;
				});
				if($('#customer-reg #password').val() != $('#customer-reg #passwordRpt').val()) {
					alert('Please make sure both passwords you enter are the same');
					retval = false;
				}
				return retval;
			}
		);
		
		$('#quotation-form').submit(function()
			{
				var retval = true;
				$('#quotation-form input').each(function()
				{
					if($(this).attr('title')=='required') {
						if($(this).val() == '') {
							alert('Please make sure you fill in all required fields');
							retval = false;
							return false;
						}
					}
					//return true;
				});
				return retval;
			}
		);
		
		$('input.cart-delete').click(function ()
			{
				var sure = confirm('Are you sure you\'d like to remove this item from your basket?');
				if(sure) {
					return true;
				}
				return false;
			}
		)
		
		$('a.mustlogin').click(function () {
			alert('Please log in using the form at the top of the page before checking out.\n\nIf you are not registered with Syne Graphics, please click \'New Customer\'');
		}
		);
		
		$('a').each(function() {
			if($(this).attr('rel')=='lightbox') $(this).lightBox();
		}
		);
		
		$('table#jobs select').change(function() {
				$(this).parent('form').submit();
			}
		);
		$('table#invoices select').change(function() {
				$(this).parent('form').submit();
			}
		);
		
	}
);

$(function() {
   $('#product-pics a').lightBox();

});

function unitShow(units) {
			$('#units-mm').hide();
			$('#units-m').hide();
			$('#units-ftin').hide()
			$('#units-'+units).show();
		}
