﻿function get_browser() {
    Browser = navigator.appName;
    Net = Browser.indexOf("Netscape");
    Micro = Browser.indexOf("Microsoft");
    if (Net >= 0) {
        return "Netscape";
    }
    if (Micro >= 0) {
        return "IE";
    }

}
function modal(url, width, height) {
    var Browser = get_browser();
    var Netscape = false, IE = false;
    if (Browser == "IE") {
        IE = true;
    }
    if (Browser == "Netscape") {
        Netscape = true;
    }

    var posX, posY;
    if (IE) {
        posX = event.screenX;
        posY = event.screenY + 20;
    } else if (Netscape) {
        posX = (screen.width - width) / 2;
        posY = (screen.height - height) / 2;
    }
    var screenW = screen.width;
    var screenH = screen.height - 20;
    if (posX + width > screenW) { posX = posX - width - 40; }
    if (posY + height > screenH) { posY = posY - height - 80; }
    newnode = showModalDialog(url, null, "dialogWidth:" + width + "px; dialogHeight: " + height + "px; resizable: no; help: no; status: no; scroll: yes; dialogLeft:" + posX + "; dialogTop:" + posY);
    return newnode;
}
function TreeSelect(txtBoxID, lblID) {
    return_value = modal('../../Includes/TreeSelect.aspx', 500, 400);
    if (return_value != null) {
        return_value = return_value.split('#');
        document.getElementById(txtBoxID).value = return_value[0];
        document.getElementById(lblID).innerHTML = "(" + return_value[1] + ")";
    }
}
function RecordSelect(txtBoxID, lblID) {
    return_value = modal('../../Includes/RecordSelect.aspx', 500, 400);
    if (return_value != null) {
        return_value = return_value.split('#');
        document.getElementById(txtBoxID).value = return_value[0];
        document.getElementById(lblID).innerHTML = "(" + return_value[1] + ")";
    }
}
