function toggle(id){
	if (id.length == null) {
		if (id.style.display=="none") {
			id.style.display="block";
		}
		else {
			id.style.display="none";
		}
	}
	else {
		for (i = 0; i < id.length; i++) {
			if (id[i].style.display=="none") {
				id[i].style.display="block";
			}
			else {
				id[i].style.display="none";
			}
		}
	}
}

function SameAddress(theform) {
	if (theform.elements['sameaddress'].checked==true)
		{
		theform.strContactName.value=theform.strInvoiceName.value;
		theform.strContactSurname.value=theform.strInvoiceSurname.value;
		theform.strContactStreet.value=theform.strInvoiceStreet.value;
		theform.strContactCity.value=theform.strInvoiceCity.value;
		theform.strContactZIP.value=theform.strInvoiceZIP.value;
		theform.strContactTelephone.value=theform.strInvoiceTelephone.value;
		theform.strContactEmail.value=theform.strInvoiceEmail.value;
		}
	else {
		
		}
	}
	
function Recount(theform) {
var celkcena = 222;
	// POKUD NECHCI NEKTERY Z MODULU 2XX a MAM ZVOLENOU PROFI -> prepnout na VOLITELNOU
	if ((theform.elements['module200'].checked==false || theform.elements['module201'].checked==false || theform.elements['module202'].checked==false
		 ||	theform.elements['module203'].checked==false || theform.elements['module204'].checked==false ||	theform.elements['module205'].checked==false 
		 ||	theform.elements['module206'].checked==false ||	theform.elements['module207'].checked==false ||	theform.elements['module208'].checked==false 
		 ||	theform.elements['module209'].checked==false ||	theform.elements['module210'].checked==false || theform.elements['module211'].checked==false
		 || theform.elements['module212'].checked==false)  && (theform.model[1].checked==true  || theform.model[2].checked==true))
	{
	theform.model[3].checked=true;
	theform.model[1].checked=false;
	theform.model[2].checked=false;
	}
	
	// POKUD NECHCI NEKTERY Z MODULU 3XX a MAM ZVOLENOU PREMIUMI -> prepnout na VOLITELNOU
	if ((theform.elements['module300'].checked==false || theform.elements['module301'].checked==false || theform.elements['module302'].checked==false
	|| theform.elements['module303'].checked==false || theform.elements['module304'].checked==false || theform.elements['module305'].checked==false) 
    && theform.model[2].checked==true)
	{
	theform.model[3].checked=true;
	theform.model[0].checked=false;
	theform.model[2].checked=false;
	}
	
	// POKUD CHCI NEKTERY Z MODULU 2XX a MAM ZVOLENOU STANDARD -> prepnout na VOLITELNOU
	if ((theform.elements['module200'].checked==true || theform.elements['module201'].checked==true || theform.elements['module202'].checked==true
		 ||	theform.elements['module203'].checked==true || theform.elements['module204'].checked==true || theform.elements['module205'].checked==true 
		 ||	theform.elements['module206'].checked==true || theform.elements['module207'].checked==true || theform.elements['module208'].checked==true 
		 ||	theform.elements['module209'].checked==true || theform.elements['module210'].checked==true || theform.elements['module211'].checked==true
		 ||	theform.elements['module212'].checked==true || theform.elements['module300'].checked==true || theform.elements['module301'].checked==true
		 ||	theform.elements['module302'].checked==true || theform.elements['module303'].checked==true || theform.elements['module304'].checked==true 
         || theform.elements['module305'].checked==true) && theform.model[0].checked==true)
	{
	theform.model[3].checked=true;
	theform.model[0].checked=false;
	theform.model[2].checked=false;
	}
	
	// POKUD CHCI NEKTERY Z MODULU 3XX a MAM ZVOLENOU STANDARD nebo PROFI -> prepnout na VOLITELNOU
	if ((theform.elements['module300'].checked==true || theform.elements['module301'].checked==true || theform.elements['module302'].checked==true
	|| theform.elements['module303'].checked==true || theform.elements['module304'].checked==true || theform.elements['module305'].checked==true)
    && (theform.model[0].checked==true || theform.model[1].checked==true))
	{
	theform.model[3].checked=true;
	theform.model[0].checked=false;
	theform.model[2].checked=false;
	}
		 
		 
		 
if (theform.model[0].checked==true) { lstModuleIDs = "1";}
if (theform.model[1].checked==true) { lstModuleIDs = "2"; celkcena = 600;}
if (theform.model[2].checked==true) { lstModuleIDs = "3"; celkcena = 800;}
if (theform.model[3].checked==true) { lstModuleIDs = "100, 101, 102, 103";

  if (theform.elements['module200'].checked) {  celkcena += 18; if(theform.model[3].checked==true) {lstModuleIDs += ', 200';} }
  if (theform.elements['module201'].checked) {  celkcena += 108; if(theform.model[3].checked==true) {lstModuleIDs += ', 201';} }
  if (theform.elements['module202'].checked) {  celkcena += 18; if(theform.model[3].checked==true) {lstModuleIDs += ', 202';} }
  if (theform.elements['module203'].checked) {  celkcena += 28; if(theform.model[3].checked==true) {lstModuleIDs += ', 203';} }
  if (theform.elements['module204'].checked) {  celkcena += 28; if(theform.model[3].checked==true) {lstModuleIDs += ', 204';} }
  if (theform.elements['module205'].checked) {  celkcena += 18; if(theform.model[3].checked==true) {lstModuleIDs += ', 205';} }
  if (theform.elements['module206'].checked) {  celkcena += 58; if(theform.model[3].checked==true) {lstModuleIDs += ', 206';} }
  if (theform.elements['module207'].checked) {  celkcena += 58; if(theform.model[3].checked==true) {lstModuleIDs += ', 207';} }
  if (theform.elements['module208'].checked) {  celkcena += 18; if(theform.model[3].checked==true) {lstModuleIDs += ', 208';} }
  if (theform.elements['module209'].checked) {  celkcena += 18; if(theform.model[3].checked==true) {lstModuleIDs += ', 209';} }
  if (theform.elements['module210'].checked) {  celkcena += 28; if(theform.model[3].checked==true) {lstModuleIDs += ', 210';} }
  if (theform.elements['module211'].checked) {  celkcena += 28; if(theform.model[3].checked==true) {lstModuleIDs += ', 211';} }
  if (theform.elements['module212'].checked) {  celkcena += 58; if(theform.model[3].checked==true) {lstModuleIDs += ', 212';} }
  if (theform.elements['module300'].checked) {  celkcena += 38; if(theform.model[3].checked==true) {lstModuleIDs += ', 300';} }
  if (theform.elements['module301'].checked) {  celkcena += 58; if(theform.model[3].checked==true) {lstModuleIDs += ', 301';} }
  if (theform.elements['module302'].checked) {  celkcena += 38; if(theform.model[3].checked==true) {lstModuleIDs += ', 302';} }
  if (theform.elements['module303'].checked) {  celkcena += 38; if(theform.model[3].checked==true) {lstModuleIDs += ', 303';} }
  if (theform.elements['module304'].checked) {  celkcena += 28; if(theform.model[3].checked==true) {lstModuleIDs += ', 304';} }
  if (theform.elements['module305'].checked) {  celkcena += 38; if(theform.model[3].checked==true) {lstModuleIDs += ', 305';} }
}

  theform.celkem.value = celkcena;
  theform.lstModuleIDs.value = lstModuleIDs;
  FinalPrice(theform)
  

}

