﻿var bWidth = 0;
var bHeight = 0;
var maxMapWidth = 1000;
var maxMapHeight = 400;

function mapStartUp() {
    browserSize();
    //var mapwidth = bWidth;
    //var mapheight = bHeight - 145;
    //if (mapwidth > maxMapWidth) {
    //    document.getElementById('flexCanvas').style.width = mapwidth + 'px';
    //    
    //}
    //if (mapheight > maxMapHeight) {
    //    document.getElementById('flexCanvas').style.height = mapheight + 'px';
    //   
   // }
    
    window.onresize = AdjustWebPage;
	AdjustWebPage();
}

function AdjustWebPage() {
    browserSize();
    var mapwidth = bWidth;
    var mapheight = bHeight - 145;
    if (mapheight > maxMapHeight) {
        document.getElementById('flexCanvas').style.height = mapheight + 'px';
    }
    else {
        mapheight = maxMapHeight;
    }
    if (mapwidth > maxMapWidth) {
        document.getElementById('flexCanvas').style.width = mapwidth + 'px';
    }
    else {
        mapwidth = maxMapWidth;
    }
   
}

function browserSize() {
    if (typeof (window.innerWidth) == 'number') {
        //Non-IE
        bWidth = window.innerWidth;
        bHeight = window.innerHeight;
    } else if (document.documentElement && (document.documentElement.clientWidth || document.documentElement.clientHeight)) {
        //IE 6+ in 'standards compliant mode'
        bWidth = document.documentElement.clientWidth;
        bHeight = document.documentElement.clientHeight;
    } else if (document.body && (document.body.clientWidth || document.body.clientHeight)) {
        //IE 4 compatible
        bWidth = document.body.clientWidth;
        bHeight = document.body.clientHeight;
    }
}    
