﻿var type = "IE"; //Variable used to hold the browser name
BrowserSniffer();

//detects the capabilities of the browser
function BrowserSniffer() {
    if (navigator.userAgent.indexOf("Opera") != -1 && document.getElementById) type = "OP"; //Opera
    else if (document.all) type = "IE"; //Internet Explorer e.g. IE4 upwards
    else if (document.layers) type = "NN"; //Netscape Communicator 4
    else if (!document.all && document.getElementById) type = "MO"; //Mozila e.g. Netscape 6 upwards
    else type = "IE"; //I assume it will not get here
}


function writeLayer(id, str) {

    if (type == "IE") { document.all[id].innerHTML = str; }
    if (type == "NN") {
        document.layers[id].document.open();
        document.layers[id].document.write(str);
        document.layers[id].document.close();
    }
    if (type == "MO" || type == "OP") {
        document.getElementById(id).innerHTML = str;
    }
}

function writeLayerConcat(id, str) {

    if (type == "IE") { document.all[id].innerHTML = document.getElementById(id).innerHTML == "" ?  str : document.getElementById(id).innerHTML  + "<br>" + str; }
    if (type == "NN") {
        document.layers[id].document.open();
        document.layers[id].document.write(str);
        document.layers[id].document.close();
    }
    if (type == "MO" || type == "OP") {
        document.getElementById(id).innerHTML = document.getElementById(id).innerHTML == "" ?  str : document.getElementById(id).innerHTML  + "<br>" + str;
    }
}


//Disables Right clicking on the page
var message = "";
///////////////////////////////////
/*function clickIE() { if (document.all) { (message); return false; } }
function clickNS(e) {
    if
(document.layers || (document.getElementById && !document.all)) {
        if (e.which == 2 || e.which == 3) { (message); return false; } 
    } 
}
if (document.layers)
{ document.captureEvents(Event.MOUSEDOWN); document.onmousedown = clickNS; }
else { document.onmouseup = clickNS; document.oncontextmenu = clickIE; }

document.oncontextmenu = new Function("return false")*/


//Allows printing of webpage
function printit() {
    if (window.print) {
        window.print();
    } else {
        var WebBrowser = '<OBJECT ID="WebBrowser1" WIDTH=0 HEIGHT=0 CLASSID="CLSID:8856F961-340A-11D0-A96B-00C04FD705A2"></OBJECT>';
        document.body.insertAdjacentHTML('beforeEnd', WebBrowser);
        WebBrowser1.ExecWB(6, 2); //Use a 1 vs. a 2 for a prompting dialog box    WebBrowser1.outerHTML = "";  
    }
}

function browser(id) {
    if (type == "NN") {
        path = document.layers[id]
    }
    else if (type == "IE") {
        path = document.all[id]
    }
    else {
        path = document.getElementById(id)
    }
    return path  //return the path to the css layer depending on which browser is looking at the page
}

//Toggle Layer visibility
function hideLayer(id) {
    var layer = browser(id)
    if (type == "NN") {
        layer.visibility = "hidden"
    }
    else {
        layer.style.visibility = "hidden"
    }
}
function showLayer(id) {
    var layer = browser(id)
    if (type == "NN") {
        layer.visibility = "visible"
    }
    else {
        layer.style.visibility = "visible"
    }
}

if (document.getElementById) {
    document.write('<style type="text/css">\n')
    document.write('.dropcontent{display:block;}\n')
    document.write('</style>\n')
}

