/*
 * Meni zpusob registrace v registracnim formu
 */
function changeUserDataFormType(bB2C) {
	getE("bB2C").value = (bB2C) ? "1" : "0";

	getE("b2bShowHide1").style.display = (bB2C) ? "none" : "";
	getE("b2bShowHide2").style.display = (bB2C) ? "none" : "";
	getE("b2bShowHide3").style.display = (bB2C) ? "none" : "";
	getE("b2bShowHide4").style.display = (bB2C) ? "none" : "";
	getE("b2bShowHide5").style.display = (bB2C) ? "none" : "";
	getE("b2cShowHide1").style.display = (!bB2C) ? "none" : "";
	getE("b2cShowHide2").style.display = (!bB2C) ? "none" : "";
	getE("b2cShowHide3").style.display = (!bB2C) ? "none" : "";
	getE("b2cShowHide4").style.display = (!bB2C) ? "none" : "";
	getE("b2cShowHide5").style.display = (!bB2C) ? "none" : "";
}

/*
 * Zmena zpusobu dopravy v kosiku
 */
function selectDelivery(nDelivery) {

	getE("rbDelivery" + nDelivery).checked = true;

	var sDeliveryCode = getE("txtDeliveryCode_" + nDelivery.toString()).value;
	var sDeliveryName = getE("txtDeliveryName_" + nDelivery.toString()).value;
	var nDeliveryPrice = parseFloat(getE("txtDeliveryPrice_" + nDelivery.toString()).value);
	var nDeliveryVAT = parseInt(getE("txtDeliveryVAT_" + nDelivery.toString()).value);
	var nDeliveryPriceWithVAT = nDeliveryPrice * ((100 + nDeliveryVAT) / 100);

	getE("txtDeliveryCode").value = sDeliveryCode;
	getE("txtDeliveryName").value = sDeliveryName;
	getE("txtDeliveryPrice").value = nDeliveryPrice;
	getE("txtDeliveryVAT").value = nDeliveryVAT;

	if (getE("trDelivery")) {
		if (nDeliveryPrice == 0) {
			getE("trDelivery").style.display = "none";
		}
		else {
			getE("tdDeliveryName").innerHTML = sDeliveryName;
			getE("tdDeliveryPrice1").innerHTML = FUCJS(nDeliveryPrice, 2, false);
			getE("tdDeliveryPrice2").innerHTML = FUCJS(nDeliveryPrice, 2, false);

			getE("trDelivery").style.display = "";
		}

		getE("tdPriceNoVATSum").innerHTML = FUCJS(gnPriceNoVATSum + nDeliveryPrice, 2, true);
		getE("tdPriceVAT").innerHTML = FUCJS((gnPriceWithVATSum - gnPriceNoVATSum) + (nDeliveryPriceWithVAT - nDeliveryPrice), 2, true);
		getE("tdPriceWithVATSum").innerHTML = FUCJS(gnPriceWithVATSum + nDeliveryPriceWithVAT, 2, true);
		getE("tdPriceWithVATSum2").innerHTML = FUCJS(gnPriceWithVATSum + nDeliveryPriceWithVAT, 2, true);

		for (var i = 0; i < aOrderVATs.length; i++) {
			var nTempID = aOrderVATs[i].ID;
			var nTempVAT = aOrderVATs[i].VAT;
			var nTempSumNoVAT = aOrderVATs[i].SumNoVAT + ((nTempVAT == nDeliveryVAT) ? nDeliveryPrice : 0);
			var nTempSumVAT = aOrderVATs[i].SumVAT + ((nTempVAT == nDeliveryVAT) ? (nDeliveryPriceWithVAT - nDeliveryPrice) : 0);
			var nTempSumWithVAT = aOrderVATs[i].SumWithVAT + ((nTempVAT == nDeliveryVAT) ? nDeliveryPriceWithVAT : 0);
			
			if (nTempSumNoVAT <= 0) {
				getE("trVAT" + nTempID.toString()).style.display = "none";
			}
			else {
				getE("tdVAT" + nTempID.toString() + "_SumNoVAT").innerHTML = FUCJS(nTempSumNoVAT, 2, false);
				getE("tdVAT" + nTempID.toString() + "_SumVAT").innerHTML = FUCJS(nTempSumVAT, 2, false);
				getE("tdVAT" + nTempID.toString() + "_SumWithVAT").innerHTML = FUCJS(nTempSumWithVAT, 2, true);

				getE("trVAT" + nTempID.toString()).style.display = "";
			}
		}
	}
}

