function Is() {
  agent  = navigator.userAgent.toLowerCase();
  this.major = parseInt(navigator.appVersion);
  this.minor = parseFloat(navigator.appVersion);
  this.ns    = ((agent.indexOf('mozilla')   !=   -1) &&
               ((agent.indexOf('spoofer')   ==   -1) &&
               (agent.indexOf('compatible') ==   -1)));
  this.ns4   = (this.ns && (this.major      ==    4));
  this.ns6   = (this.ns && (this.major      >=    5));
  this.ie    = (agent.indexOf("msie")       !=   -1);
  this.ie4   = (this.ie && (this.major      ==    4) &&
               (agent.indexOf("msie 5.0")   ==   -1));
  this.ie5   = (this.ie && (this.major      ==    4) &&
               (agent.indexOf("msie 5.0")   !=   -1));
  this.ie55  = (this.ie && (this.major      ==    4) &&
               (agent.indexOf("msie 5.5")   !=   -1));
  this.ie6   = (this.ie && (this.major      ==    4) &&
               (agent.indexOf("msie 6")     !=   -1));
  this.nsdom = (this.ns4);
  this.iedom = (this.ie4 || this.ie5 || this.ie55);
  this.v4dom = (this.ie4 || this.ie5 || this.ie55 || this.ns4);
  this.w3dom = (this.ie6 || this.ns6);
}

var is = new Is();

var popup        = null;
var screenWidth  = screen.width;
var screenHeight = screen.height;
var infoLYR      = null;



if(is.nsdom || is.iedom || is.w3dom) {
buttonOFF = new Image();
buttonOFF.src ="buttonInAct.gif";
buttonON = new Image();
buttonON.src ="buttonAct.gif";
}

var previous  = "dev";
var current   = "dev";

function toggle(i) {
  if(is.nsdom || is.iedom) {
    current = i;
    document.images[current].src = buttonON.src;
    if(current != previous) {
      document.images[previous].src = buttonOFF.src;
    }
    previous = current;
  }
}

function restore() {
  if(is.nsdom && document.infoLayer || is.ie || is.w3dom) {
    infoLYR.visibility ="hidden";
    toggle(current);
  }
}

if(is.nsdom) {
  doc = "document[";
  sty = "]";
  htm = "].document"
} else if(is.iedom) {
  doc = "document.all[";
  sty = "].style";
  htm = "]";
} else if(is.w3dom) {
  doc = "document.getElementById(";
  sty = ").style";
  htm = ")";
}

function displayInfo(msg) {
  var info = "<table border='0' cellpadding='0' cellspacing='0' width='500'><tr><td background=''><FONT CLASS='info'>" + msg + "</FONT></td></tr></table>"
  if(is.nsdom && document.infoLayer || is.ie || is.w3dom) {
    infoLYR      = eval(doc + '"infoLayer"' + sty);
    infoHTML     = eval(doc + '"infoLayer"' + htm);
    infoLYR.left = 250;
    infoLYR.top  = (is.ns4x) ? 320 : 350;
    if(is.nsdom) {
      infoHTML.write(info);
      infoHTML.close();
    } else if(is.iedom || is.w3dom) {
      infoHTML.innerHTML = info;
    }
    infoLYR.visibility = "visible";
  }
}
