function checkdatum(d)	{
	
	var yr1   = parseInt(d.substring(0,4),10); 
	var mon1  = parseInt(d.substring(5,7),10) - 1;
	var dt1   = parseInt(d.substring(8,10),10); 
	var date1 = new Date(yr1, mon1, dt1); 
	var date2 = new Date(); 

   if(date2 > date1)	{
      alert("A választott idõpont nem lehet régebbi, mint a mai nap!");
      return false; 
   } 	
}

function numbersonly(e) {
	var unicode = e.charCode	? 	e.charCode : e.keyCode;
	if (unicode != 8 && unicode != 9)	{
		if (unicode < 48 || unicode > 57)
			return false;
		
		return true;
	}
} 

function phonenumber(e) {
	var unicode = e.charCode	? 	e.charCode : e.keyCode;
	//alert("key - " + unicode);
	if (unicode != 8 && unicode != 9 && unicode != 43 && unicode != 45 && unicode != 47)	{
		if (unicode < 48 || unicode > 57)
			return false;
		
		return true;
	}
}


function textonly(e)	{
	var code;
	if (!e)	var e = window.event;
	if (e.keyCode)	code = e.keyCode;
	else if (e.which)	code = e.which;
	var character = String.fromCharCode(code);
	//alert('Character was ' + character);
	//alert(code);
	//if (code == 8) return true;
	var AllowRegex  = /^[\ba-zA-ZöüóõúéáûíÖÜÓÕÚÉÁÛÍ\s-]$/;
	if (AllowRegex.test(character))	return true;
	return false;
}

function setidotart()	{
	idoori = document.orderform.idotartori.value;
	idot = document.getElementById("idotart");
	idotar = document.orderform.idotartam.value;
	
	with (Math)	{
		idooszt = floor(idotar / idoori);
	}
	if (idooszt > 0)	{
		document.orderform.idotartam.value = idooszt * idoori;
	}	else	{
		document.orderform.idotartam.value = idoori;
	}
	idot.value = document.orderform.idotartam.value;
	idot1 = document.getElementById("idotart1");
	if (idot1)	idot1.value = document.orderform.idotartam.value;
	idot2 = document.getElementById("idotart2");
	if (idot2)	idot2.value = document.orderform.idotartam.value;
	idot3 = document.getElementById("idotart3");
	if (idot3)	idot3.value = document.orderform.idotartam.value;
	idot4 = document.getElementById("idotart4");
	if (idot4)	idot4.value = document.orderform.idotartam.value;
	idot5 = document.getElementById("idotart5");
	if (idot5)	idot5.value = document.orderform.idotartam.value;
	idot6 = document.getElementById("idotart6");
	if (idot6)	idot6.value = document.orderform.idotartam.value;
}

function datum(dat)	{
	d2 = dat.split("-");
	if (d2[1].charAt(0) == "0")	{
		d2[1] = d2[1].substring(1,2);
	}
	if (d2[2].charAt(0) == "0")	{
		d2[2] = d2[2].substring(1,2);
	}
	
	d3 = new Date(d2[0], parseInt(d2[1])-1, d2[2]);
	r = d3.getTime();
	return r;
}