// fce pro order_inc.asp

//	trDRsazba_....  radek danova sazba
//	tdDRbase_.....  bunka suma bez dph pro danou sazbu dph    (po sleve + doprava)
//	tdDRdph_.....   bunka suma dph pro danou sazbu dph
//	tdDRsum_.....   bunka suma s dph pro danou sazbu dph
// 	trDRround      radek zaokrouhleni
//	tdDRround       bunka zaokrouhleni
//	tdDRbase        bunka soucet vsech tdDRbase_...
//	tdDRdph         bunka soucet vsech tdDRdph_...
//	tdDRsum         bunka soucet vsech tdDRsum_...
//	tdDRSumToPay		bunka celková částka v rekapitulaci k zaplaceni

//	ValueTAX_...    hidden suma bez dph pro danou sazbu dph (po sleve bez dopravy)
//	DeliveryPrice   hidden cena dopravy
//	DeliveryDPH     hidden vyse DPH u zvolene dopravy

//	tdDelItemName				název dopravy
//	tdDelItemPrice			cena dopravy
//	tdDelItemDPH				sazba DPH dopravy
//	tdDelItemPriceDPH		cena dopravy včetně DPH

//	nSumPriceDPH		celková cena s DPH
//	nSumPriceNoDPH	celkova cena bez DPH

// function updateDeliveryPriceOnOrder(IdNewDelivery) {
// 
// 	var nPrice, nDPH, nPriceSum;
//     
//     if ( !getE('DeliveryPrice') || !getE('DeliveryPrice_'+IdNewDelivery)) {alert('Došlo k nečekané chybě');return false;}
//     
//     // -- puvodni hodnoty
//     var nPriceDelivery_Old = ConvertToNum( getE('DeliveryPrice').value );
//     var nDPHDelivery_Old   = ConvertToNum( getE('DeliveryDPH').value );
// 
//     // -- nove hodnoty
//     var nPriceDelivery     = ConvertToNum( getE('DeliveryPrice_'+IdNewDelivery).value );
//     var nDPHDelivery       = ConvertToNum( getE('DeliveryDPH_'+IdNewDelivery).value );
//     var sNameDelivery      = getE('DeliveryName_'+IdNewDelivery).value;
//     
//     // zapis novych hodnot do hidden
//     getE('DeliveryPrice').value = nPriceDelivery
//     getE('DeliveryDPH').value   = nDPHDelivery
//     getE('DeliveryName').value  = sNameDelivery
//  
//     //prepocet radku rekapitulace -> pro puvodni sazbu DPH u dopravy
//     nPrice = 0;
//     if (nDPHDelivery_Old == nDPHDelivery) nPrice =  nPriceDelivery;
//     ReSazba(nDPHDelivery_Old, nPrice)
//     
//     // pokud je sazba dph u dopravy pred a po zmene ruzna je treba prepocitat jeste novy radek
//     if (nDPHDelivery_Old != nDPHDelivery)     ReSazba(nDPHDelivery, nPriceDelivery);
//     
//     // vypocet souctu, zaokrouhleni
//     Summary(nPriceDelivery, nDPHDelivery)
//     
// 
//     if (getE('tdDelItemName')) getE('tdDelItemName').innerHTML = sNameDelivery;
// 
//     if (getE('tdDelItemPrice')) getE('tdDelItemPrice').innerHTML = FUCJS(nPriceDelivery,2,true);
// //    if (!getE('tdDelItemDPH')) {alert('neni tdDelItemDPH')};
//     if (getE('tdDelItemDPH')) getE('tdDelItemDPH').innerHTML = nDPHDelivery + '%';
// }

