home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Chip 2004 June
/
Chip_2004-06_cd1.bin
/
tema
/
zme6c
/
www_info
/
vl_skiny_soubory
/
calc.js
< prev
next >
Wrap
Text File
|
2004-05-05
|
4KB
|
204 lines
function formatPrice(cPrice)
{
iPos = cPrice.indexOf(".");
if (iPos == -1)
{
iPos = cPrice.length;
}
else
{
cPrice = cPrice.replace(/\./, ",");
}
while (iPos > 0)
{
iPos -= 3;
if (iPos <= 0) break;
cPrice = cPrice.substring(0,iPos) + " " + cPrice.substring(iPos, cPrice.length);
}
return cPrice + " KΦ";
}
function roundPrice(fPrice)
{
return Math.round(fPrice*100)/100;
}
function change_Sum() {
sum = (document.forms.frmCalc.edtPriceZME5CZ.value);
if(sum.length>12) {
document.forms.frmCalc.sum.value = "Celk.:";
document.forms.frmCalc.sum.size = 4;
document.forms.frmCalc.edtPriceZME5CZ.size = 11;
}
else
{
document.forms.frmCalc.sum.value = "Celkem:";
document.forms.frmCalc.sum.size = 5;
document.forms.frmCalc.edtPriceZME5CZ.size = 10;
}
}
function change() {
//document.forms.frmCalc.sum.value = "Celk.:";
if(document.forms.frmCalc.edtCountZME5CZ.value>0) {
document.all.ViewButton.style.display = "block";
}
//alert(document.all.ViewButton.style.display);
}
function recalcOrder(cID)
{
change();
var edtCount = eval("frmCalc.edtCount" + cID);
var edtPrice = eval("frmCalc.edtPrice" + cID);
var edtUPrice = eval("frmCalc.edtUPrice" + cID);
var iCount = 0;
if (edtCount != null) {
iCount = parseInt(edtCount.value, 10);
if (isNaN(iCount)) {
iCount = 0;
}
}
var fPrice = 0.0;
var fUPrice = 0.0;
if (cID == "ZME5CZ") {
if (iCount > 250) {
alert("Pro vφce ne₧ 250 licencφ Zoner Media Explorer 5 kontaktujte prosφm obchodnφ odd∞lenφ Zoner Software.");
}
//else if (iCount < 2) { alert("Minimßlnφ poΦet licencφ je 2");}
else {
if (iCount == 250) {
fPrice = 175873.0;
} else if (iCount >= 150) {
fPrice = 115873.0 + (iCount - 150) * 599.5;
} else if (iCount >= 100) {
fPrice = 82145.0 + (iCount - 100) * 674.5;
} else if (iCount >= 50) {
fPrice = 44670.0 + (iCount - 50) * 749.5;
} else if (iCount >= 25) {
fPrice = 24059.0 + (iCount - 25) * 824.3;
} else if (iCount >= 10) {
fPrice = 10568.0 + (iCount - 10) * 899.3;
} else if (iCount >= 5) {
fPrice = 5696.0 + (iCount - 5) * 974.3;
} else if (iCount >= 1) {
fPrice = 1484.0 + (iCount - 1) * 1049.3;
}
}
}
if (edtCount != null) {
edtCount.value = iCount;
}
if (edtUPrice != null) {
if (iCount != 0) {
fUPrice = fPrice/iCount;
}
edtUPrice.value = formatPrice(roundPrice(fUPrice).toFixed(2));
}
if (edtPrice != null) {
edtPrice.value = formatPrice(roundPrice(fPrice).toFixed(2));
}
change_Sum();
}
function submitForm() {
if(document.forms.frmCalc.edtCountZME5CZ.value==1) {
top.location="http://www.zoner.cz/zme/order.asp";
}
else {
top.location="http://www.zoner.cz/zme/multilicence_order.asp?pocet="+document.forms.frmCalc.edtCountZME5CZ.value
}
return false;
}
function Prepocet() {
IvstupP = parseInt(document.forms.frmCalc.VstupPrirucka.value,10) * 50;
document.forms.frmCalc.IDPrirucka.value = formatPrice(roundPrice(IvstupP).toFixed(2));
IvstupCD = parseInt(document.forms.frmCalc.VstupCD.value,10) * 460;
document.forms.frmCalc.IDCD.value = formatPrice(roundPrice(IvstupCD).toFixed(2));
Price = document.forms.frmCalc.IDhidden.value;
Price = parseFloat(Price.replace(/\,/, "."));
NewPrice = Price+IvstupP+IvstupCD;
if(document.forms.frmCalc.box.checked == true) {
NewPrice = NewPrice-(NewPrice*0.1);
document.forms.frmCalc.box.value = "ano";
document.forms.frmCalc.vs.value = "ano";
}
document.forms.frmCalc.bezDph.value = formatPrice(roundPrice(NewPrice).toFixed(2));
document.forms.frmCalc.sDph.value = formatPrice(roundPrice(NewPrice*1.05).toFixed(2));
document.forms.frmCalc.Sleva.value = formatPrice(roundPrice(((NewPrice*1.05))-((NewPrice*1.05)*0.07)).toFixed(2));
}