function loadID(n) {
	var id = prompt('Zadajte ID produktu','');
	if(id!=null)
		document.getElementById('title'+n).value = '='+id;
}

function akcie(up,item,value) {
	window.open(up+'akcie.php?mid='+item+'&value='+value,'editWindow','resizable=no,scrollbars=no,status=yes,width=730,height=550,menubar=no');
}

function novinky(up,item,value) {
	window.open(up+'novinky.php?mid='+item+'&value='+value,'editWindow','resizable=no,scrollbars=no,status=yes,width=730,height=550,menubar=no');
}


function buy_item(item,amount,amount2) {
	if(amount%amount2 == 0) {
		; //OK
	}
	else {
		amountopr = amount2*Math.ceil(amount/amount2);
		alert("Nie je možné objednať "+amount+"ks (balené po "+amount2+").\nDávam preto do košíka "+amountopr+"ks.");
		amount = amountopr;
	}
	
	window.open(upPath+'buy.php?mid='+item+'&amount='+amount,'editWindow','resizable=no,scrollbars=no,status=yes,width=730,height=550,menubar=no');
}

function color_thumb_change(sel) {
	
	document.getElementById("color_value").innerHTML = document.getElementById("color_"+sel.value).innerHTML;

	for(var i=0; i!=-1; i++) {
		var img = document.getElementById("color_thumb_"+i);
		if(!img) break;
		
		if(i==sel.value)
			img.style.display="inline";
		else
			img.style.display="none";
	}
}


function toggleDisplay(elid) {
	var el = document.getElementById(elid);
	
	if(el) {
		if(el.style.display=="none")
			el.style.display="block";
		else
			el.style.display="none";
	}
}