// function ReSazba(nDPHValue, nPrice) {
// 
// 	if (!getE('taxTable')) {alert('neni taxTable'); return false;}
// 	if (!getE('ValueTAX_'+nDPHValue)) {alert('ValueTAX_'+nDPHValue);}
// 	var nHidden = ConvertToNum( getE('ValueTAX_'+nDPHValue).value );
//     
//   nPrice += nHidden;
//     
//   var nDPH        = ConvertToNum(nPrice * 0.01 * nDPHValue );
//   var nPriceSum   = ConvertToNum(nPrice + nDPH);
//     
//     if (nPrice == 0) 
//     {
//          getE('trDRsazba_' + nDPHValue).style.display = 'none';
//     }
//     else
//     {
//         getE('tdDRbase_'  + nDPHValue).innerHTML = FUCJS(nPrice,2,true);
//         getE('tdDRdph_'   + nDPHValue).innerHTML  = FUCJS(nDPH,2,true);
//         getE('tdDRsum_'   + nDPHValue).innerHTML  = FUCJS(nPriceSum,2,true);
//         getE('trDRsazba_' + nDPHValue).style.display = '';
//     }
// }

// function Summary(nDeliveryPrice, nDeliveryDPH) {
//     var aSazby = new Array(0,5,19,22);    
//     var i, nSumPrice, nSumDPH, nSumPriceDPH, nPrice, nRound;
//     
//     nSumPrice = nSumDPH = nSumPriceDPH = nPrice = nRound = 0;
//     
//     for (i=0;i<aSazby.length;i++)
//     {
//         nPrice = ConvertToNum( getE('ValueTAX_' + aSazby[i]).value );
//         
//         if ( aSazby[i] == nDeliveryDPH ) nPrice = nPrice + nDeliveryPrice;
//         
//         nSumPrice = nSumPrice + nPrice;
//         nSumDPH = nSumDPH + (nPrice*0.01*aSazby[i]);
//     }
//     nSumPriceDPH = nSumPrice + nSumDPH;
// 		if (!getE('taxTable')) {alert('neni taxTable')};
// 		if (getE('taxTable')) {
// 			getE('tdDRbase').innerHTML = FUCJS(nSumPrice, 2, true);
// 			getE('tdDRdph').innerHTML = FUCJS(nSumDPH, 2, true);
// 			getE('tdDRsum').innerHTML = FUCJS(nSumPriceDPH, 2, true);
//     
// 			nRound = ( Math.round(nSumPriceDPH) - nSumPriceDPH).toFixed(2);
// 			if (nRound != 0) {
// 				getE('trDRround').style.display = '';
// 				getE('tdDRround').innerHTML = FUCJS(nRound,2,true); //.replace('.',',');
// 			}
// 			else getE('trDRround').style.display = 'none';
// 
// 			nSumPriceDPH = (parseFloat(nSumPriceDPH) + parseFloat(nRound)).toFixed(2);
// 			getE('tdDRSumToPay').innerHTML = FUCJS(nSumPriceDPH, 2, true);
// 			getE('nSumPriceDPH').innerHTML = FUCJS(nSumPriceDPH, 2, true);
// 		}
// 		
// 		getE('nSumPriceNoDPH').innerHTML = FUCJS(nSumPrice, 2, true);
// }   

// function ConvertToNum(sNum)
// {
// 		sNum = parseFloat(sNum);
// 		var nNum = sNum*1;
//     if ( isNaN(nNum) ) nNum = 0;
//     return nNum;
// }


