// F-Prot Antivirus for windows commercial license
function calc_win_comm(numfield, pricefield)

{
	

	var zl = 4.0
	var vat = 1.22

	var subtotal = 0;
	var fpwincomm = parseInt(document.form1[numfield].value);

	if (fpwincomm > 0)



	{
		if (fpwincomm > 2500)
		{
			alert("Prosimy o kontakt z naszym działem sprzedaży fprot@pldos.pl aby zakupić licencję F-Prot Antivirus dla Windows dla > 2500 komputerów.");
			document.form1[numfield].value = 2500;
			fpwincomm = 2500;
		}
		
		subtotal = 0;
		if (fpwincomm > 100)
		{
			subtotal += 50*zl;
			fpwincomm -= 10;

			subtotal += 40*4*zl;
			fpwincomm -= 40;

			subtotal += 50*3*zl;
			fpwincomm -= 50;

			subtotal += fpwincomm*2*zl;
		}
		else if (fpwincomm > 50)
		{
			subtotal += 50*zl;
			fpwincomm -= 10;

			subtotal += 40*4*zl;
			fpwincomm -= 40;

			subtotal += fpwincomm*3*zl;
		}
		else if (fpwincomm > 10)
		{
			subtotal += 50*zl;
			fpwincomm -= 10;

			subtotal += fpwincomm*4*zl;
		}
		else if (fpwincomm < 11)
		{
			subtotal += 50*zl;
		}
		document.form1[pricefield].value = subtotal;
	}
	else
	{
		document.form1[numfield].value = 0;
		document.form1[pricefield].value = 0;
	}
	return subtotal;
}

// F-Prot Antivirus for windows personal license
function calc_win_pers(numfield, pricefield)
{


	var zl = 3.7
	var vat = 1.22
	var subtotal = 0;
	var fpwinpers = parseInt(document.form1[numfield].value);

	if (fpwinpers > 0)
	{
		if (fpwinpers > 9)
		{
			document.form1[numfield].value = 9;
			fpwinpers = 9;
		}
		subtotal = 0;
		subtotal += fpwinpers*29*zl;

		document.form1[pricefield].value = subtotal;
	}
	else
	{
		document.form1[numfield].value = 0;
		document.form1[pricefield].value = 0;
	}
	return subtotal;
}

// F-Prot Antivirus for Exchange Commercial license
function calc_exch_c(numfield, pricefield)
{	var zl = 3.7
	var subtotal = 0;
	var fpexchc = parseInt(document.form1[numfield].value);
	if (fpexchc > 0)
	{
		if (fpexchc > 500)
		{
			alert("Please contact our Sales Department at sales@f-prot.com to purchase a F-Prot Antivirus for Exchange license for more than 500 mailboxes.");
			document.form1[numfield].value = 500;
			fpexchc = 500;
		}


		subtotal = 0;
		if (fpexchc > 0 && fpexchc < 11)
		{
			subtotal = 410*zl;
			document.form1[numfield].value = 10;
		}
		else if (fpexchc > 10 && fpexchc < 25)
		{
			subtotal = 590*zl;
		}
		else if (fpexchc > 24 && fpexchc < 50)
		{
			subtotal = 970*zl;
		}
		else if (fpexchc > 49 && fpexchc < 100)
		{
			subtotal = 1520*zl;
		}
		else if (fpexchc > 99 && fpexchc < 200)
		{
			subtotal = 2350*zl;
		}
		else if (fpexchc > 199 && fpexchc < 300)
		{
			subtotal = 3400*zl;
		}
		else if (fpexchc > 299 && fpexchc < 400)
		{
			subtotal = 4300*zl;
		}
		else if (fpexchc > 399 && fpexchc < 500)
		{
			subtotal = 4990*zl;
		}
		document.form1[pricefield].value = subtotal;
	}
	else
	{
		document.form1[numfield].value = 0;
		document.form1[pricefield].value = 0;
	}
	return subtotal;
}

// F-Prot Antivirus for DOS Commercial license
function calc_dos_c(numfield, pricefield)
{	var zl = 3.7
	var subtotal = 0;
	var fpdoscomm = parseInt(document.form1[numfield].value);
	if (fpdoscomm > 0)
	{
		if (fpdoscomm > 2500)
		{
			alert("Please contact our Sales Department at sales@f-prot.com to purchase a F-Prot Antivirus for DOS commercial license for more than 2500 computers.");
			document.form1[numfield].value = 2500;
			fpdoscomm = 2500;
		}

		subtotal = 0;
		if (fpdoscomm < 20)
		{
			subtotal += 29*zl;
		}
		else
		{
			subtotal += 29*zl;
			fpdoscomm -= 20;

			subtotal += fpdoscomm*zl;
		}
		document.form1[pricefield].value = subtotal;
	}
	else
	{
		document.form1[numfield].value = 0;
		document.form1[pricefield].value = 0;
	}
	return subtotal;
}

