// Browser identification
isNetscape4 = (document.layers) ? 1 : 0;
isGecko = (navigator.userAgent.indexOf('Gecko') > -1) ? 1 : 0;
isKonqueror = (navigator.userAgent.indexOf('Konqueror') > -1) ? 1 : 0;
isIE = (navigator.userAgent.indexOf('MSIE') > -1) ? 1 : 0;
isOpera = (navigator.userAgent.indexOf('Opera') > -1) ? 1 : 0;

// Attributes (numMenuImages change from 8 to 9)dlt
numHeaderImages = 2;
numMenuImages = 9;

//Events
//reload on resize
window.onresize = reDo;


/**
  * gets the width of document view area in the browser
  * returns width of browser or 0 if width is not able to be determined
  */
function getDocWidth(){
  width = 600;
  if((isNetscape4)||(isGecko)||(isKonqueror)){
    if(window.innerWidth>600){
      width = window.innerWidth;
    }
  } else if(isIE){
    if(document.body.clientWidth>600){
      width = document.body.clientWidth;
    }
  }
  return width;
}

/**
  * gets the height of document view area in the browser
  * returns height of browser or 0 if width is not able to be determined
  */
function getDocHeight(){
  height = 400;
  if((isNetscape4)||(isGecko)||(isKonqueror)){
    if(window.innerHeight>400){
      height = window.innerHeight;
    }
  } else if(isIE){
    if(document.body.clientHeight>400){
      height = document.body.clientHeight;
    }
  }
  return height;
}

function setupCommonGraphics(){
  if(getDocWidth() > 0){
    for(i=numHeaderImages; i < (numMenuImages+numHeaderImages); i++){
      document.images[i].width = 0.20 * getDocWidth();
      document.images[i].height = 0.07 * getDocHeight();
    }
    document.images[0].width  = 0.20 * getDocWidth();
    document.images[0].height = 0.20 * getDocHeight();
    document.images[1].width  = 0.75 * getDocWidth();
    document.images[1].height = 0.20 * getDocHeight();
  }
}

/**
  * things to be done after page is loaded
  */
function postPageLoad(){
  setupCommonGraphics();
}

/**
  * reloads current page
  */
function reDo(){
  window.location.reload();
}