// function DeliverySelect(pkDel){
// 	//gaDelivery - array from string 142$143$
// 	//gaDeliveryDPH - array from string 19$5$
// 	//gaPayment - array from string 41,43,$1,43,$
// 	//gaDefault - array from string 143,44  - defaultní ID dopravy a platby
// 	var oPTsel, sDeliveries, oPB, bPayOK;
// 	var bPaySelectedOK = false;
// 	var bPaySelected = false;
// 
// 	if(getE('tdDelItemName')) {UpdateDeliveryPriceOnOrder(pkDel);}
// 
// //	oPT = getE('TransportPrice');
// //	if (oPT) {
// //		oPB = getE('DeliveryPrice_' + pkDel)
// //		if (oPB) {
// //			oPT.innerHTML = oPB.value;
// //			getE('DeliveryPrice').value = getE('DeliveryPrice_' + pkDel).value;
// //			getE('DeliveryName').value = getE('DeliveryName_' + pkDel).value;
// //			getE('DeliveryDPH').value = getE('DeliveryDPH_' + pkDel).value;
// //		}
// //	}
// 
// 	for (var i=0; i<gaDelivery.length-1; i++){
// 		if (gaDelivery[i] == pkDel) {
// 			// provedu zobrazení/skrytí platebních metod podle vazby na dopravné
// 			for(var j = 0; ; j++) {
// 				oPT = getE('PaymentType' + j);
// 				if (!oPT) break;
// 
// 				// nastavím bloku s typem platby modrou/šedou barvu
// 				oPB = getE('PaymentBlock' + j);
// 				sPayments = ',' + gaPayment[i];
// 				bPayOK = (sPayments.indexOf(',' + oPT.value + ',') != -1);
// 				if (oPT.checked)
// 					bPaySelectedOK = bPayOK; // je vybraná plat. met. stále možná i s nově zvoleným dopravným? existuje vazba?
// 
// 				if (bPayOK) {
// 					if (!bPaySelected) {
// 						oPTsel = oPT;
// 						bPaySelected = true;
// 					}
// 					oPB.className = "PayDeliveryType";
// 				}
// 				else
// 					oPB.className = "PayDeliveryType payKO";
// 				oPT.disabled = !bPayOK;
// 				if (!bPaySelected) oPT.checked = true;
// 			}
// 			
// 			// pokud je vybrána platební metoda, kterou není možné provést s vybraným typem dopravy, změním to na první možnou volbu
// 			if (bPaySelected && !bPaySelectedOK)
// 				if (pkDel == gaDefault[0]) {
// 					for (var j = 0; ; j++) {
// 						oPT = getE('PaymentType' + j);
// 						if (!oPT) break;
// 						if (oPT.value == gaDefault[1]) oPT.checked = true;
// 					}
// 				}
// 				else oPTsel.checked = true;
// 			break;
// 		}
// 		else {
// 			for (var j = 0; ; j++) {
// 				oPT = getE('PaymentType' + j);
// 				if (!oPT) break;
// 				oPT.disabled = !(oPT.value == gaDefault[1]);
// 				if (oPT.value == gaDefault[1]) {
// 					oPT.checked = true;
// 					getE('PaymentBlock' + j).className = "PayDeliveryType";
// 					}
// 				else {
// 					getE('PaymentBlock' + j).className = "PayDeliveryType payKO";
// 				}
// 			}
// 		}
// 	}
// }


