﻿    
    window.onresize = resizePage;

    function getSize()
    {       
        var viewportwidth = 0;
        var viewportheight = 0;
        var oldbrowser = 0;

        // the more standards compliant browsers (mozilla/netscape/opera/IE7) use window.innerWidth and window.innerHeight
        if(typeof window.innerWidth != 'undefined')
        {
            viewportwidth   = window.innerWidth;
            viewportheight  = window.innerHeight;
        }
        // IE6 in standards compliant mode (i.e. with a valid doctype as the first line in the document)
        else if( typeof document.documentElement != 'undefined' && 
                 typeof document.documentElement.clientWidth != 'undefined' && 
                 document.documentElement.clientWidth != 0)
        {
            viewportwidth   = document.documentElement.clientWidth;
            viewportheight  = document.documentElement.clientHeight;
 
        }
        // older versions of IE
        else
        {                
            viewportwidth   = document.body.clientWidth;
            viewportheight  = document.body.clientHeight;
          
        }
        
        if( document.getElementById('leftcolumn').style.minHeight == 'undefined')
        {
            oldbrowser = 1;
        }
        
        /******************************************
        *   CALC + FIX WIDTH
        ******************************************/
        var pMinWidth = 200 + 200 + 5 + 5;
                
        if(viewportwidth < 1240) viewportwidth = 1240;        
       
        document.getElementById('pageheader').style.width   = (viewportwidth - pMinWidth) + "px";
        document.getElementById('pagecontent').style.width  = (viewportwidth - pMinWidth) + "px";        
        document.getElementById('page').style.width      = viewportwidth + "px";
        document.getElementById('middlecolumn').style.width = (viewportwidth - pMinWidth) + "px";
        document.getElementById('header').style.width       = (viewportwidth ) + "px";
        document.getElementById('logo').style.width         = (viewportwidth - pMinWidth) + "px";
        
        if(oldbrowser != 1)
        {
            document.getElementById('page').style.minWidth          = viewportwidth + "px";
            document.getElementById('header').style.minWidth        = viewportwidth + "px";
            document.getElementById('container').style.minWidth    = viewportwidth + "px";
        }
        
        /******************************************
        *   CALC + FIX HEIGHT (after width is set)
        ******************************************/ 
        if(viewportheight<768) viewportheight = 768;
        
        var col_height = viewportheight - 100 - 5 - 5;      
        
        if(oldbrowser == 1)
        {
            document.getElementById('leftcolumn').      style.height = col_height + "px";
            document.getElementById('middlecolumn').    style.height = col_height + "px";           
            document.getElementById('pagecontent').     style.height = (col_height - 11) + "px";
            document.getElementById('rightcolumn').     style.height = col_height + "px";            
        }
        
        document.getElementById('leftcolumn').      style.minHeight = col_height + "px";
        document.getElementById('middlecolumn').    style.minHeight = col_height + "px";
        document.getElementById('pagecontent').     style.minHeight = (col_height - 11) + "px";
        document.getElementById('rightcolumn').     style.minHeight = col_height + "px";  
    }
    
    function resizePage() 
    {
       getSize();
    }