function calc_total()	{	
	var osszes;
	osszes = 0;

	rv=document.orderform.felnottek.value;
	if (document.orderform.gyerekek1)	{
		with (Math)	{
			rv = abs(rv) + abs(document.orderform.gyerekek1.value);
		}
	}
	if (document.orderform.gyerekek2)	{
		with (Math)	{
			rv = abs(rv) + abs(document.orderform.gyerekek2.value);
		}
	}
	if (document.orderform.gyerekek3)	{
		with (Math)	{
			rv = abs(rv) + abs(document.orderform.gyerekek3.value);
		}
	}
	if (document.orderform.idotartori.value > 1)	{
		if ((document.orderform.szezonalis.value == 1) || (document.orderform.egyeni.value == 1))	{
			idoori = document.orderform.idotartori.value;
			idot = document.getElementById("idotart");
			idotar = document.orderform.idotartam.value;
			
			with (Math)	{
				idooszt = floor(idotar / idoori);
			}
			if (idooszt > 0)	{
				idotartam = idooszt;
			}	else	{
				idotartam = 1;
			}
		}	else	{
			idotartam = 1;
		}
	}	else	{
		idotartam = document.orderform.idotartam.value;
	}
	akc = document.orderform.idakcios.value;
	ar = document.orderform.alap.value;

	foglalasi = document.orderform.foglalasidij.value;
	transzfer = document.orderform.transzfer.value;
	vizum = document.orderform.vizumdij.value;
	rep = document.orderform.repteri_illetek.value;
	storno = document.orderform.storno.value;
	bpp = document.orderform.bpp.value;
	bizt1 = document.orderform.biztositas_egyeni7.value;
	bizt2 = document.orderform.biztositas_egyeni14.value;
	bizt3 = document.orderform.biztositas_csaladi7.value;
	bizt4 = document.orderform.biztositas_csaladi14.value;
	kerozin = document.orderform.kerozin_potdij.value;
	egyeb_1 = document.orderform.egyeb_1.value;
	egyeb_2 = document.orderform.egyeb_2.value;
	egyeb_3 = document.orderform.egyeb_3.value;
	egyeb_4 = document.orderform.egyeb_4.value;
	egyeb_5 = document.orderform.egyeb_5.value;

	gyerekfix_foagy1 = document.orderform.gyerekfix_foagy1.value;
	gyerekfix_foagy2 = document.orderform.gyerekfix_foagy2.value;
	gyerekfix_foagy3 = document.orderform.gyerekfix_foagy3.value;
	gyerekfix_potagy1 = document.orderform.gyerekfix_potagy1.value;
	gyerekfix_potagy2 = document.orderform.gyerekfix_potagy2.value;
	gyerekfix_potagy3 = document.orderform.gyerekfix_potagy3.value;
	gyerekszazalek_foagy1 = document.orderform.gyerekszazalek_foagy1.value;
	gyerekszazalek_foagy2 = document.orderform.gyerekszazalek_foagy2.value;
	gyerekszazalek_foagy3 = document.orderform.gyerekszazalek_foagy3.value;
	gyerekszazalek_potagy1 = document.orderform.gyerekszazalek_potagy1.value;
	gyerekszazalek_potagy2 = document.orderform.gyerekszazalek_potagy2.value;
	gyerekszazalek_potagy3 = document.orderform.gyerekszazalek_potagy3.value;

	document.orderform.arak1.value = document.orderform.felnottek.value * ar * idotartam;
	with (Math)	{
		osszes = abs(osszes) + abs(document.orderform.arak1.value);
	}
	
	if (gyerekfix_foagy1 > 0 || gyerekfix_potagy1 > 0)	{
		document.orderform.arak_gyfix1.value = document.orderform.gyerekek1.value * document.orderform.gyerekfixar1.value * idotartam;
		with (Math)	{
			osszes = abs(osszes) + abs(document.orderform.arak_gyfix1.value);
		}
	}
	if ((gyerekszazalek_foagy1 > 0 && gyerekszazalek_foagy1 < 100) || (gyerekszazalek_potagy1 > 0 && gyerekszazalek_potagy1 < 100))	{
		arak_gyfix1 = 0;
		with (Math)	{
			gyszaz1 = abs(document.orderform.gyerekfixar1.value) / 100;
			arak_gyfix1 = abs(ar) - (abs(ar) * abs(gyszaz1));
		}
		if (document.orderform.gyerekek1.value > 0)	{
			document.orderform.arak_gyfix1.value = (arak_gyfix1 * document.orderform.gyerekek1.value * idotartam);
			with (Math)	{
				osszes = abs(osszes) + abs(document.orderform.arak_gyfix1.value);
			}
		}
	}
	if (gyerekfix_foagy2 > 0 || gyerekfix_potagy2 > 0)	{
		document.orderform.arak_gyfix2.value = document.orderform.gyerekek2.value * document.orderform.gyerekfixar2.value * idotartam;
		with (Math)	{
			osszes = abs(osszes) + abs(document.orderform.arak_gyfix2.value);
		}
	}
	if ((gyerekszazalek_foagy2 > 0 && gyerekszazalek_foagy2 < 100) || (gyerekszazalek_potagy2 > 0 && gyerekszazalek_potagy2 < 100))	{
		arak_gyfix2 = 0;
		with (Math)	{
			gyszaz2 = abs(document.orderform.gyerekfixar2.value) / 100;
			arak_gyfix2 = abs(ar) - (abs(ar) * abs(gyszaz2));
		}
		if (document.orderform.gyerekek2.value > 0)	{
			document.orderform.arak_gyfix2.value = (arak_gyfix2 * document.orderform.gyerekek2.value * idotartam);
			with (Math)	{
				osszes = abs(osszes) + abs(document.orderform.arak_gyfix2.value);
			}
		}
	}
	if (gyerekfix_foagy3 > 0 || gyerekfix_potagy3 > 0)	{
		document.orderform.arak_gyfix3.value = document.orderform.gyerekek3.value * document.orderform.gyerekfixar3.value * idotartam;
		with (Math)	{
			osszes = abs(osszes) + abs(document.orderform.arak_gyfix3.value);
		}
	}
	if ((gyerekszazalek_foagy3 > 0 && gyerekszazalek_foagy3 < 100) || (gyerekszazalek_potagy3 > 0 && gyerekszazalek_potagy3 < 100))	{
		arak_gyfix3 = 0;
		with (Math)	{
			gyszaz3 = abs(document.orderform.gyerekfixar3.value) / 100;
			arak_gyfix3 = abs(ar) - (abs(ar) * abs(gyszaz3));
		}
		if (document.orderform.gyerekek3.value > 0)	{
			document.orderform.arak_gyfix3.value = (arak_gyfix3*document.orderform.gyerekek3.value * idotartam);
			with (Math)	{
				osszes = abs(osszes) + abs(document.orderform.arak_gyfix3.value);
			}
		}
	}

	rvar = document.orderform.arak1.value;

	if (foglalasi > 0)	{
		document.orderform.rvevofd.value = rv;
		document.orderform.arakfd.value = rv * foglalasi;
		with (Math)	{
			osszes = abs(osszes) + (abs(rv) * abs(foglalasi));
		}
	}
	if (transzfer > 0)	{
		document.orderform.rvevotr.value = rv;
		document.orderform.araktr.value = rv * transzfer;
		with (Math)	{
			osszes = abs(osszes) + (abs(rv) * abs(transzfer));
		}
	}
	if (vizum > 0)	{
		document.orderform.rvevo3.value = rv;
		document.orderform.arak2.value = rv * vizum;
		with (Math)	{
			osszes = abs(osszes) + (abs(rv) * abs(vizum));
		}
	}
	if (rep > 0)	{
		document.orderform.rvevo.value = rv;
		document.orderform.arak3.value = rv * rep;
		with (Math)	{
			osszes = abs(osszes) + (abs(rv) * abs(rep));
		}
	}
	if (kerozin > 0)	{
		document.orderform.rvevo2.value = rv;
		document.orderform.arak6.value = rv * kerozin;
		with (Math)	{
			osszes = abs(osszes) + (abs(rv) * abs(kerozin));
		}
	}
	if (bpp > 0)	{
		it = document.orderform.idotartam.value;
		with (Math)	{	itart = abs(it) + abs(1);	}
		if (itart < 1)	itart = 1;
		document.orderform.napok.value = itart;
		document.orderform.arak7.value = document.orderform.rvevo4.value * itart * bpp;
		with (Math)	{
			osszes = abs(osszes) + (abs(itart) * abs(bpp) * abs(document.orderform.rvevo4.value));
		}
	}
	if (document.orderform.rvevob1)	{
		if (bizt1 > 0)	{
			document.orderform.arakb1.value = document.orderform.rvevob1.value * bizt1;
			with (Math)	{
				osszes = abs(osszes) + (abs(bizt1) * abs(document.orderform.rvevob1.value));
			}
		}
	}
	if (document.orderform.rvevob2)	{	
		if (bizt2 > 0)	{
			document.orderform.arakb2.value = document.orderform.rvevob2.value * bizt2;
			with (Math)	{
				osszes = abs(osszes) + (abs(bizt2) * abs(document.orderform.rvevob2.value));
			}
		}
	}
	if (document.orderform.rvevob3)	{
		if (bizt3 > 0)	{
			document.orderform.arakb3.value = document.orderform.rvevob3.value * bizt3;
			with (Math)	{
				osszes = abs(osszes) + (abs(bizt3) * abs(document.orderform.rvevob3.value));
			}
		}
	}
	if (document.orderform.rvevob4)	{
		if (bizt4 > 0)	{
			document.orderform.arakb4.value = document.orderform.rvevob4.value * bizt4;
			with (Math)	{
				osszes = abs(osszes) + (abs(bizt4) * abs(document.orderform.rvevob4.value));
			}
		}
	}
	if (egyeb_1 > 0)	{
		if (document.orderform.opcios1.value == 0)	{
			if (document.orderform.szamol_1.value == 1)	{
				document.orderform.arak100.value = egyeb_1;
				if (document.orderform.kedv_1.value == 0)	{
					with (Math)	{
						osszes = abs(osszes) + (abs(egyeb_1));
					}
				}	else	{
					with (Math)	{
						osszes = abs(osszes) - (abs(egyeb_1));
					}
				}
			}	else if (document.orderform.szamol_1.value == 2)	{
				document.orderform.rvevo100.value = rv;
				document.orderform.arak100.value = document.orderform.rvevo100.value * egyeb_1;
				if (document.orderform.kedv_1.value == 0)	{
					with (Math)	{
						osszes = abs(osszes) + (abs(document.orderform.rvevo100.value) * abs(egyeb_1));
					}
				}	else	{
					with (Math)	{
						osszes = abs(osszes) - (abs(document.orderform.rvevo100.value) * abs(egyeb_1));
					}
				}
			}	else if (document.orderform.szamol_1.value == 3)	{
				it = document.orderform.idotartam.value;
				with (Math)	{	itart = abs(it) + abs(1);	}
				if (itart < 1)	itart = 1;
				document.orderform.napok100.value = itart;
				document.orderform.arak100.value = itart * egyeb_1;
				if (document.orderform.kedv_1.value == 0)	{
					with (Math)	{
						osszes = abs(osszes) + (abs(itart) * abs(egyeb_1));
					}
				}	else	{
					with (Math)	{
						osszes = abs(osszes) + (abs(itart) * abs(egyeb_1));
					}
				}
			}	else if (document.orderform.szamol_1.value == 4)	{
				with (Math)	{
					opc1 = abs(egyeb_1) / 100;
					document.orderform.arak100.value = round(abs(rvar) * abs(opc1));
					osszes = abs(osszes) + round(abs(rvar) * abs(opc1));
				}
			}
		}	else	{
			if (document.orderform.opcios100.checked)	{
				if (document.orderform.szamol_1.value == 1)	{
					document.orderform.arak100.value = egyeb_1;
					if (document.orderform.kedv_1.value == 0)	{
						with (Math)	{
							osszes = abs(osszes) + (abs(egyeb_1));
						}
					}	else	{
						with (Math)	{
							osszes = abs(osszes) - (abs(egyeb_1));
						}
					}
				}	else if (document.orderform.szamol_1.value == 2)	{
					var rv100 = document.getElementById("rvevo100");
					if (rv100)
						rv100.removeAttribute("readonly", 0);
					if (document.orderform.rvevo100.value == "" || document.orderform.rvevo100.value == 0)	document.orderform.rvevo100.value = rv;
					document.orderform.arak100.value = document.orderform.rvevo100.value * egyeb_1;
					if (document.orderform.kedv_1.value == 0)	{
						with (Math)	{
							osszes = abs(osszes) + (abs(document.orderform.rvevo100.value) * abs(egyeb_1));
						}
					}	else	{
						with (Math)	{
							osszes = abs(osszes) - (abs(document.orderform.rvevo100.value) * abs(egyeb_1));
						}
					}
				}	else if (document.orderform.szamol_1.value == 3)	{
					it = document.orderform.idotartam.value;
					with (Math)	{	itart = abs(it) + abs(1);	}
					if (itart < 1)	itart = 1;
					document.orderform.napok100.value = itart;
					document.orderform.arak100.value = itart * egyeb_1;
					if (document.orderform.kedv_1.value == 0)	{
						with (Math)	{
							osszes = abs(osszes) + (abs(itart) * abs(egyeb_1));
						}
					}	else	{
						with (Math)	{
							osszes = abs(osszes) - (abs(itart) * abs(egyeb_1));
						}
					}
				}	else if (document.orderform.szamol_1.value == 4)	{
					with (Math)	{
						opc1 = abs(egyeb_1) / 100;
						document.orderform.arak100.value = round(abs(rvar) * abs(opc1));
						osszes = abs(osszes) + round(abs(rvar) * abs(opc1));
					}
				}
			}	else	{
				var rv100 = document.getElementById("rvevo100");
				if (rv100)
					rv100.setAttribute("readonly", "readonly");
				document.orderform.arak100.value = "";
				if (document.orderform.szamol_1.value == 2)	{
					document.orderform.rvevo100.value = rv;
				}
			}
		}
	}
	if (egyeb_2 > 0)	{
		if (document.orderform.opcios2.value == 0)	{
			if (document.orderform.szamol_2.value == 1)	{
				document.orderform.arak200.value=egyeb_2;
				if (document.orderform.kedv_2.value == 0)	{
					with (Math)	{
						osszes=abs(osszes)+(abs(egyeb_2));
					}
				}	else	{
					with (Math)	{
						osszes=abs(osszes)-(abs(egyeb_2));
					}
				}
			}	else if (document.orderform.szamol_2.value == 2)	{
				document.orderform.rvevo200.value=rv;
				document.orderform.arak200.value=rv*egyeb_2;
				if (document.orderform.kedv_2.value == 0)	{
					with (Math)	{
						osszes=abs(osszes)+(abs(rv)*abs(egyeb_2));
					}
				}	else	{
					with (Math)	{
						osszes=abs(osszes)-(abs(rv)*abs(egyeb_2));
					}
				}
			}	else if (document.orderform.szamol_2.value == 3)	{
				it = document.orderform.idotartam.value;
				with (Math)	{	itart = abs(it)+abs(1);	}
				if (itart < 1)	itart = 1;
				document.orderform.napok200.value=itart;
				document.orderform.arak200.value=itart*egyeb_2;
				if (document.orderform.kedv_2.value == 0)	{
					with (Math)	{
						osszes=abs(osszes)+(abs(itart)*abs(egyeb_2));
					}
				}	else	{
					with (Math)	{
						osszes=abs(osszes)-(abs(itart)*abs(egyeb_2));
					}
				}
			}	else if (document.orderform.szamol_1.value == 4)	{
				with (Math)	{
					opc2 = abs(egyeb_2) / 100;
					document.orderform.arak200.value = round(abs(rvar) * abs(opc2));
					osszes = abs(osszes) + round(abs(rvar) * abs(opc2));
				}
			}
		}	else	{
			if (document.orderform.opcios200.checked)	{
				if (document.orderform.szamol_2.value == 1)	{
					document.orderform.arak200.value=egyeb_2;
					if (document.orderform.kedv_2.value == 0)	{
						with (Math)	{
							osszes=abs(osszes)+(abs(egyeb_2));
						}
					}	else	{
						with (Math)	{
							osszes=abs(osszes)-(abs(egyeb_2));
						}
					}
				}	else if (document.orderform.szamol_2.value == 2)	{
					var rv200 = document.getElementById("rvevo200");
					if (rv200)
						rv200.removeAttribute("readonly", 0);
					if (document.orderform.rvevo200.value == "" || document.orderform.rvevo200.value == 0)	document.orderform.rvevo200.value = rv;
					document.orderform.arak200.value = document.orderform.rvevo200.value * egyeb_2;
					if (document.orderform.kedv_2.value == 0)	{
						with (Math)	{
							osszes = abs(osszes) + (abs(document.orderform.rvevo200.value) * abs(egyeb_2));
						}
					}	else	{
						with (Math)	{
							osszes = abs(osszes) - (abs(document.orderform.rvevo200.value) * abs(egyeb_2));
						}
					}
				}	else if (document.orderform.szamol_2.value == 3)	{
					it = document.orderform.idotartam.value;
					with (Math)	{	itart = abs(it) + abs(1);	}
					if (itart < 1)	itart = 1;
					document.orderform.napok200.value = itart;
					document.orderform.arak200.value = itart * egyeb_2;
					if (document.orderform.kedv_2.value == 0)	{
						with (Math)	{
							osszes = abs(osszes) + (abs(itart) * abs(egyeb_2));
						}
					}	else	{
						with (Math)	{
							osszes = abs(osszes) - (abs(itart) * abs(egyeb_2));
						}
					}
				}	else if (document.orderform.szamol_1.value == 4)	{
					with (Math)	{
						opc2 = abs(egyeb_2) / 100;
						document.orderform.arak200.value = round(abs(rvar) * abs(opc2));
						osszes = abs(osszes) + round(abs(rvar) * abs(opc2));
					}
				}
			}	else	{
				var rv200 = document.getElementById("rvevo200");
				if (rv200)
					rv200.setAttribute("readonly", "readonly");
				document.orderform.arak200.value = "";
				if (document.orderform.szamol_2.value == 2)	{
					document.orderform.rvevo200.value = rv;
				}
			}
		}
	}
	if (egyeb_3 > 0)	{
		if (document.orderform.opcios3.value == 0)	{
			if (document.orderform.szamol_3.value == 1)	{
				document.orderform.arak300.value = egyeb_3;
				if (document.orderform.kedv_3.value == 0)	{
					with (Math)	{
						osszes = abs(osszes) + (abs(egyeb_3));
					}
				}	else	{
					with (Math)	{
						osszes = abs(osszes) - (abs(egyeb_3));
					}
				}
			}	else if (document.orderform.szamol_3.value == 2)	{
				document.orderform.rvevo300.value = rv;
				document.orderform.arak300.value = rv * egyeb_3;
				if (document.orderform.kedv_3.value == 0)	{
					with (Math)	{
						osszes = abs(osszes) + (abs(rv) * abs(egyeb_3));
					}
				}	else	{
					with (Math)	{
						osszes = abs(osszes) - (abs(rv) * abs(egyeb_3));
					}
				}
			}	else if (document.orderform.szamol_3.value == 3)	{
				it = document.orderform.idotartam.value;
				with (Math)	{	itart = abs(it) + abs(1);	}
				if (itart < 1)	itart = 1;
				document.orderform.napok300.value=itart;
				document.orderform.arak300.value=itart*egyeb_3;
				if (document.orderform.kedv_3.value == 0)	{
					with (Math)	{
						osszes=abs(osszes)+(abs(itart)*abs(egyeb_3));
					}
				}	else	{
					with (Math)	{
						osszes=abs(osszes)-(abs(itart)*abs(egyeb_3));
					}
				}
			}	else if (document.orderform.szamol_3.value == 4)	{
				with (Math)	{
					opc3 = abs(egyeb_3) / 100;
					document.orderform.arak300.value = round(abs(rvar) * abs(opc3));
					osszes = abs(osszes) + round(abs(rvar) * abs(opc3));
				}
			}
		}	else	{
			if (document.orderform.opcios300.checked)	{
				if (document.orderform.szamol_3.value == 1)	{
					document.orderform.arak300.value=egyeb_3;
					if (document.orderform.kedv_3.value == 0)	{
						with (Math)	{
							osszes=abs(osszes)+(abs(egyeb_3));
						}
					}	else	{
						with (Math)	{
							osszes=abs(osszes)-(abs(egyeb_3));
						}
					}
				}	else if (document.orderform.szamol_3.value == 2)	{
					var rv300 = document.getElementById("rvevo300");
					if (rv300)
						rv300.removeAttribute("readonly", 0);
					if (document.orderform.rvevo300.value == "" || document.orderform.rvevo300.value == 0)	document.orderform.rvevo300.value = rv;
					document.orderform.arak300.value = document.orderform.rvevo300.value * egyeb_3;
					if (document.orderform.kedv_3.value == 0)	{
						with (Math)	{
							osszes = abs(osszes) + (abs(document.orderform.rvevo300.value) * abs(egyeb_3));
						}
					}	else	{
						with (Math)	{
							osszes = abs(osszes) - (abs(document.orderform.rvevo300.value) * abs(egyeb_3));
						}
					}
				}	else if (document.orderform.szamol_3.value == 3)	{
					it = document.orderform.idotartam.value;
					with (Math)	{	itart = abs(it) + abs(1);	}
					if (itart < 1)	itart = 1;
					document.orderform.napok300.value = itart;
					document.orderform.arak300.value = itart * egyeb_3;
					if (document.orderform.kedv_3.value == 0)	{
						with (Math)	{
							osszes = abs(osszes) + (abs(itart) * abs(egyeb_3));
						}
					}	else	{
						with (Math)	{
							osszes=abs(osszes)-(abs(itart)*abs(egyeb_3));
						}
					}
				}	else if (document.orderform.szamol_3.value == 4)	{
					with (Math)	{
						opc3 = abs(egyeb_3) / 100;
						document.orderform.arak300.value = round(abs(rvar) * abs(opc3));
						osszes = abs(osszes) + round(abs(rvar) * abs(opc3));
					}
				}
			}	else	{
				var rv300 = document.getElementById("rvevo300");
				if (rv300)
					rv300.setAttribute("readonly", "readonly");
				document.orderform.arak300.value = "";
				if (document.orderform.szamol_3.value == 2)	{
					document.orderform.rvevo300.value=rv;
				}
			}
		}
	}
	if (egyeb_4 > 0)	{
		if (document.orderform.opcios4.value == 0)	{
			if (document.orderform.szamol_4.value == 1)	{
				document.orderform.arak400.value=egyeb_4;
				if (document.orderform.kedv_4.value == 0)	{
					with (Math)	{
						osszes=abs(osszes)+(abs(egyeb_4));
					}
				}	else	{
					with (Math)	{
						osszes=abs(osszes)-(abs(egyeb_4));
					}
				}
			}	else if (document.orderform.szamol_4.value == 2)	{
				document.orderform.rvevo400.value=rv;
				document.orderform.arak400.value=rv*egyeb_4;
				if (document.orderform.kedv_4.value == 0)	{
					with (Math)	{
						osszes=abs(osszes)+(abs(rv)*abs(egyeb_4));
					}
				}	else	{
					with (Math)	{
						osszes=abs(osszes)-(abs(rv)*abs(egyeb_4));
					}
				}
			}	else if (document.orderform.szamol_4.value == 3)	{
				it = document.orderform.idotartam.value;
				with (Math)	{	itart = abs(it)+abs(1);	}
				if (itart < 1)	itart = 1;
				document.orderform.napok400.value=itart;
				document.orderform.arak400.value=itart*egyeb_4;
				if (document.orderform.kedv_4.value == 0)	{
					with (Math)	{
						osszes=abs(osszes)+(abs(itart)*abs(egyeb_4));
					}
				}	else	{
					with (Math)	{
						osszes=abs(osszes)-(abs(itart)*abs(egyeb_4));
					}
				}
			}	else if (document.orderform.szamol_4.value == 4)	{
				with (Math)	{
					opc4 = abs(egyeb_4) / 100;
					document.orderform.arak400.value = round(abs(rvar) * abs(opc4));
					osszes = abs(osszes) + round(abs(rvar) * abs(opc4));
				}
			}
		}	else	{
			if (document.orderform.opcios400.checked)	{
				if (document.orderform.szamol_4.value == 1)	{
					document.orderform.arak400.value=egyeb_4;
					if (document.orderform.kedv_4.value == 0)	{
						with (Math)	{
							osszes=abs(osszes)+(abs(egyeb_4));
						}
					}	else	{
						with (Math)	{
							osszes=abs(osszes)-(abs(egyeb_4));
						}
					}
				}	else if (document.orderform.szamol_4.value == 2)	{
					var rv400 = document.getElementById("rvevo400");
					if (rv400)
						rv400.removeAttribute("readonly");
					if (document.orderform.rvevo400.value == "" || document.orderform.rvevo400.value == 0)	document.orderform.rvevo400.value = rv;
					document.orderform.arak400.value = document.orderform.rvevo400.value * egyeb_4;
					if (document.orderform.kedv_4.value == 0)	{
						with (Math)	{
							osszes = abs(osszes) + (abs(document.orderform.rvevo400.value) * abs(egyeb_4));
						}
					}	else	{
						with (Math)	{
							osszes = abs(osszes) - (abs(document.orderform.rvevo400.value) * abs(egyeb_4));
						}
					}
				}	else if (document.orderform.szamol_4.value == 3)	{
					it = document.orderform.idotartam.value;
					with (Math)	{	itart = abs(it)+abs(1);	}
					if (itart < 1)	itart = 1;
					document.orderform.napok400.value=itart;
					document.orderform.arak400.value=itart*egyeb_4;
					if (document.orderform.kedv_4.value == 0)	{
						with (Math)	{
							osszes=abs(osszes)+(abs(itart)*abs(egyeb_4));
						}
					}	else	{
						with (Math)	{
							osszes=abs(osszes)-(abs(itart)*abs(egyeb_4));
						}
					}
				}	else if (document.orderform.szamol_4.value == 4)	{
					with (Math)	{
						opc4 = abs(egyeb_4) / 100;
						document.orderform.arak400.value = round(abs(rvar) * abs(opc4));
						osszes = abs(osszes) + round(abs(rvar) * abs(opc4));
					}
				}
			}	else	{
				var rv400 = document.getElementById("rvevo400");
				if (rv400)
					rv400.setAttribute("readonly", "readonly");
				document.orderform.arak400.value = "";
				if (document.orderform.szamol_4.value == 2)	{
					document.orderform.rvevo400.value=rv;
				}
			}
		}
	}
	if (egyeb_5 > 0)	{
		if (document.orderform.opcios2.value == 0)	{
			if (document.orderform.szamol_5.value == 1)	{
				document.orderform.arak500.value=egyeb_5;
				if (document.orderform.kedv_5.value == 0)	{
					with (Math)	{
						osszes=abs(osszes)+(abs(egyeb_5));
					}
				}	else	{
					with (Math)	{
						osszes=abs(osszes)-(abs(egyeb_5));
					}
				}
			}	else if (document.orderform.szamol_5.value == 2)	{
				document.orderform.rvevo500.value=rv;
				document.orderform.arak500.value=rv*egyeb_5;
				if (document.orderform.kedv_5.value == 0)	{
					with (Math)	{
						osszes=abs(osszes)+(abs(rv)*abs(egyeb_5));
					}
				}	else	{
					with (Math)	{
						osszes=abs(osszes)-(abs(rv)*abs(egyeb_5));
					}
				}
			}	else if (document.orderform.szamol_5.value == 3)	{
				it = document.orderform.idotartam.value;
				with (Math)	{	itart = abs(it)+abs(1);	}
				if (itart < 1)	itart = 1;
				document.orderform.napok500.value=itart;
				document.orderform.arak500.value=itart*egyeb_5;
				if (document.orderform.kedv_5.value == 0)	{
					with (Math)	{
						osszes=abs(osszes)+(abs(itart)*abs(egyeb_5));
					}
				}	else	{
					with (Math)	{
						osszes=abs(osszes)-(abs(itart)*abs(egyeb_5));
					}
				}
			}	else if (document.orderform.szamol_5.value == 4)	{
				with (Math)	{
					opc5 = abs(egyeb_5) / 100;
					document.orderform.arak500.value = round(abs(rvar) * abs(opc5));
					osszes = abs(osszes) + round(abs(rvar) * abs(opc5));
				}
			}
		}	else	{
			if (document.orderform.opcios500.checked)	{
				if (document.orderform.szamol_5.value == 1)	{
					document.orderform.arak500.value=egyeb_5;
					if (document.orderform.kedv_5.value == 0)	{
						with (Math)	{
							osszes=abs(osszes)+(abs(egyeb_5));
						}
					}	else	{
						with (Math)	{
							osszes=abs(osszes)-(abs(egyeb_5));
						}
					}
				}	else if (document.orderform.szamol_5.value == 2)	{
					var rv500 = document.getElementById("rvevo500");
					if (rv500)
						rv500.removeAttribute("readonly");
					if (document.orderform.rvevo500.value == "" || document.orderform.rvevo500.value == 0)	document.orderform.rvevo500.value = rv;
					document.orderform.arak500.value = document.orderform.rvevo500.value * egyeb_5;
					if (document.orderform.kedv_5.value == 0)	{
						with (Math)	{
							osszes = abs(osszes) + (abs(document.orderform.rvevo500.value) * abs(egyeb_5));
						}
					}	else	{
						with (Math)	{
							osszes = abs(osszes) - (abs(document.orderform.rvevo500.value) * abs(egyeb_5));
						}
					}
				}	else if (document.orderform.szamol_5.value == 3)	{
					it = document.orderform.idotartam.value;
					with (Math)	{	itart = abs(it)+abs(1);	}
					if (itart < 1)	itart = 1;
					document.orderform.napok500.value=itart;
					document.orderform.arak500.value=itart*egyeb_5;
					if (document.orderform.kedv_5.value == 0)	{
						with (Math)	{
							osszes=abs(osszes)+(abs(itart)*abs(egyeb_5));
						}
					}	else	{
						with (Math)	{
							osszes=abs(osszes)-(abs(itart)*abs(egyeb_5));
						}
					}
				}	else if (document.orderform.szamol_5.value == 4)	{
					with (Math)	{
						opc5 = abs(egyeb_5) / 100;
						document.orderform.arak500.value = round(abs(rvar) * abs(opc5));
						osszes = abs(osszes) + round(abs(rvar) * abs(opc5));
					}
				}
			}	else	{
				var rv500 = document.getElementById("rvevo500");
				if (rv500)
					rv500.setAttribute("readonly", "readonly");
				document.orderform.arak500.value = "";
				if (document.orderform.szamol_5.value == 2)	{
					document.orderform.rvevo500.value=rv;
				}
			}
		}
	}
	if (document.orderform.fakth)	{
		for (f = 0; f < document.orderform.faktnum.value; f++)	{
			var frv = document.getElementById("faktrv_" + f);
			var fch = document.getElementById("fakts" + f);
			if (fch.checked == true)	{
				frv.removeAttribute('readonly', 0);
				if (frv.value == "" || frv.value == 0)	frv.value = rv;
				with (Math)	{
					osszes = abs(osszes) + (frv.value * abs(faktarray[f]));
				}
			}	else	{
				frv.setAttribute('readonly', 'readonly');
				frv.value = 0;
			}
		}
	}
	if (storno > 0)	{
		document.orderform.reszar.value=osszes;
		document.orderform.arak4.value=storno;
		document.orderform.arak5.value=Math.round(osszes*(storno/100));
		with (Math)	{
			osszes=Math.round(abs(osszes)+(abs(osszes)*(abs(storno)/100)));
		}
	}
	document.orderform.totalc.value=osszes;
}

