Javascript para determinar el ancho / alto de la mesa

Tengo un JavaScript que trato de usar para definir el ancho / alto de mi mesa para que fluya en diferentes resoluciones. Parece funcionar bien para el ancho, pero no consigo que funcione para la altura. Está configurando el número correcto en la variable correcta, simplemente no está configurando la altura de las tablas. Esto es lo que tengo ..

<html>
<head>
<script type="text/javascript">
 var viewportwidth;
 var viewportheight;
 var tablewidth;
 var tableheight;
 if (typeof window.innerWidth != 'undefined'){ //set's viewport width/height into respective variables
              viewportwidth = window.innerWidth,
              viewportheight = window.innerHeight
         }else if (typeof document.documentElement != 'undefined'
             && typeof document.documentElement.clientWidth !=
             'undefined' && document.documentElement.clientWidth != 0){
               viewportwidth = document.documentElement.clientWidth,
               viewportheight = document.documentElement.clientHeight
         }else{
               viewportwidth = document.getElementsByTagName('body')[0].clientWidth,
               viewportheight = document.getElementsByTagName('body')[0].clientHeight
         } 
 function asdf(){
 tablewidth = Math.round(viewportwidth/100*70);  //sets table width to 70% of viewport width
 tableheight = Math.round(tablewidth/100*74);    //sets table height to 74% of table width, this number is ambigous
 document.getElementById('poop').innerHTML = tableheight+', '+tablewidth+', viewport width is '+viewportwidth+'x'+viewportheight;
 document.getElementById('container').width = tablewidth;
 document.getElementById('container').height = tableheight;
}
</script>
</head>
<body onload="asdf();">
<span id="poop"></span>
    <table id="container" cellpadding="0" border="1" cellspacing="0" width="" height="">
        <tr><td colspan="5"></td></tr>
        <tr>
            <td width="38%"></td>
            <td width="12%"></td>
            <td width="21%"></td>
            <td width="14%"></td>
            <td width="15%"></td>
        </tr>
    </table>
</body>
</html>

¿Alguien ve lo que estoy haciendo mal?

Respuestas a la pregunta(4)

Su respuesta a la pregunta