﻿var minHeight = 600;
var minWidth = 1000;
var modeScroll = false;

$(function () {
    resizeBody();
    $(window).resize(resizeBody);
});

function resizeBody() {
    var elm = document.getElementsByTagName("body");

    var pageWidth = 0, pageHeight = 0;

    if (typeof (window.innerWidth) == 'number') {
        pageWidth = window.innerWidth;
        pageHeight = window.innerHeight;
    }
    else if (document.documentElement && (document.documentElement.clientWidth || document.documentElement.clientHeight)) {
        //IE 6+ 
        pageWidth = document.documentElement.clientWidth;
        pageHeight = document.documentElement.clientHeight;
    }
    else if (document.body && (document.body.clientWidth || document.body.clientHeight)) {
        //IE 4 compatible
        pageWidth = document.body.clientWidth;
        pageHeight = document.body.clientHeight;
    }

    if (pageWidth < minWidth+55) {
        //? elm.style.width = minWidth + 'px' : elm.style.width = '100%';  
        $("#nav .logoMasterCard").css({ 'left': '945px' });
        $("#nav").css({ 'width': '1025px' });
       
    } else {
        $("#nav .logoMasterCard").removeAttr('style');
        $("#nav").removeAttr('style');
    }
    
    if (pageHeight < minHeight-100 && modeScroll == false) {
        modeScroll = true;
        $("#wrap").css({"margin": "0 auto", "position": "relative", "padding": "21px 0 0 0", 'left':'0', 'top': '0'});
        $("#nav").css({'position': 'relative'});
        $("#menu").css({'margin-left': '131px', 'margin-top': '20px','overflow': 'hidden','position':'absolute'});
        $("#views").css({ 'min-height': '510px', 'padding-bottom': '9px', 'position': 'inherit' });
        $("#links").css({ 'bottom': '0' });
        
    }
    else if (pageHeight > minHeight-100 && modeScroll == true) {
        $("#wrap").removeAttr('style');
        $("#nav").removeAttr('style');
        $("#menu").removeAttr('style');
        $("#views").removeAttr('style');
        $("#links").removeAttr('style');
       
        modeScroll = false;
    }
   // ? elm.style.height = minHeight + 'px' : elm.style.height = '100%';
   
}

