//   ##############  SIMPLE  BROWSER SNIFFER
if (document.layers) {
  navigator.family = "nn4"
}
if (document.all) {
  navigator.family = "ie4"
}
if (window.navigator.userAgent.toLowerCase().match("gecko")) {
  navigator.family = "gecko"
}

// ######  popup text (left over from "borrowed" script for future reference)
descarray = new Array(
  "Array item 0",
  "Array item 1",
  "Array item 2",
  "Array item 3",
  "Array item 4",
  "Array item 5");

overdiv="0";
function setOverdiv(val) {
    overdiv = val;
}

//  #########  CREATE POP UP BOX
function popLayer(comment, properties, link, linkText, roseDiagram, roseLink,
                  address, addressText, endText, linkArray) {
    if (navigator.family == "gecko") {
        pad="0"; bord="1 bordercolor=black";
    }
    else {
        pad="1"; bord="0";
    }
    // Begin the string
    // Note that the width of 200 pixels will be only partially respected by
    // browsers.  They will exceed it if needed to allow a "word" to complete
    // before wrapping occurs.  But it's essentially the only way to have any
    // level of control over how wide the popup will be in order to compensate
    // should it exceed the width of the browser window.
    desc = "<table width=200 cellspacing=0 cellpadding=" + pad
           + " border=" + bord + " bgcolor=000000><tr><td>\n"
           + "<table cellspacing=0 cellpadding=3 border=0 width=100%>"
           + "<tr><td bgcolor=ffffdd><center><font size=-1>\n<b>Comment:</b>"
           + "&nbsp;&nbsp;";
    // Add the comment
    if (comment == "") {
        desc = desc + "None specified.";
    }
    else {
        desc = desc + comment;
    }
    desc = desc + "<br>";
    // Add a link to the properties
    desc = desc + "<a href=\"" + properties +
           "\" target=mainFrame><b>View Properties</b></a><br>";
    // Add the URL if provided
    if (link != "") {
        desc = desc + "<a href=\"" + link + "\" target=self><b>"
               + linkText + "</b></a><br>";
    }
    // Add the Rose diagram link if provided
    if (roseDiagram != "") {
        desc = desc + "<a href=\"" + roseLink + "\" target=top>"
               + "<b>Rose UC Diagram:</b> " + roseDiagram + "</a><br>";
    }
    // Add the mailto if provided
    if (address != "") {
        desc = desc + "<a href=\"mailto:" + address + "\"><b>"
               + addressText + "</b></a><br>";
    }
    // Add the endText if provided
    if (endText != "") {
        desc = desc + endText;
    }
    // Handle the array of Transfer links if not empty
    size = linkArray.length;
    if (size > 1) {
        desc = desc + "<br>Transfer reference(s):<br>";
        for (var idx = 0; idx < size; idx = idx + 2) {
            desc = desc + "<a href=\"" + linkArray[idx] + "\">"
                   + linkArray[idx + 1] + "</a><br>";
        }
    }
    // Finish the string
    desc = desc + "\n</td></tr></table>\n</td></tr></table>";

    if (navigator.family == "nn4") {
        document.object1.document.write(desc);
        document.object1.document.close();
        document.object1.left=x;
        document.object1.top=y;
    }
    else if (navigator.family == "ie4"){
        object1.innerHTML=desc;
        // Use these lines for debug only
        //object1.innerHTML=desc + "<br>TEST CODE for IE4 family<br>x="
        // + x + "<BR>y=" + y + "<BR>dw=" + dw + "<BR>dh=" + dh;
        object1.style.pixelLeft=x;
        object1.style.pixelTop=y;
    }
    else if (navigator.family == "gecko"){
        document.getElementById("object1").innerHTML=desc;
        // Use these lines for debug only
        //document.getElementById("object1").innerHTML=desc
        // + "<br> TEST CODE for gecko family<BR>x=" + x + "<BR>y="
        // + y + "<BR>dw=" + dw + "<BR>dh=" + dh;
        document.getElementById("object1").style.left=x;
        document.getElementById("object1").style.top=y;
    }
}

function hideLayer() {
    if (overdiv == "0") {
        if (navigator.family =="nn4") {
            eval(document.object1.top="-500");
        }
        else if (navigator.family =="ie4") {
            object1.innerHTML="";
        }
        else if (navigator.family =="gecko") {
            document.getElementById("object1").style.top="-500";
        }
    }
}

//  ########  TRACKS MOUSE POSITION FOR POPUP PLACEMENT
var isNav = (navigator.appName.indexOf("Netscape") !=-1);
function handlerMM(e) {
    // Obtain X and Y coordinates of activation event
    x = (isNav) ? e.pageX : event.clientX + document.body.scrollLeft;
    y = (isNav) ? e.pageY : event.clientY + document.body.scrollTop;
    // Adjust right 15 and up 5 pixels (as standard)
    x = x + 15;
    y = y - 5;
    // Get the distances from the right and bottom edges
    // dw is distance from right edge of popup to right edge of window
    dw = document.body.clientWidth - x + document.body.scrollLeft;
    // If the distance isn't enough, move left enough to compensate
    if (dw < 225) {
      x = x - (225 - dw)
    }
    // dh is distance to bottom edge of window
    dh = document.body.clientHeight + document.body.scrollTop;
    // If not at least 100 pixels available, go up 100 pixels
    if ((y + 100) > dh) {
      y = dh - 100;
    }
}

if (isNav) {
    document.captureEvents(Event.MOUSEMOVE);
}
document.onmousemove = handlerMM;
//  End -->