// function CheckContactPersons(num)
// {
// 	var pom2 = nContactPersonInTab;
// 	var pom = 1;
// 	if (num != 0) { pom = num; pom2 = num}
// 	for (i=pom; i< (pom2+1); i++ ) {
// 		if ( getE('delcpId_'+i).value == 0)  {
// 			if (getE('cpFirstName_'+i).value == ""){alert("Vyplňte jméno kontaktní osoby.");getE('cpFirstName_'+i).focus();return false}
// 			if (getE('cpLastName_'+i).value == ""){alert("Vyplňte příjmení kontaktní osoby.");getE('cpLastName_'+i).focus();return false}
// 			if (getE('cpEmail_'+i).value == ""){alert("Vyplňte e-mail kontaktní osoby.");getE('cpEmail_'+i).focus();return false}
// 			if (EmailControl(getE('cpEmail_'+i).value)==false) {getE('cpEmail_'+i).focus();return false;}
// 			if (getE('cpLogin_'+i).value == ""){alert("Vyplňte přihlašovací jméno kontaktní osoby.");getE('cpLogin_'+i).focus();return false}
// 			if (getE('cpLogin_'+i).value.length < 5){alert("Přihlašovací jméno musí mít nejméně 5 znaků.");getE('cpLogin_'+i).focus();return false}
// 			if (getE('cpPhone_'+i).value == ""){alert("Vyplňte telefon kontaktní osoby.");getE('cpPhone_'+i).focus();return false}
// 			if (getE('cpPassword_'+i).value == ""){alert("Vyplňte heslo kontaktní osoby.");getE('cpPassword_'+i).focus();return false}
// 			if (getE('cpPassword_'+i).value.length < 5){alert("Heslo musí mít minimálně 5 znaků.");getE('cpPassword_'+i).focus();return false}
// 			if(getE('cpPassword_'+i).value != getE('cpPasswordCheck_'+i).value){alert("Potvrzené heslo se neshoduje.");getE('cpPasswordCheck_'+i).focus();return false}
// 		}
// 	}
// 	return true;
// }	

// function CheckClientAddress(num)	
// {
// 	var pom2 = nClientAddressInTab;
// 	var pom = 1;
// 	if (num != 0) { pom = num; pom2 = num}
// 	for (i=pom; i< (pom2+1); i++ ) {
// 		if ( getE('delcaId_'+i).value == 0 ) {
// 			if (getE('caFirm_'+i).value == ""){alert("Vyplňte název firmy doručovací adresy.");getE('caFirm_'+i).focus();return false}
// 			if (getE('caStreet_'+i).value == ""){alert("Vyplňte ulici doručovací adresy.");getE('caStreet_'+i).focus();return false}
// 			if (getE('caCity_'+i).value == ""){alert("Vyplňte město doručovací adresy.");getE('caCity_'+i).focus();return false}
// 			if (getE('caZipCode_'+i).value == ""){alert("Vyplňte PSČ doručovací adresy.");getE('caZipCode_'+i).focus();return false}
// 		}
// 	}
// 	return true;
// }	

// function ControlPassword(NameOne,NameTwo){
// 	if (getE(NameOne).value != getE(NameTwo).value){
// 		alert("Špatně zadané heslo.");
// 		getE(NameOne).value = "";
// 		getE(NameTwo).value = "";
// 		getE(NameOne).focus();
// 		return false;
// 	}else{
// 		return true;
// 	}
// }


