<!-- ############################## działanie kalkulatora -->
      function wyl()
        {
        document.x.po.style.visibility="hidden"
        document.x.da.style.visibility="hidden"
        }

        var Latam = {18 : 0.00175, 19 : 0.00175, 20 : 0.00175, 21 : 0.00175, 22 : 0.00175, 23 : 0.00175, 24 : 0.00175, 25 : 0.00175, 26 : 0.00175, 27 : 0.00175, 28 : 0.00178, 29 : 0.00183, 30 : 0.00187, 31 : 0.00192, 32 : 0.00199, 33 : 0.00207, 34 : 0.00215, 35 : 0.00224, 36 : 0.00234, 37 : 0.00243, 38 : 0.00255, 39 : 0.00267, 40 : 0.00283, 41 : 0.00304, 42 : 0.00327, 43 : 0.00354, 44 : 0.00381, 45 : 0.00411, 46 : 0.00443, 47 : 0.00475, 48 : 0.00513, 49 : 0.00554, 50 : 0.00597, 51 : 0.00643, 52 : 0.00692, 53 : 0.00743, 54 : 0.00794, 55 : 0.00846, 56 : 0.00897, 57 : 0.00949, 58 : 0.01001, 59 : 0.01056, 60 : 0.01120, 61 : 0.01196, 62 : 0.01288, 63 : 0.01397, 64 : 0.01523, 65 : 0.01667};

      function kasowanie()
        {
        document.x.reset();
        }

      function zzz(myx)
        {
        var v1;
        var x1;
        var x2;
        v1 = myx.length;
        if (v1 > 6)
          {
          x1=myx.substr(0,v1-6);
          x2=myx.substr(v1-6,99);
          myx = x1 + " " + x2;
          }
          if (v1 > 9)
          {
          x1=myx.substr(0,v1-9);
          x2=myx.substr(v1-9,99);
          myx = x1 + " " + x2;
          }
        return myx;
        }

      function vvv(myx)
        {
        var r, re;
        re = / /gi;
        r = myx.replace(re, "");
        return r;
        }

      function xxx(myx)
        {
        var v1;
        var v2;
        v1 = myx.length;
        v2 = myx.indexOf(".", 0);
        if (v2 == (-1)) myx = myx + ".00";
        else if (v2 == 0)
          {
          myx = "0" + myx;
          myx = xxx(myx);
          }
        else if (v1 - v2 == 2)
          myx = myx + "0";
        else if (v1 - v2 == 1)
          myx = myx + "00";
        return myx;
        }


      function Replace(s)
        {
        var r, re;
        re = /,/i;
        r = s.replace(re, ".");
        return(r);
        }


function abc()
{
	var w = window.open('abc_kobieta.html','','width=600,height=500,scrollbars=yes,resizable=yes,left=50,top=50');
} // abc