function FinalPrice(theform) {
price = theform.elements['celkem'].value;

if (theform.lngValidity[0].checked) {  finalprice = price * 3; }
if (theform.lngValidity[1].checked) {  finalprice = price * 6 * 0.95; }
if (theform.lngValidity[2].checked) {  finalprice = price * 12 * 0.9; }
finalprice = Math.round(finalprice);
theform.curFinalPriceWithoutVAT.value = finalprice;
theform.curFinalPriceWithVAT.value = finalprice * 1.20;
//theform.curPriceWithoutVAT.value = finalprice;
theform.curPriceWithVAT.value = finalprice * 1.20;
}

function Model(theform) {
	theform.module100.checked=true;
	theform.module101.checked=true;
	theform.module102.checked=true;
	theform.module103.checked=true;
	
if (theform.model[0].checked) {  
	theform.module200.checked=false;
	theform.module201.checked=false;
	theform.module202.checked=false;
	theform.module203.checked=false;
	theform.module204.checked=false;
	theform.module205.checked=false;
	theform.module206.checked=false;
	theform.module207.checked=false;
	theform.module208.checked=false;
	theform.module209.checked=false;
	theform.module210.checked=false;
	theform.module211.checked=false;
	theform.module212.checked=false;
	theform.module300.checked=false;
	theform.module301.checked=false;
	theform.module302.checked=false;
	theform.module303.checked=false;
	theform.module304.checked=false;
	theform.module305.checked=false;
	}
if (theform.model[3].checked) {  
	}
	
if (theform.model[1].checked) {
	theform.module200.checked=true;
	theform.module201.checked=true;
	theform.module202.checked=true;
	theform.module203.checked=true;
	theform.module204.checked=true;
	theform.module205.checked=true;
	theform.module206.checked=true;
	theform.module207.checked=true;
	theform.module208.checked=true;
	theform.module209.checked=true;
	theform.module210.checked=true;
	theform.module211.checked=true;
	theform.module212.checked=true;
	theform.module300.checked=false;
	theform.module301.checked=false;
	theform.module302.checked=false;
	theform.module303.checked=false;
	theform.module304.checked=false;
	theform.module305.checked=false;
	}
if (theform.model[2].checked) {
	theform.module200.checked=true;
	theform.module201.checked=true;
	theform.module202.checked=true;
	theform.module203.checked=true;
	theform.module204.checked=true;
	theform.module205.checked=true;
	theform.module206.checked=true;
	theform.module207.checked=true;
	theform.module208.checked=true;
	theform.module209.checked=true;
	theform.module210.checked=true;
	theform.module211.checked=true;
	theform.module212.checked=true;
	theform.module300.checked=true;
	theform.module301.checked=true;
	theform.module302.checked=true;
	theform.module303.checked=true;
	theform.module304.checked=true;
	theform.module305.checked=true;
	}
Recount(theform);
}