//------------- dodací adresy ---------------
// var nClientAddress = 0
// function changeSelectedClientAddress( actualSelected ) {
// 	if (nClientAddress == 0) nClientAddress = actualSelected;
// 	if (getE('AddressAdd'+actualSelected)) getE('AddressAdd'+actualSelected).style.display=(Br.IE ? 'block' : 'table');
// }
// 
// function rowClientAddress(num, firm, street, city, zipcode) {
// 	var LineColor = 1
// 	if ((num % 2) == 0) LineColor = 2
// 	else LineColor = 1;
// 	var tbody = getE('tblRowCA');
// 	if (num <= tbody.rows.length) {
// 		tbody.deleteRow(num-1);
// 	}
// 
// 	if (num == 1 && tbody.rows.length == 1) {tbody.deleteRow(0);};
// 
// 	var tRow = tbody.insertRow(num-1);
// 	tRow.id = "rowA_" + num;
// 	tRow.className = "tdRw" + LineColor;
// 	var tCell = tRow.insertCell(0);
// 	tCell.onclick = function() {changeSelectedClientAddress(num);};
// 	tCell.className = "cFN";
// 	tCell.innerHTML = firm;
// 	var tCell = tRow.insertCell(1);
// 	tCell.innerHTML = street;
// 	var tCell = tRow.insertCell(2);
// 	tCell.innerHTML = city;
// 	var tCell = tRow.insertCell(3);
// 	tCell.innerHTML = zipcode;
// 	var tCell = tRow.insertCell(4);
// 	tCell.className = "actn";
// 	tCell.innerHTML = "<input type='image' class='btnBGs' src=\"/img/BTko.gif\" onclick='deleteClientAddress(" + num + "); return false;' title='Odstranit dodací adresu' />";
// }
// 
// function saveClientAddress(num) {
// 	if (CheckClientAddress(num)) {
// 		rowClientAddress( num, '(#' + num + ') ' + getE('caFirm_' + num).value, getE('caStreet_' + num).value, getE('caCity_' + num).value, getE('caZipCode_' + num).value);
// 		getE('AddressAdd' + num).style.display='none';
// 	}
// 	return true;
// }
// 
// function deleteClientAddress(num) {
// 	if (confirm('Přejete si skutečně smazat dodací adresu?')) {
// 		getE('delcaId_' + num).value='1';
// 		getE('AddressAdd' + num).style.display='none';
// 		getE('rowA_' + num).style.display='none';
// 	}
// 	return true;
// }
// 
// var nClientAddressInTab = 0;
// function addNewClientAddress(num) {
// 	if (nClientAddressInTab==0) { nClientAddressInTab = num + 1 } else { nClientAddressInTab++ };
// 
// 	rowClientAddress(nClientAddressInTab, "(#" + nClientAddressInTab + ")" , "nová dodací adresa", "", "");
// 
// 	getE('AddressAdd0').innerHTML += 
// 		'<input type="hidden" id="caId_'+nClientAddressInTab+'" name="caId" value="0" />' +
// 		'<input type="hidden" id="delcaId_'+nClientAddressInTab+'" name="delcaId" value="0" />' +
// 		'<table class="tblCD" cellpadding="0" cellspacing="0" id="AddressAdd' + nClientAddressInTab + '">' +
// 		'	<tr>' +
// 		'	 <td colspan="6" class="bClose"><span><img src="/img/BTko.gif" alt="Zavřít" title="Zavřít" onclick="getE(\'AddressAdd' +  nClientAddressInTab + '\').style.display=\'none\'; " /></span><strong>Detail nové dodací adresy - #' + nClientAddressInTab + '</strong></td>' +
// 		'	</tr>' +
// 		' <tr>' +
// 		'  <td class="RName">Firma:</td>' +
// 		'  <td class="RInsert"><input class="input_text INP" id="caFirm_'+ nClientAddressInTab + '" type="text" name="CAFirmDelivery" maxlength="100" tabindex="127" value="" /><span class="decReg">!</span></td>' +
// 		'  <td class="RName">Ulice:</td>' +
// 		'  <td class="RInsert"><input class="input_text INP" id="caStreet_'+ nClientAddressInTab + '" type="text" name="CAStreetDelivery" maxlength="255" tabindex="128" value="" /><span class="decReg">!</span></td>' +
// 		' </tr>' +
// 		' <tr>' +
// 		'  <td class="RName">Město:</td>' +
// 		'  <td class="RInsert"><input class="input_text INP" id="caCity_'+ nClientAddressInTab + '" type="text" name="CACityDelivery" tabindex="129" maxlength="100" value="" /><span class="decReg">!</span></td>' +
// 		'  <td class="RName">PSČ:</td>' +
// 		'  <td class="RInsert"><input class="input_text INP" id="caZipCode_'+ nClientAddressInTab + '" type="text" name="CAZipCodeDelivery" value="" maxlength="6" tabindex="130" onkeypress="return ControlPSC();" /><span class="decReg">!</span></td>' +
// 		' </tr>' +
// 		' <tr>' +
// 		'	 <td class="actn" colspan="6"><input type="image" src="/img/BTdelitem.gif" title="Odstranit dodací adresu onclick="deleteClientAddress('+ nClientAddressInTab +'); return false;" />&nbsp;&nbsp;<input type="image" src="/img/BTsaveitem.gif" title="Uložit dodací adresu" onclick="saveClientAddress('+nClientAddressInTab+'); return false;" title="Uložit dodací adresu osobu" /></td>' +
// 		' </tr>' +
// 		'</table>';
// }

