<?php

/*
// angepaßt von Cerberus - für H.O.T.-Tracker -- 06.02.2007
// http://home-of-torrent.mine.nu
*/

require "include/bittorrent.php";
dbconn();
loggedinorreturn();

if (get_user_class() < UC_MODERATOR) {
        stderr("Error", "Wo willst du Knilch eigendlich hin?? Das geht Dich hier garnix an!!");
        exit;
    } 
stdhead("Staff");
?>

<!-- 'Umrechnung: Bits und Bytes' -->
<script language="JavaScript1.2">
<!--
function doCalc(flag)
{
   Rels = new Array(1,8,8192,8388608,8589934592,8796093022208);
   for (i=0;i<Rels.length;i++)
   {
        if (i==flag)
        {
            givenValue=document.getElementById(flag).value.replace(",",".");
            newVal=eval(givenValue*Rels[i])
            document.getElementById("0").value=newVal;
        }
   }
   for (i=1;i<Rels.length;i++)
   {
        newVal=eval(document.getElementById("0").value/Rels[i]);
        neg=0;
        if (newVal < 0)
        {
            newVal*=-1;
            neg=1;
        }
        j=0;
        while (newVal<1 && newVal>0)
        {
               j++;
               newVal*=10;
        }
        newVal*=100000;
        newVal=Math.round(newVal);
        newVal/=100000;
        newVal/=Math.pow(10,j);
        newVal="a"+newVal;
        cache=0;
        if (newVal.indexOf("e") != -1)
        {
            cache=newVal.substr(newVal.indexOf("e"),5);
            newVal=newVal.substring(0,newVal.indexOf("e"));
        }
        dig=new Array;
        for (j=1;j<5;j++)
            dig[j]=newVal.substr(newVal.length-j-1,1);
        if (dig[1] == 9 && dig[2] == 9 && dig[3] == 9 && dig[4] == 9)
           {
                rest=newVal.substring(newVal.indexOf("."),100).length-1;
                newVal=newVal.substring(1,newVal.length-1);
                newVal="a"+eval(eval(newVal)+Math.pow(10,-rest+2));
            }
       for (j=1;j<5;j++)
             dig[j]=newVal.substr(newVal.length-j-1,1);
       if (dig[1] == 0 && dig[2] == 0 && dig[3] == 0 && dig[4] == 0)
             {
                 check=0;
                 for (j=0;j<newVal.length-5;j++)
                 {
                      if (newVal.substr(j,1)!=0)
                          check++;
                 }
                 if (check>2)
                     newVal=newVal.substring(0,newVal.length-1);
             }
        if (cache)
            newVal=newVal+cache;
        newVal=newVal.substring(1,newVal.length);
        if (neg)
            newVal*=-1;
        document.getElementById(i).value=eval(newVal);
   }
}
// end 'Umrechnung: Bits und Bytes' -->
</script>

<table style="width: 750px;" class="tableinborder" border="0" cellpadding="4" cellspacing="1">
 <tbody><tr class="tabletitle" width="100%"><td colspan="10" width="100%"><span class="smallfont"><center>
  <b>.: Größenumrechnung :.</b>
 </center></span></td></tr>
 <tr><td class="tablea" width="100%">
 <table class="tableinborder" style="width: 100%;" cellpadding="4" cellspacing="1">
  <colgroup><col width="150"><col></colgroup><tbody>
   <tr><td class="tableb">
    <font  face="Arial, Helvetica, sans-serif" size="4"><b>Umrechnung: Bit und Byte (Bits and Bytes)</b></font>
    <font  face="Arial, Helvetica, sans-serif"><b>1 Byte sind 8 Bit</b></font>
     <form><div align="center">
      <table class="tableinborder" style="width: 100%;" cellpadding="4" cellspacing="1">
      <tr><td class="tableb">
       <div align="right"><font face="Arial, Helvetica, sans-serif">Bit (b):</font></div></td>
       <td class="tableb">
        <input id="0" size="20" onchange="doCalc(0)" value="" style="background-color: #FFFFFF">
       </td></tr>
      <tr><td class="tableb">
       <div align="right"><font face="Arial, Helvetica, sans-serif">Byte (B):</font></div></td>
       <td class="tableb">
        <input id="1" size="20" onchange="doCalc(1)" value="" style="background-color: #FFFFFF">
       </td></tr>
      <tr><td class="tableb">
       <div align="right"><font face="Arial, Helvetica, sans-serif">Kilobyte (kB):</font></div></td>
       <td class="tableb">
        <input id="2" size="20" onchange="doCalc(2)" value="" style="background-color: #FFFFFF">
       </td></tr>
      <tr><td class="tableb">
       <div align="right"><font face="Arial, Helvetica, sans-serif">Megabyte (MB):</font></div></td>
       <td class="tableb">
        <input id="3" size="20" onchange="doCalc(3)" value="" style="background-color: #FFFFFF">
       </td></tr>
      <tr><td class="tableb">
        <div align="right"><font face="Arial, Helvetica, sans-serif">Gigabyte (GB):</font></div></td>
       <td class="tableb">
        <input id="4" size="20" onchange="doCalc(4)" value="" style="background-color: #FFFFFF">
       </td></tr>
      <tr><td class="tableb">
       <div align="right"><font face="Arial, Helvetica, sans-serif">Terabyte (TB):</font></div></td>
       <td class="tableb">
        <input id="5" size="20" onchange="doCalc(5)" value="" style="background-color: #FFFFFF">
       </td></tr>
      </table>
    <input name="reset" type="reset" value="R&uuml;cksetzen">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input type="button" value="Berechnung">
  </div>
</form>