function km_extendedOnload() {
	if (window.hidePob)
		get_object('pob_'+hidePob).style.display='none';
}
var buy={
	addItem: function(id) {
		window.location.href='index.cfm?pg='+pg+'&act=addItm&id='+id;
	},
	updateCart: function(theForm) {
		var zitId_array=theForm.zitIdList.value.split(',');
		var totalPrice=shippingCost;
		var zitPrice,zitQty,zitTotalPrice,zitId;
		for (var i=0;i<zitId_array.length;i++) {
			zitId=zitId_array[i];
			zitPrice=eval('theForm.zitPrice_'+zitId).value;
			zitQty=parseInt(eval('theForm.zitQty_'+zitId).value);
			if (isNaN(zitQty)) {
				zitQty=0;
				eval('theForm.zitQty_'+zitId+'.value=0;');
			}
			zitTotalPrice=zitQty*zitPrice;
			get_object('itemTotalPrice_'+zitId).innerHTML=zitTotalPrice+' Kr';
			totalPrice+=zitTotalPrice;
		}
		get_object('table_buy_toPayAmount').innerHTML=totalPrice+' Kr';
	},
	purchase: function(theForm) {
		var er='';
		if (trim(theForm.f_name.value).length == 0)
			er+='\n* Namn måste anges';
		if (trim(theForm.f_address.value).length == 0)
			er+='\n* Adress måste anges';
		if (trim(theForm.f_zip.value).length == 0)
			er+='\n* Postort måste anges';
		if (trim(theForm.f_city.value).length == 0)
			er+='\n* Stad måste anges';
		if (trim(theForm.f_phone.value).length == 0)
			er+='\n* Telefon måste anges';
		if (er.length == 0)
			buy.commitPurchase(theForm);
		else
			alert("Felmeddelande:"+er);
	},
	commitPurchase: function(theForm) {
		theForm.act.value='buyCDs';
		theForm.ZOR_int_Total.value=parseInt(get_object('table_buy_toPayAmount').innerHTML);
		theForm.submit();
	},
	saveCartQty: function(theForm) {
		theForm.act.value='saveCartQty';
		theForm.submit();
	},
	emptyCart: function(theForm) {
		theForm.act.value='emptyCart';
		theForm.submit();
	}
}
function doBuyTicket(theForm) {
	var er='';
	if (getCheckedRadioValue(theForm.zevId) == '')
		er+='\n* Du måste välja föreställning';
	if (!isValid('positiveInteger',trim(theForm.f_qty.value)))
		er+='\n* Du måste ange antal biljetter';
	if (trim(theForm.f_name.value).length == 0)
		er+='\n* Namn måste anges';
	if (trim(theForm.f_address.value).length == 0)
		er+='\n* Adress måste anges';
	if (trim(theForm.f_zip.value).length == 0)
		er+='\n* Postort måste anges';
	if (trim(theForm.f_city.value).length == 0)
		er+='\n* Stad måste anges';
	if (trim(theForm.f_phone.value).length == 0)
		er+='\n* Telefon måste anges';
	if (er.length == 0)
		theForm.submit();
	else
		alert("Felmeddelande:"+er);
}
function updatePay() {
	var theForm=document.form_tickets;
	var qty=trim(theForm.f_qty.value);
	var zevId=getCheckedRadioValue(theForm.zevId);
	var showPay=false;
	if (zevId != '' && isValid('positiveInteger',qty)) {
		showPay=true;
		get_object('pay_ticketQty').innerHTML=qty+' st';
		var evnPrice=parseInt(get_object('zevPrice_'+zevId).value);
		get_object('pay_ticketPrice').innerHTML=evnPrice+' kr';
		var totalPrice=parseInt(evnPrice*qty+shippingCost);
		get_object('pay_total').innerHTML=totalPrice+' kr';
		theForm.ZTO_int_Total.value=totalPrice;
	}
	get_object('pay').style.display=(showPay)?'block':'none';
}
