
var resizeDelay;
var maximumLapseTime = 20;



function startUp() {

window.onresize = callResize;

}


function callResize() {
   clearTimeout(resizeDelay);
   resizeDelay=setTimeout("resizeMap()", 200);
 }



function resizeMap() {

var cntrlMap = Maps["Map1"]; 
var box = calcElementPosition("Map_Panel");
var eleMapPanel = document.getElementById("Map_Panel");

var sWidth = getWinWidth();
var sHeight = getWinHeight();

var mWidth = sWidth - box.left - 15
var mHeight= sHeight - box.top - 15

eleMapPanel.style.width = mWidth + "px"; 
eleMapPanel.style.height = mHeight + "px"; 

cntrlMap.resize(mWidth,mHeight,true); 

}


function dragRectangleSetup() {

var dragboxdiv = document.getElementById('DragBoxDiv');
dragboxdiv.style.borderColor = 'red';
dragboxdiv.style.borderWidth = '3px';
dragboxdiv.style.filter = 'alpha(opacity=60)';
dragboxdiv.style.backgroundColor = 'Yellow'; 

MapDragRectangle('Map1', '%toolbarItem%', true, 'hand');

}


function checkmd(){

alert(document.getElementById("Map1").divObject.onmousedown)

}


function elementSetup() {

   var sWidth = getWinWidth();
   var sHeight = getWinHeight();
   var eleMapPanel = document.getElementById("Map_Panel");
   var box = calcElementPosition("Map_Panel");

   var mWidth = sWidth - box.left - 15
   var mHeight= sHeight - box.top - 15

   eleMapPanel.style.width = mWidth + "px"; 
   eleMapPanel.style.height = mHeight + "px"; 


}


function calcMapWidth() {

var sWidth = getWinWidth();
var box = calcElementPosition("Map_Panel");
var mWidth = sWidth - box.left - 15

return mWidth

}


function printmap() {
var header = "<h3>Print page header</h3>"
var footer = "<b>Wood County</b>"
var obj = document.getElementById("Map1");
var widthPage = calcMapWidth() + 25;

var pwin = window.open ("print.htm", "PrintWindow","status=1,menubar=1,resizable=1,width=" + widthPage );
pwin.document.getElementById("map").innerHTML = obj.innerHTML
pwin.document.close();

}

function closeTool(id) {
    tool = document.getElementById(id);
    if (tool!=null) {
        tool.style.visibility = "hidden";
    }
}


function openTool(id) {
    tool = document.getElementById(id);
    if (tool!=null) {
        tool.style.visibility = "visible";
    }
}





