// ************************************************************************************************* 
// *** Variables. 
// ************************************************************************************************* 
// The height of the browser window. 
var mnu_windowHeight = -1; 

// Pointer to the application iFrame element. 
var mnu_container = null; 

// Pointer to the application frame (window) element. 
var mnu_frame = null; 

// ************************************************************************************************* 
// *** Functions. 
// ************************************************************************************************* 
// Set the size of the screen elements to fit the browser window. If continuous is true, the check 
// will be repeated continuously. 
function mnu_setWindowSize(continuous) { 
  //alert("Endrer størrelse");

  // *** Variable declarations. *** 
  var H, Y; 

  // *** Set screen element size. *** 
  H = com_getWindowHeight(); 
  //alert("Høyde = " + H);
  if((mnu_windowHeight < 0) || (H != mnu_windowHeight)) 
  { 
    if(mnu_container == null) mnu_container = com_getElement('applicationContainer'); 
    if(mnu_container != null) 
    { 
      mnu_windowHeight = H; 
      // Determine iFrame size. 
      Y = parseInt(mnu_container.style.top); 
      //if(isNaN(Y) || (Y < 0)) Y = 114;
      if(isNaN(Y) || (Y < 0)) Y = 154;
      H = Math.max(300, H - (Y + 4)); 
      // Set iFrame size and notify the application. 
      mnu_container.style.height = String(H) + 'px'; 
      if(mnu_frame == null) mnu_frame = window.frames['applicationFrame']; 
      if(mnu_frame != null) 
      { 
        if((mnu_frame.setWindowSize == null) || (!mnu_frame.setWindowSize(H))) 
          mnu_windowHeight = -1; 
      } 
    } 
  } 
  // Keep checking the window size. 
  if(continuous) setTimeout('mnu_setWindowSize(true);', 100); 
}

function com_openWindow(URL, name, parameters) { 
    var result; 
    result = window.open(URL, name, parameters); 
    result.focus(); 
    return result; 
} 

function com_getElement(elementName) { 
    var result; 
    result = null; 
    if((elementName == null) || (elementName == '')) return result; 
    if(document.getElementById) result = document.getElementById(elementName); else { 
        if(document.all) eval('result = document.all.' + elementName + ';'); 
        } 
    return result; 
} 

function com_getWindowWidth() { 
    if(document.all) return document.body.offsetWidth; 
    if(typeof(window.innerWidth) != 'undefined') return window.innerWidth; 
    return -1; 
} 

function com_getWindowHeight() { 
    if(document.all) return document.body.offsetHeight; 
    if(typeof(window.innerHeight) != 'undefined') return window.innerHeight; 
    return -1; 
} 