//------------- kontaktni osoby -------------
// var nContactPerson = 0
// function changeSelectedContactPerson( actualSelected ) {
// 	if (nContactPerson == 0) nContactPerson = actualSelected;
// 	if (getE('ContactAdd'+actualSelected)) getE('ContactAdd'+actualSelected).style.display=(Br.IE ? 'block' : 'table');
// }
// 
// function rowContactPerson(num, login, jmeno, email, phone, news) {
// 	var LineColor = 1
// 	if ((num % 2) == 0) LineColor = 2
// 	else LineColor = 1;
// 	var tbody = getE('tblRowCP');
// 	if (num <= tbody.rows.length) {
// 		tbody.deleteRow(num-1);
// 	}
// 	
// 	if (num == 1 && tbody.rows.length == 1) {tbody.deleteRow(0);};
// 
// 	var tRow = tbody.insertRow(num-1);
// 	tRow.id = "rowC_" + num;
// 	tRow.className = "tdRw" + LineColor;
// 	var tCell = tRow.insertCell(0);
// 	tCell.innerHTML = login;
// 	var tCell = tRow.insertCell(1);
// 	tCell.onclick = function() {changeSelectedContactPerson(num);};
// 	tCell.className = "cFN" ;
// 	tCell.innerHTML = jmeno;
// 	var tCell = tRow.insertCell(2);
// 	tCell.innerHTML = email;
// 	var tCell = tRow.insertCell(3);
// 	tCell.innerHTML = phone;
// 	var tCell = tRow.insertCell(4);
// 	tCell.className = "actn";
// 	tCell.innerHTML = news;
// 	var tCell = tRow.insertCell(5);
// 	tCell.className = "actn";
// 	tCell.innerHTML = "<input type='image' class='btnBGs' src=\"/img/BTko.gif\" onclick='deleteContactPerson(" + num + "); return false;' title='Odstranit kontaktni osobu' />";
// }
// 
// function saveContactPerson(num) {
// 	if (CheckContactPersons(num)) {
// 		if (getE('cpNews_' + num).value == 1)
// 			var sNews = 'Ano';
// 		else
// 			var sNews = 'Ne';
// 		rowContactPerson( num, '(#' + num + ') ' + getE('cpLogin_' + num).value, getE('cpFirstName_' + num).value + ' ' + getE('cpLastName_' + num).value, getE('cpEmail_' + num).value, getE('cpPhone_' + num).value, sNews);
// 		getE('ContactAdd' + num).style.display='none';
// 	}
// 	return true;
// }
// 
// function deleteContactPerson(num) {
// 	if (confirm('Přejete si skutečně smazat kontaktní osobu?')) {
// 		getE('delcpId_' + num).value='1';
// 		getE('ContactAdd' + num).style.display='none';
// 		getE('rowC_' + num).style.display='none';
// 	}
// 	return true;
// }
// 
// var nContactPersonInTab = 0;
// function addNewContactPerson(num) {
// 	if (nContactPersonInTab==0) { nContactPersonInTab = num + 1 } else { nContactPersonInTab++ };
// 	
// 	rowContactPerson(nContactPersonInTab, "(#" + nContactPersonInTab + ")" , "nová kontaktní osoba", "", "", "");
// 
// 	getE('ContactAdd0').innerHTML += 
// 		'<input type="hidden" id="cpId_'+nContactPersonInTab+'" name="cpId" value="0" />' +
// 		'<input type="hidden" id="delcpId_'+nContactPersonInTab+'" name="delcpId" value="0" />' +
// 		'<table class="tblCD" cellpadding="0" cellspacing="0" id="ContactAdd' + nContactPersonInTab + '">' +
// 		'	<tr>' +
// 		'	 <td colspan="6" class="bClose"><span><img src="/img/BTko.gif" alt="Zavřít" title="Zavřít" onclick="getE(\'ContactAdd' +  nContactPersonInTab + '\').style.display=\'none\'; " /></span><strong>Detail nové kontaktní osoby - #' + nContactPersonInTab + '</strong></td>' +
// 		'	</tr>' +
// 		' <tr>' +
// 		'  <td class="RName">Jméno:</td>' +
// 		'  <td class="RInsert"><input class="input_text INP" id="cpFirstName_'+ nContactPersonInTab + '" type="text" name="CPFirstName" maxlength="50" tabindex="119" value="" /><span class="decReg">!</span></td>' +
// 		'  <td class="RName">Příjmení:</td>' +
// 		'  <td class="RInsert"><input class="input_text INP" id="cpLastName_'+ nContactPersonInTab + '" type="text" name="CPLastName" maxlength="100" tabindex="120" value="" /><span class="decReg">!</span></td>' +
// 		' </tr>' +
// 		' <tr>' +
// 		'  <td class="RName">E-mail:</td>' +
// 		'  <td class="RInsert"><input class="input_text INP" id="cpEmail_'+ nContactPersonInTab + '" type="text" name="CPEmail" tabindex="121" maxlength="100" value="" onblur="if (this.value != \'\') if (!EmailControl(this.value)) this.value=\'\';" /><span class="decReg">!</span></td>' +
// 		'  <td class="RName">Odběr novinek:</td>' +
// 		'  <td class="RInsert"><input id="cpiNews_'+ nContactPersonInTab + '" type="checkbox" title="Odběr novinek a akčního zboží" class="input_check" tabindex="122" value="" name="CPiNews" onclick="SetCPNews(' + nContactPersonInTab + ');" /><input type="hidden" id="cpNews_' + nContactPersonInTab + '" name="CPNews" value="0" /></td>' +
// 		' </tr>' +
// 		'  <td class="RName">Login:</td>'+
// 		'  <td class="RInsert"><input class="input_text INP" id="cpLogin_'+ nContactPersonInTab + '" type="text" tabindex="124" name="CPLogin" value="" /><span class="decReg">!</span></td>'+
// 		'  <td class="RName">Telefon:</td>' +
// 		'  <td class="RInsert"><input class="input_text INP" id="cpPhone_'+ nContactPersonInTab + '" type="text" name="CPPhone" value="" tabindex="123" onkeypress="return ControlPhone();" /><span class="decReg">!</span></td>' +
// 		' </tr>' +
// 		' <tr>' +
// 		'  <td class="RName">Heslo:</td>' +
// 		'  <td class="RInsert"><input class="input_text INP" id="cpPassword_'+ nContactPersonInTab + '" type="password" tabindex="125" name="CPPassword" title="min.5 znaků"  value="" /><span class="decReg">!</span></td>' +
// 		'  <td class="RName">Potvrzení hesla:</td>' +
// 		'  <td class="RInsert"><input class="input_text INP" id="cpPasswordCheck_'+ nContactPersonInTab + '" type="password" tabindex="126" name="CPPasswordCheck" title="min.5 znaků"  value="" /><span class="decReg">!</span></td>' +
// 		' </tr>' +
// 		' <tr>' +
// 		'	 <td class="actn" colspan="6"><input type="image" src="/img/BTdelitem.gif" title="Odstranit kontaktni osobu" onclick="deleteContactPerson('+ nContactPersonInTab +'); return false;" />&nbsp;&nbsp;<input type="image" src="/img/BTsaveitem.gif" title="Uložit kontaktni osobu" onclick="saveContactPerson('+nContactPersonInTab+'); return false;" title="Uložit kontaktni osobu" /></td>' +
// 		' </tr>' +
// 		'</table>';
// }
// 
// function SetCPNews(Id) {
// 	getE('cpNews_'+Id).value = getE('cpiNews_'+Id).checked ? '1' : '0';
// }


