function markTR(trid, idItem) {
	if (document.konfForm["opt" + trid].length > 0) {trObj = document.konfForm["opt" + trid][idItem]} else {trObj = document.konfForm["opt" + trid]}
	if (trObj.checked != 1) {document.getElementById("trId" + trid + "_" + idItem).style.backgroundColor = "#dcdcdc"}
}

function unmarkTR(trid, idItem) {
	if (document.konfForm["opt" + trid].length > 0) {trObj = document.konfForm["opt" + trid][idItem]} else {trObj = document.konfForm["opt" + trid]}
	if (trObj.checked != 1) {document.getElementById("trId" + trid + "_" + idItem).style.backgroundColor = "white"}
}

function konfPriceSetV1() {

	if (document.konfForm) {

	if (document.konfForm.opts.value > 0) {

		price = 0;
		priceFull = 0;
		priceDef = 0;
		pricevat = 0;
		priceFullVat = 0;

		for (idO = 0; idO < document.konfForm.opts.value; idO ++ ) {

			if (typeof(document.konfForm["opt" + idO].length) != "number") {
				document.getElementById("trId" + idO + "_0").style.backgroundColor = "white";
				if ((document.konfForm["opt" + idO].checked == 1)  || (document.konfForm["opt" + idO].type.toLowerCase() == "hidden")) {
					price += parseFloat(document.konfForm["optP_" + idO + "_0"].value);
					priceFull += parseFloat(document.konfForm["optPF_" + idO + "_0"].value);
					if (document.konfForm["opt" + idO].type.toLowerCase() != "hidden") document.getElementById("trId" + idO + "_0").style.backgroundColor = trBgColor;
				}
			} else {
				for (idT = 0; idT < document.konfForm["opt" + idO].length; idT ++) {
					document.getElementById("trId" + idO + "_" + idT).style.backgroundColor = "white";
					if (document.konfForm["opt" + idO][idT].checked == 1) {
						priceDef = parseFloat(document.konfForm["optP_" + idO + "_" + idT].value);
						price += parseFloat(document.konfForm["optP_" + idO + "_" + idT].value);
						priceFull += parseFloat(document.konfForm["optPF_" + idO + "_" + idT].value);
						document.getElementById("trId" + idO + "_" + idT).style.backgroundColor = trBgColor;
					}
				}

				if (isKonfigTC == 1) {
					for (idT = 0; idT < document.konfForm["opt" + idO].length; idT ++) {	
						priceN = Math.round(((parseFloat(document.konfForm["optP_" + idO + "_" + idT].value) - priceDef)*document.konfForm.vat.value)/10000)
						if (priceN == 0) {
							if (document.konfForm["opt" + idO][idT].checked == 1) {
								document.getElementById("priceId" + idO + "_" + idT).innerHTML = ""
							} else {
								document.getElementById("priceId" + idO + "_" + idT).innerHTML = "&nbsp;&nbsp;&nbsp;+&nbsp;0&nbsp;" + crnc
							}
						} else {
							if (priceN > 0) {
								document.getElementById("priceId" + idO + "_" + idT).innerHTML = "&nbsp;&nbsp;&nbsp;+" + numberStyle(priceN, 0) + "&nbsp;" + crnc
							} else {
								document.getElementById("priceId" + idO + "_" + idT).innerHTML = "&nbsp;&nbsp;&nbsp;-" + numberStyle(-1*priceN, 0) + "&nbsp;" + crnc
							}
						}
					}
				}
			}

		}

		//price = (price);
		//priceFull = (priceFull);

		pricevat = ((price*document.konfForm.vat.value)/10000);
		priceFullVat = ((priceFull*document.konfForm.vat.value)/10000);

		if (document.konfForm.cntCode.value == "cze") {
			if (document.getElementById("idprice")) {document.getElementById("idprice").innerHTML = numberStyle(Math.round(price/100), 0)};
			if (document.getElementById("idpricevat")) {document.getElementById("idpricevat").innerHTML = numberStyle(pricevat, 0)};
		}

		if (document.konfForm.cntCode.value == "slo") {
			if (document.getElementById("idpricevat")) {document.getElementById("idpricevat").innerHTML = numberStyle(pricevat*100, 2)};
			if (document.getElementById("idprice")) {document.getElementById("idprice").innerHTML = numberStyle(Math.round(pricevat * document.konfForm.exchRate.value / 1000)*100, 2)};
		}

		if (parseInt(isPriceDisc) == 1) {
			disc = Math.round((((priceFull-price))/priceFull)*1000);
			if (document.getElementById("idpricedisc")) {
				discS = disc/10
				discS = discS.toFixed(1)
				discS = discS.replace(".", ",")
				document.getElementById("idpricedisc").innerHTML = discS
			};
			if (document.getElementById("idpricediscfull")) {
				if (document.konfForm.cntCode.value == "cze") {document.getElementById("idpricediscfull").innerHTML = numberStyle(priceFullVat, 0)};
				if (document.konfForm.cntCode.value == "slo") {document.getElementById("idpricediscfull").innerHTML = numberStyle(priceFullVat*100, 2)};
			}
			if (document.getElementById("idpricediscF")) {
				if (document.konfForm.cntCode.value == "cze") {
					discF = ((priceFull*document.konfForm.vat.value)/10000) - ((price*document.konfForm.vat.value)/10000).toFixed(0);
					document.getElementById("idpricediscF").innerHTML = numberStyle(discF, 0);
				}
				if (document.konfForm.cntCode.value == "slo") {
					discF = ((priceFull*document.konfForm.vat.value)/10000).toFixed(2) - ((price*document.konfForm.vat.value)/10000).toFixed(2);
					document.getElementById("idpricediscF").innerHTML = numberStyle(discF*100, 2);}
			}
		}

	}

	}


}