// F-Prot Antivirus for Linux Fileserver
function calc_lin_f(numfield, pricefield)
{	var zl = 3.7
	var subtotal = 0;
	var fplinf = parseInt(document.form1[numfield].value);

	var prices = Array();
	
	prices[0] = -1;
	prices[1] = 399;
	prices[2] = 660;
	prices[3] = 900;
	prices[4] = 1120;
	prices[5] = 1300;
	prices[6] = 1440;
	prices[7] = 1540;
	prices[8] = 1600;
	prices[9] = 1710;
	prices[10] = 1800;

	if (fplinf > 0)
	{
		if (fplinf > 10)
		{
			alert("Please contact our Sales Department at sales@f-prot.com to purchase a F-Prot Antivirus for Linux/BSD File Server license for more than 10 servers.");
			document.form1[numfield].value = 10;
			fplinf = 10;
		}

		subtotal =zl* prices[fplinf];

		document.form1[pricefield].value = subtotal;
		document.form1[numfield].value = fplinf;
	}
	else
	{
		document.form1[numfield].value = 0;
		document.form1[pricefield].value = 0;
	}
	return subtotal;
}

function calc_lin_m(numfield, pricefield)
{	var zl = 3.7
	var subtotal = 0;
	var fplinm = parseInt(document.form1[numfield].value);
	var prices = Array(0, 297, 297, 297, 297, 297, 297, 297, 297, 297,
			   297, 297, 297, 297, 297, 297, 297, 297, 297,
			   297, 297, 297, 297, 297, 297, 297, 302, 306,
			   311, 316, 320, 325, 330, 335, 340, 345, 351,
			   356, 361, 367, 373, 378, 384, 390, 396, 402,
			   408, 414, 420, 427, 433, 440, 447, 453, 460,
			   467, 474, 482, 489, 496, 504, 512, 520, 527,
			   535, 544);
	if (fplinm > 0)
	{
		if (fplinm > 9999)
		{
			alert("Please contact our Sales Department at sales@f-prot.com to purchase a F-Prot Antivirus for Linux/BSD Mail Server license for more than 9999 mailboxes.");
			document.form1[numfield].value = 9999;
			fplinm = 9999;
		}

		if (fplinm < 24)
		{
			alert("Please note that the minimum F-Prot Antivirus for Linux/BSD Mail Server license is for 1-24 mailboxes.");
			document.form1[numfield].value = 24;
			fplinm = 24;
		}
		switch(fplinm)
		{
			case 24:
				subtotal = 299*zl;
				break;
			case 49:
				subtotal = 399*zl;
				break;
			case 99:
				subtotal = 499*zl;
				break;
			case 199:
				subtotal = 799*zl;
				break;
			case 299:
				subtotal = 1099*zl;
				break;
			case 399:
				subtotal = 1399*zl;
				break;
			case 499:
				subtotal = 1699*zl;
				break;
			case 749:
				subtotal = 1999*zl;
				break;
			case 999:
				subtotal = 2299*zl;
				break;
			case 1999:
				subtotal = 2799*zl;
				break;
			case 2999:
				subtotal = 3299*zl;
				break;
			case 3999:
				subtotal = 3799*zl;
				break;
			case 4999:
				subtotal = 4299*zl;
				break;
			case 9999:
				subtotal = 4999*zl;
				break;
			default:
				alert("fplinm = " + fplinm);
				break;
		}
		document.form1[pricefield].value = subtotal;
	}
	else
	{

		document.form1[pricefield].value = 0;
		document.form1[numfield].value = 0;
	}






	return subtotal;
}

function calc_lin_w(numfield, pricefield)



{	var zl = 3.7
	var subtotal = 0;
	var fplinw = parseInt(document.form1[numfield].value);
	var prices = Array();
	prices[1] = 29*zl;
	prices[3] = 75*zl;
	prices[5] = 120*zl;
	prices[10] = 180*zl;
	prices[25] = 370*zl;
	prices[50] = 730*zl;
	prices[100] = 1190*zl;
	prices[200] = 1900*zl;

	if (fplinw > 0)
	{
		if (fplinw > 200)
		{
			alert("Please contact our Sales Department at sales@f-prot.com to purchase a F-Prot Antivirus for Linux/BSD Workstation license for more than 200 workstations.");
			document.form1[numfield].value = 200;
			fplinw = 200;
		}

		if (fplinw > 100) {
			subtotal = prices[200];
		}
		else if (fplinw > 50) {
			subtotal = prices[100];
		}
		else if (fplinw > 25) {
			subtotal = prices[50];
		}
		else if (fplinw > 10) {
			subtotal = prices[25];
		}
		else if (fplinw > 5) {
			subtotal = prices[10];
		}
		else if (fplinw > 3) {
			subtotal = prices[5];
		}
		else if (fplinw > 1) {
			subtotal = prices[3];
		}
		else if (fplinw == 1) {
			subtotal = prices[1];
		}
		document.form1[pricefield].value = subtotal;
	}
	else
	{
		document.form1[numfield].value = 0;
		document.form1[pricefield].value = 0;
	}
	return subtotal;
}

function calc_bsd_f(numfield, pricefield)
{
	return calc_lin_f(numfield, pricefield);
}

function calc_bsd_m(numfield, pricefield)
{
	return calc_lin_m(numfield, pricefield);
}
function calc_bsd_w(numfield, pricefield)
{
	return calc_lin_w(numfield, pricefield);
}

function calc_sol_f(numfield, pricefield)
{
	return calc_lin_f(numfield, pricefield);
}
function calc_sol_m(numfield, pricefield)
{
	return calc_lin_m(numfield, pricefield);
}
function calc_sol_w(numfield, pricefield)
{
	return calc_lin_w(numfield, pricefield);
}