function wykazSkladekPopup( objContainer )
{
	var strContent = '<html><head></head><body>';
	strContent += '<table align="center"><font color="#C8341A"><tr><td><b><u>TABELA PODSTAWOWYCH SKŁADEK ROCZNYCH</u></b></td></tr></table></font>' + '<br>';
	strContent += '<table align="center"><tr><td><u>Dotyczy tylko kobiety!</u></td></tr></table>' + '<br>';
	strContent += '<TABLE align="center" border><tr>';
	strContent += '<td  align="center" colspan="2"><b>KOBIETA</b></td>';
	strContent += '</tr>';
	strContent += '<tr>';
	strContent += '<td width="80" align="center"><b>Wiek</b></td>';
	strContent += '<td width="120" align="center"><b>Składka w PLN</b></td>';
	strContent += '</tr>';

	var rap1;
	for (i = 0; i < 48 - ((parseInt(vvv(opener.document.x.e1.value)))-18); i++)
	{
		rap1 = ((parseFloat(vvv(opener.document.x.e99.value)))*(Latam[parseInt(vvv(opener.document.x.e1.value))+i]));

// Zmiana obnizenie skladki jesli obezpieczony partner
// kk jps 20080223
		
		if (opener.document.x.r81.checked)
		 {
		 rap1 = (rap1 * 0.90);
		 }
		rap1 = (rap1 - (rap1*i*0.01));
		rap1 = Math.round(rap1*100)/100;
		rap1 = xxx("" + rap1);
		rap1 = zzz(rap1);

		strContent += '<tr><td align="center">'+(parseInt(vvv(opener.document.x.e1.value))+i)+'</td><td align="right">';
		strContent += rap1 + '</td></tr>';
	}
	strContent += '</TABLE></body></html>';
	var objBody = window.document.getElementById('bodyContent');
	objBody.innerHTML = strContent;
} // wykazSkladekPopup


      function Simple()
        {
        with (document.x)
          {
          e5.value = vvv("" + e5.value);
          e5.value = Replace(e5.value);
          }

		var e5value = document.getElementById('e5');
		var e5error = false;
		e5value = e5value.value;
		if ( e5value ) {
			var e5tmp;
			e5tmp = (Math.round( (e5value / 10000) ) * 10000);
			
			if ( e5tmp != e5value ) {
				e5error = true;
			}
			
			if ( e5tmp < 30000 ) {
				e5tmp = 30000;
			}
			
			if ( e5error ) {
				alert('Deklarowana suma ubezpieczenia jest niepoprawna, wartość zostanie poprawiona, jednak wciąż mozesz wpisac inną.');
				document.getElementById('e5').value = e5tmp;
				return false;
			}
		}
		

        var blad;
        blad=0;

        var str;
        str = "WYPEŁNIJ:\n\n";



		var boolBladWiek = false;
		var a = document.x.data_urodzenia.value;
		if ( a=="" )
		{
			boolBladWiek = true;
		}
		else
		{
			var arrTabDate = a.split("-");
			arrTabDate[0] = parseFloat(arrTabDate[0]);
			arrTabDate[1] = parseFloat(arrTabDate[1]);
			arrTabDate[2] = parseFloat(arrTabDate[2]);
			if ( isNaN(arrTabDate[0]) || isNaN(arrTabDate[1]) || isNaN(arrTabDate[2]) ) {
				boolBladWiek = true;
			}
			
			if ( arrTabDate[0] == 0 || arrTabDate[1] == 0 || arrTabDate[2] == 0 ) {
				boolBladWiek = true;
			}

			var objDate = new Date();
			objDate.setDate(1);
			objDate.setMonth(1);
			objDate.setYear(arrTabDate[2]);
			objDate.setHours(0);
			objDate.setMinutes(0);
			objDate.setSeconds(0);
			objDate.setMilliseconds(0);
			
			var objDateNow = new Date();
			objDateNow.setDate(1);
			objDateNow.setMonth(1);
			objDateNow.setHours(0);
			objDateNow.setMinutes(0);
			objDateNow.setSeconds(0);
			objDateNow.setMilliseconds(0);
			var intAge = objDateNow.getFullYear() - objDate.getFullYear();
			if ( isNaN(intAge) ) {
				boolBladWiek = true;
			} else {
				document.x.e1.value = intAge;
				a = intAge;
			}
		}
		
		if ( (a < 18) | (a > 65) )
		{
			alert("Twój wiej musi mieścić się w zakresie od 18 do 65 lat!");
			document.x.e1.value = "";
			return;
		}
		
		if ( boolBladWiek ) {
			str += "\n  Wiek Kobiety !\n";
			blad=1;
		}
		a = parseFloat(Latam[a]);
		
		
		
		
		
		

        var e;
        e = parseFloat(document.x.e5.value);
        if (isNaN(e))
          {
          str = str + "\n  Deklarowaną sumę ubezpieczenia !\n";
          document.x.e5.value = "";
          blad=1;
          }

        if (blad == 1)
          {
          alert(str);
          return;
          }

        var x;
        document.x.e99.value = (e);
        document.x.c1.value = (e);
        x = (e) * a;
        x = Math.round(x * 100) / 100;
// Dopisano korekte skladki o - 10% jesli ubezpieczenie wspolmalzonka
// kk jps, 20080223

			if (document.x.r81.checked)
			{ x = Math.round(x * 0.9 * 100) / 100;
			} 
        
        document.x.e6.value = x;
        if (document.x.e6.value < 100)
          {
          alert("Składka roczna jest mniejsza niż 100 PLN. Kwota ubezpieczenia musi więc być większa!\nWypełnij kalkulator ponownie!");
          kasowanie();
          return;
          }

        var y1;
        y1 = ((x + (x * 0.02))/2);
        y1 = Math.round(y1 * 100) / 100;
        document.x.e7.value = y1;
        if (document.x.e7.value < 100)
          {
          document.x.e7.value = "";
          }

        var y2;
        y2 = ((x + (x * 0.03))/4);
        y2 = Math.round(y2 * 100) / 100;
        document.x.e8.value = y2;
        if (document.x.e8.value < 100)
          {
          document.x.e8.value = "";
          }

        var y3;
        y3 = ((x + (x * 0.04))/12);
        y3 = Math.round(y3 * 100) / 100;
        document.x.e9.value = y3;
        if (document.x.e9.value < 100)
          {
          document.x.e9.value = "";
          }

        var c2;
        c2 = x + 5;
        c2 = Math.round(c2 * 100) / 100;
        document.x.c2.value = c2;

        var c3;
        c3 = ((x + (x * 0.02))/2) + 5;
        c3 = Math.round(c3 * 100) / 100;
        document.x.c3.value = c3;

        var c4;
        c4 = ((x + (x * 0.03))/4) + 5;
        c4 = Math.round(c4 * 100) / 100;
        document.x.c4.value = c4;

        var c5;
        c5 = ((x + (x * 0.04))/12) + 5;
        c5 = Math.round(c5 * 100) / 100;
        document.x.c5.value = c5;
        
        var c6;
        c6 = document.x.e1.value;
        document.x.c6.value = c6;

        var c7;
        
        if (document.x.r81.checked)
        {c7 = '1';}
        else 
        {c7 = '0';};
        document.x.c7.value = c7;

        with (document.x)
          {
          e5.value=xxx(e5.value);
          e5.value=zzz(e5.value);
          e99.value=xxx(e99.value);
          e99.value=zzz(e99.value);
          e6.value=xxx(e6.value);
          e6.value=zzz(e6.value);
          e7.value=xxx(e7.value);
          e7.value=zzz(e7.value);
          e8.value=xxx(e8.value);
          e8.value=zzz(e8.value);
          e9.value=xxx(e9.value);
          e9.value=zzz(e9.value);
          }

        if (document.x.e7.value < 100)
          {
          document.x.e7.value = "*";
          }
        if (document.x.e8.value < 100)
          {
          document.x.e8.value = "*";
          }
        if (document.x.e9.value < 100)
          {
          document.x.e9.value = "*";
          }

        document.x.po.style.visibility="visible"
        document.x.da.style.visibility="visible"

        }
window.onload=wyl

