

//take over resizing
var _previousResizeFunction = window.onresize;
window.onresize = SE_ResizeWindow;

function SE_WindowResized()
{
  SE_ResizeWindow();
}

function SE_ResizeWindow()
{ 
  //alert("prev: " + typeof(_previousResizeFunction));
  //alert("typeof(_previousResizeFunction): " + typeof(_previousResizeFunction));
  
  //call previous function if present...
  if (typeof(_previousResizeFunction) != 'undefined' && typeof(_previousResizeFunction) != 'object')  //the test for object is for IE because it it set to "object" initially!
    _previousResizeFunction();
  
  //window.alert("navigator.appName: " + navigator.userAgent);
  //alert("SE_NoAutoResize: " + SE_NoAutoResize);
  
  //no resizing for navigator. it's giving problems.
  //but the navigators that are based on firefox are ok!
  //if(isNav && navigator.userAgent.indexOf("Firefox") == -1)
  //  return;
  
  //alert("document.body.offsetHeight: " + document.body.offsetHeight);
  
  var myWidth = 0, myHeight = 0;
  if(typeof( window.innerWidth ) == 'number')
  { 
    //Non-IE
    myWidth = window.innerWidth;
    myHeight = window.innerHeight;
  } 
  else if(document.documentElement && (document.documentElement.clientWidth || document.documentElement.clientHeight))
  { 
    //IE 6+ in 'standards compliant mode'
    myWidth = document.documentElement.clientWidth;
    myHeight = document.documentElement.clientHeight;
  } 
  else if(document.body && (document.body.clientWidth || document.body.clientHeight))
  { 
    //IE 4 compatible
    myWidth = document.body.clientWidth;
    myHeight = document.body.clientHeight;
  }
  
  //window.alert( 'Width = ' + myWidth  + ", Height: " + myHeight);
  var nMyWidth = parseInt(myWidth);
  var minEdgeSpace = 40;  //40
  var maxWidth = 1400;
  
  if(nMyWidth < 890)
    nMyWidth = 870;
  else if(nMyWidth < maxWidth) //990
    nMyWidth = (nMyWidth - minEdgeSpace)
  else
    nMyWidth = maxWidth - minEdgeSpace; //970
  
  
  if (document.getElementById("PageBackground") != null)
    document.getElementById("PageBackground").style.visibility = (myWidth > maxWidth ? "visible" : "hidden");  //"100%";
  
  
  if (document.getElementById("Wrapper") != null)
  { 
    //if SE_NoAutoResize variable is set to true, do not resize the client!
    if(typeof(SE_NoAutoResize) != "undefined" && SE_NoAutoResize)
    { 
      //the Wrapper div wraps the entire page..
      document.getElementById("Wrapper").style.width = "100%";
      
      if(document.getElementById("FooterContent") != null)
        document.getElementById("FooterContent").style.width = "100%";
      
      //resize the utility links and menu links if they exist!
      if(document.getElementById("utility") != null)
        document.getElementById("utility").style.width = "98%";
      
    }
    else
    { 
      document.getElementById("Wrapper").style.width = nMyWidth + "px";
  
      if(document.getElementById("FooterContent") != null)
        document.getElementById("FooterContent").style.width = nMyWidth + "px";
      
      //resize the utility links and menu links if they exist!
      if(document.getElementById("utility") != null)
        document.getElementById("utility").style.width = nMyWidth + "px";
      
    }
  }
  
  //resize the map object if the function is defined! 
  SE_WindowResize_Map();
  
}





function SE_WindowResize_Map()
{ 
  if (typeof(GetMaxWidth_MC) == 'undefined')
    return;
  
  if (initClientWidth == "automax" || initClientWidth == "auto")
  { 
    var oMapClientStyleObj = getObject_MC('MapClientObject');
    
    if (typeof(oMapClientStyleObj) != 'undefined')
    { 
      //for IE, set the width property, else set the style width.
      if (typeof(oMapClientStyleObj.width) != 'undefined')
      { 
        oMapClientStyleObj.width = GetMaxWidth_MC();
        oMapClientStyleObj.height = GetMaxHeight_MC();
      }
      else
      { 
        oMapClientStyleObj.style.width = GetMaxWidth_MC();
        oMapClientStyleObj.style.height = GetMaxHeight_MC();
      }
    }
  }
}







