// Library Usage:
// <SCRIPT TYPE="text/javascript" SRC="../DFCMenu/common_functions.js"></SCRIPT>

var ie = document.all;
var isMinNS4 = (navigator.appName.indexOf("Netscape") >= 0 && parseFloat(navigator.appVersion) >= 4) ? 1 : 0;
var isMinNS6 = (isMinNS4 && navigator.userAgent.indexOf("Gecko")>=0) ? 1 : 0;
var isMinIE4 = (document.all) ? 1 : 0;
var isMinIE5 = (isMinIE4 && navigator.appVersion.indexOf("5.")) >= 0 ? 1 : 0;
var isDOM = (document.getElementById) ? 1 : 0;


function PageInfo ( ) {
  if ( ! ie ) {
    this.y = window.pageYOffset;
    this.x = window.pageXOffset;
    this.vw = window.top.innerWidth;
    this.vh = window.top.innerHeight;
  } else if ( document.documentElement && document.documentElement.clientWidth ){
    this.y = document.documentElement.scrollTop;
    this.x = document.documentElement.scrollLeft;
    this.vw = document.documentElement.clientWidth;
    this.vh = document.documentElement.clientHeight;
  } else if (document.body) {
    this.y = document.body.scrollTop;
    this.x = document.body.scrollLeft;
    this.vw = document.body.clientWidth;
    this.vh = document.body.clientHeight;
  }
  this.sw = getPageWidth();
  this.sh = getPageHeight();
}

function getPageWidth() {

  if (isMinNS6)
    return(document.body.offsetWidth);
  if (isMinNS4)
    return(document.width);
  if (isMinIE4)
    return(document.body.scrollWidth);
  return(-1);
}

function getPageHeight() {

  if (isMinNS4)
    return(document.height);
  if (isMinNS6)
    return(document.body.offsetHeight);
  if (isMinIE4)
    return(document.body.scrollHeight);
  return(-1);
}


function setOptionsMenu ( menuOptions ) {
  var optionDiv = document.getElementById('OptionsDiv');
  if ( optionDiv ) {
//    optionDiv.innerHTML = menuOptions;
  }
}

function updateOptionsMenu ( frameName ) {
  var pageOptions = document.getElementById('PageOptionCell');
  var optionDiv = document.getElementById('OptionsDiv');
  if ( optionDiv && pageOptions ) {
	var opt = pageOptions.innerHTML;
	pageOptions.innerHTML = "";
	if ( opt.indexOf("<BR>") != -1 ) {
	  opt = opt.replace("<BR>"," | ");
	}
	if ( opt.indexOf("<br>") != -1 ) {
	  opt = opt.replace("<br>"," | ");
	}
    optionDiv.innerHTML = opt;
  }
}

function printEmailAddress(username, domain, text, className ) {
  var html = "<A HREF='mailto:"+username+"@"+domain+"'";
  if ( className ) {
    html += " CLASS='"+className+"'";
  }
  if ( text ) {
     html += ">"+text+"</A>";
  } else {
     html += ">"+username+"@"+domain+"</A>";
  }
  document.write(html);
}
