﻿// JScript File

    function centerMainTable()
    {
        var mainTable = document.getElementById('mainTable');
        
        //alert(mainTable.offsetHeight);
        
        mainTable.style.marginTop = mainTable.style.marginBottom = 0 + 'px';
    
          var myWidth = 0, myHeight = 0;
          if( typeof( window.innerWidth ) == 'number' ) {
            //Non-IE
            
            if(window.innerHeight > mainTable.offsetHeight)
            {
                mainTable.style.marginTop = mainTable.style.marginBottom = (window.innerHeight - mainTable.offsetHeight)/2 + 'px';
            }
            else
            {
                mainTable.style.marginTop = mainTable.style.marginBottom = 0 + 'px';
            }
            
          } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
            //IE 6+ in 'standards compliant mode'
            if(document.documentElement.clientHeight > mainTable.offsetHeight)
            {
                mainTable.style.marginTop = mainTable.style.marginBottom = (document.documentElement.clientHeight - mainTable.offsetHeight)/2 + 'px';
            }
            else
            {
                mainTable.style.marginTop = mainTable.style.marginBottom = 0 + 'px';
            }
            
          } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
            //IE 4 compatible
            if(document.body.clientHeight > mainTable.offsetHeight)
            {
                mainTable.style.marginTop = mainTable.style.marginBottom = (document.body.clientHeight - mainTable.offsetHeight)/2 + 'px';
            }
            else
            {
                mainTable.style.marginTop = mainTable.style.marginBottom = 0 + 'px';
            }
            
          }
//          window.alert( 'margin-top = ' + mainTable.style.marginTop );
//          window.alert( 'margin-bottom = ' + mainTable.style.marginBottom );
    }
    
    
    function setTopMargin()
    {
        //var mainTable = document.getElementById('mainTable');
        
        //alert(mainTable.offsetHeight);
        
        //mainTable.style.marginTop = mainTable.style.marginBottom = 0 + 'px';
    
          var myWidth = 0, myHeight = 0;
          if( typeof( window.innerWidth ) == 'number' ) {
            //Non-IE
            
            if(window.innerHeight < 700)
            {
                document.body.style.marginTop = 5 + 'px';
            }
            else
            {
                document.body.style.marginTop = 5 + '%';
            }
            
          } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
            //IE 6+ in 'standards compliant mode'
            if(document.documentElement.clientHeight < 700)
            {
                document.body.style.marginTop = 5 + 'px';
            }
            else
            {
                document.body.style.marginTop = 5 + '%';
            }
            
          } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
            //IE 4 compatible
            if(document.body.clientHeight < 700)
            {
                document.body.style.marginTop = 5 + 'px';
            }
            else
            {
                document.body.style.marginTop = 5 + '%';
            }
            
          }
//          window.alert( 'margin-top = ' + mainTable.style.marginTop );
//          window.alert( 'margin-bottom = ' + mainTable.style.marginBottom );
    }



