  function validate(evt) {
          var theEvent = evt || window.event;
          var key = theEvent.keyCode || theEvent.which;
          key = String.fromCharCode( key );
          var regex = /[0-9]|\./;
          if(theEvent.keyCode != 8)  // backspace kontrola
          if( !regex.test(key) ) {
            theEvent.returnValue = false;
            if(theEvent.preventDefault) theEvent.preventDefault();
          }
        //  calc();
      }  
      
      calc = function(num){
          var cena = parseInt($(".cenak"+num).val(),10);
          var uspo = parseInt($(".uspork"+num).val(),10);
          var let = parseInt($(".letk"+num).val(),10);
          var fix = parseInt($(".fixk"+num).val(),10);
         
          var urok;
          
          switch(fix){
              case 1:
                urok = 0.0434;
                break;
              case 3:
                urok = 0.0369;
                break;
                case 5:
                urok = 0.0349;
                break;
              default:
                  urok = 0.0349;
              }
          if(isNaN(uspo)) uspo = 0;
           cena = cena - uspo;
           
          
          var text = Math.round( ((urok * Math.pow((1 + urok),let)) / ( Math.pow((1+urok),let) - 1) * cena) / 12 );
          
          if(text < 0) text = 0;
          $(".vysledekk"+num).html("<strong>"+text.toString().replace(/\B(?=(?:\d{3})+(?!\d))/g, " ") + " kč / měsíc</strong>"); 
      }

$(document).ready(function(){     
    
    $('#features').jshowoff({ controls:false, hoverPause:false, autoPlay:true, effect:'slideLeft', speed:7000 });
    $('.calc').openDOMWindow({ 
        eventType:'click', 
        loader:1, 
        height: 400
        //width: 200
        }); 
      $('.cclose').closeDOMWindow({eventType:'click'});   
    });


