﻿// JScript File
function init() 
{
    resizeDiv();   
    window.onresize=function() {
      resizeDiv();      
    }
}
// Código retirado do SpreadSheets do Google
function resizeDiv() 
{
    // client detection and page height/width
    var agent = navigator.userAgent.toLowerCase();
    var is_ie = (agent.indexOf('msie') != -1);
    var is_mac = (agent.indexOf('macintosh') != -1);
    var pageWidth = is_ie ? window.document.body.clientWidth : window.innerWidth;
    var pageHeight = is_ie ? window.document.body.clientHeight : window.innerHeight;

    // fix 1-way scrollbars in Firefox
    if (!is_ie) {
        var scrollbarSize = is_mac ? 15 : 19;
        if (pageWidth < minWidth) pageHeight -= scrollbarSize;
        if (pageHeight < minHeight) pageWidth -= scrollbarSize;
    }
    var minWidth = 500;
    var minHeight = 300;
    if (pageWidth >= minWidth && pageHeight >= minHeight) {
      document.body.style.overflow = 'hidden';
    } else {
      document.body.style.overflow = 'auto';
    }
}
