function calcit() {
   var Vout;
   var Vtime;
   var HddCapacity;
   var bpsIPB = 375*1024;
   var bpsIP = 200*1024;
   var bpsI = 33*1024;
   var backup = 0;
   var temp;
   
   HddCapacity = document.calc.hardisk.value * 0.925 * 1024 * 1024 * 1000 * ( 1 - backup / 100 );
   
   if (document.calc.bitrate.value >= 6000000) {
        bpsIPB = bpsIPB * 2;
        bpsIP = bpsIP * 2;
        bpsI = bpsI * 2;
   }
   else if (document.calc.bitrate.value >= 4500000) { 
        bpsIPB = bpsIPB * 15/10;
        bpsIP = bpsIP * 15/10;
        bpsI = bpsI * 15/10;
   }
   else if (document.calc.bitrate.value == 2000000) {
        bpsIPB = bpsIPB * 7/10;
        bpsIP = bpsIP * 6/10;
        bpsI = bpsI * 6/10;
   }
   else if (document.calc.bitrate.value == 1200000) {  
        bpsIPB = bpsIPB * 5/10;
        bpsIP = bpsIP * 4/10;
        bpsI = bpsI * 4/10;
   }
   else if (document.calc.bitrate.value == 800000) {  
        bpsIPB = bpsIPB * 32/100;
        bpsIP = bpsIP * 3/10;
        bpsI = bpsI * 3/10;
   }
   
   if (document.calc.framerate.value > 20)
        Vout = bpsIPB;
   else if (document.calc.framerate.value > 5)
        Vout = bpsIP;
   else Vout = document.calc.framerate.value * bpsI;
   if (Vout > document.calc.bitrate.value)
        Vout = document.calc.bitrate.value; 
        
   Vtime = 1.1 * ( HddCapacity / ( Vout * 3600 ) );
    
   temp = Math.round ( Vtime * 100 ) + "";
   if ( temp.indexOf (".") != -1 ) {
 	temp = temp.substring ( 0 , temp.indexOf (".") );
   }
   while ( temp.length < 3 ) {
	temp = "0" + temp;
   } 
   document.calc.shownum.value = temp.substring ( 0 , temp.length-2 ) + "." + temp.substring ( temp.length - 2 );
}

function clearit() {
   document.calc.shownum.value = "";
   document.calc.hardisk.value = "";
   document.calc.framerate.value = "30";
   document.calc.bitrate.value = "3000000";
}
