function startDomReady()
{
			shopcartInit();
			readMessages();
			
		//zmiana kryteria kolejnosci wyswietlania
		$('a.set_order').click(function() {
		var typ = $(this).attr('rel');
		
		$.cookie('set_order',typ );
		
		if($.cookie('set_type')=='asc'){
			$.cookie('set_type','desc');
		}else{
			$.cookie('set_type','asc');
		}
		location.reload();
		});
		// zapisz liste zakupowa
		$('#save_shoplist').click(function() {
				saveShopcartList();
		});
		// czasy dostawy
		$('div.delivery_button').live('click', function(){
				$('#choosed_hour').removeAttr('id');
				$(this).attr('id', 'choosed_hour');
				var newTime = $(this).attr('rel').split(';');
				// checkDeliveryTime();
				$('#deliveryTime').val(newTime[0]);
				$('#deliveryDate').text(newTime[1]);
				$('#deliveryHour').text(newTime[2]);
				var suggestedHour = newTime[3]+":00-"+(parseInt(newTime[3])+1)+":00";
				$('#suggestedHour').text(suggestedHour);
				if($('#deliveryDate').text()!='' && $('#deliveryHour').text()!='' && $('#suggestedHour').text()!='')
				{
					$('#deliveryDateRow').css('display', 'block');
					$('#deliveryHourRow').css('display', 'block');
					$('#suggestedHourRow').css('display', 'block');
				}
			});

		//wybor platnosci
		$("input[name='paymentType']").livequery('click', function(){
			var platnosci_pl = $('#platnosci_pl');
		    if ($(this).val() == 3)
		    {
		    	platnosci_pl.css('display', 'block');
		    }
		    else
		    {
		    	platnosci_pl.css('display', 'none');
		    }
		});
		$('#order_final').live('click', function() {
			if($('input[name=permit]').is(":checked") == false)
			{
				jAlert('musisz zaakceptować regulamin', 'Delikatesy Free');
			return false;
			}
			var paymentType = $("#paymentOptions input:radio:checked").val();
			switch(parseInt(paymentType))
			{
			case 1:
				location.href = 'shopcart_paymentok.html&payment_type=przelew';
				break;
			case 2:
				location.href = 'shopcart_paymentok.html&payment_type=przy_odbiorze';
				break;
			case 3: 
				document.payform.submit();
				break;
			default:
				location.href = 'shopcart_details.html';
				break;
			}
		});
		$('img[id^=pay-]').live('click', function() {
			var payType = $(this).attr('id').substring(4);
			$('#pay_type').val(payType);
			$('img.paymentChoice').removeAttr('class');
			$(this).attr('class', 'paymentChoice');
		});
		//chmurka
		$(".over_label").click(function()
				{
			var detailsId = '#'+$(this).attr('rel');
			if($(detailsId).css('display') == 'none')
			{
			$(this).text('ukryj »');
			$(detailsId).show();
			}
			else
			{
				$(this).text('pokaż »');
				$(detailsId).hide();
			}
			return false;
				});
		//przeladowanie produktu w detalach koszyka po zmianie ilosci
		$('img[id^=plus_]').click(function() {
			var prodid = $(this).attr('id').substring(5);
			loadXML(changeAmountUrl(prodid, 'inc'), 'changeAmountEffect', 'proditem_'+prodid);
		});
		$('img[id^=minus_]').click(function() {
			var prodid = $(this).attr('id').substring(6);
			loadXML(changeAmountUrl(prodid, 'dec'), 'changeAmountEffect', 'proditem_'+prodid);
		});
		//usuwanie listy zakupowej
		$('#delete_shoplist').click(function() {
			var listId = $('select[name=delivery_address]').val();
			location.href='shopcart_delivery.html&deletePos='+listId;
		});
		$('a[class^=enable_]').live('click', function(){
			var wno = $(this).attr('class').substring(7);
			if(wno == 'week_1')
			{
				$('div.week_0').css('display', 'none');
				$('div.week_1').css('display', 'inline-block');
				$('a.enable_week_1').css('display', 'none');
				$('a.enable_week_0').css('display', 'inline-block');
			}
			else{
				$('div.week_1').css('display', 'none');
				$('div.week_0').css('display', 'inline-block');
				$('a.enable_week_0').css('display', 'none');
				$('a.enable_week_1').css('display', 'inline-block');
			}
		});
}