function checkItem(trid, idItem) {

	if (document.konfForm["opt" + trid].length > 0) {
		document.konfForm["opt" + trid][idItem].checked = 1
	} else {
		if (document.konfForm["opt" + trid].checked == 1) {
			document.konfForm["opt" + trid].checked = 0
		} else {
			document.konfForm["opt" + trid].checked = 1
		}
	} 

	konfPriceSetV1()
}


function showImgL_v1(konfId) {

	imgUrl = "productImg.asp?konfId=" + konfId

	var rt = window.open(imgUrl, "_imgPic", "toolbar=no, status=yes, scrollbars=yes, resizable=yes, location=no, menubar=no, titlebar=no, directories=no, width=650, height=650, top=100, left=100");
	rt.focus()

}

function showImgL(konfId) {

	var objX = 0;
	var objY = 0;
	objX = 180
	objY  = document.body.scrollTop + 150

	urlFrm = "/productImg.asp?konfId=" + konfId

	frameT = "<div style=\"margin-top:-10px;padding-right:10px;padding-bottom:10px;font-size:8pt;z-index:20;text-align:right;\">x <a href=\"javascript:prodDescrHelpHide()\" class=\"asmall\" style=\"text-decoration:underline\">" + winCloseLabel + "</a>&nbsp;"
	frameT += "&nbsp;<span style=\"color:silver;font-weight:normal\">(" + winCloseLabelK + ")</span></div>"
	frameT += "<iframe name=frmSet id=frmSet width=600 height=600 noresize scrolling=auto background-color=white frameborder=0 src=\"" + urlFrm + "\"></iframe>"

	document.getElementById("idProdDescrH").style.left = objX +'px';
	document.getElementById("idProdDescrH").style.top = objY + 'px'; 
	document.getElementById("idProdDescrH").style.width = "620"
	document.getElementById("idProdDescrHT").style.width = "610"
	document.getElementById("idProdDescrH").style.display = "block"
	document.getElementById("idProdDescrHT").innerHTML = frameT

}

function showKonfTab(tabId) {

	if (document.getElementById("idKonfSpecifLabel")) document.getElementById("idKonfSpecifLabel").style.backgroundColor = "silver"
	if (document.getElementById("idKonfCmptbLabel")) document.getElementById("idKonfCmptbLabel").style.backgroundColor = "silver"
	if (document.getElementById("idKonfRelatedLabel")) document.getElementById("idKonfRelatedLabel").style.backgroundColor = "silver"
	if (document.getElementById("idKonfFaqLabel")) document.getElementById("idKonfFaqLabel").style.backgroundColor = "silver"

	if (document.getElementById(tabId + "Label")) document.getElementById(tabId + "Label").style.backgroundColor = cssColorDef

	if (document.getElementById("idKonfSpecif")) document.getElementById("idKonfSpecif").style.display = "none"
	if (document.getElementById("idKonfCmptb")) document.getElementById("idKonfCmptb").style.display = "none"
	if (document.getElementById("idKonfRelated")) document.getElementById("idKonfRelated").style.display = "none"
	if (document.getElementById("idKonfFaq")) document.getElementById("idKonfFaq").style.display = "none"

	if (document.getElementById(tabId)) document.getElementById(tabId).style.display = ""	

}

function frm_ProdShow(pns) {

	var objX = 0;
	var objY = 0;
	objX = 180
	objY  = document.body.scrollTop + 150

	urlFrm = "/productFinfo.asp?pns=" + pns

	frameT = "<div style=\"margin-top:-10px;padding-right:10px;padding-bottom:10px;font-size:8pt;z-index:20;text-align:right;\">x <a href=\"javascript:prodDescrHelpHide()\" class=\"asmall\" style=\"text-decoration:underline\">" + winCloseLabel + "</a>&nbsp;"
	frameT += "&nbsp;<span style=\"color:silver;font-weight:normal\">(" + winCloseLabelK + ")</span></div>"
	frameT += "<iframe name=frmSet id=frmSet width=600 height=600 noresize scrolling=auto background-color=white frameborder=0 src=\"" + urlFrm + "\"></iframe>"

	document.getElementById("idProdDescrH").style.left = objX +'px';
	document.getElementById("idProdDescrH").style.top = objY + 'px'; 
	document.getElementById("idProdDescrH").style.width = "620"
	document.getElementById("idProdDescrHT").style.width = "610"
	document.getElementById("idProdDescrH").style.display = "block"
	document.getElementById("idProdDescrHT").innerHTML = frameT

}


