﻿dojo.require("dijit.Dialog");

/*
ShowPleaseWait()
--------------
shows a div on a page on top of the other elements
Required HTML: <div id="divPleaseWait" style="display:none;">Please Wait... Working</div>
called from OnClientClick event of ASP.NET control: OnClientClick="ShowPleaseWait()"
*/
function ShowPleaseWait() {
    var pw = document.getElementById("divPleaseWait");
    pw.style.width = "400";
    pw.style.height = "30";
    pw.style.position = "absolute";
    pw.style.left = window.screen.availWidth / 2 - 200;
    pw.style.top = window.screen.availHeight / 2 - 15;
    pw.style.backgroundColor = "white";
    pw.style.fontWeight = "bold";
    pw.style.textAlign = "center";
    pw.style.fontSize = "x-large";
    pw.style.padding = "5";
    pw.style.border = "solid 1px black";
    pw.style.zIndex = "100";
    pw.style.display = "block";
}

function ShowHideDiv(target) {
    var elem = document.getElementById(target);
    if (elem.style.display == "none") elem.style.display = "";
    else elem.style.display = "none";
}

function ShowHideElement(div, a, textToShowHide) {
    var elem = document.getElementById(div);
    var link = document.getElementById(a);
    //var snip = document.getElementById(span);
    if (elem.style.display == "none") {
        elem.style.display = "";
        //snip.style.display = "none";
        link.innerHTML = "[-] " + textToShowHide;
    }
    else {
        elem.style.display = "none";
        //snip.style.display = "";
        link.innerHTML = "[+] " + textToShowHide;
    }
}

function ShowQuickHelp(help) {
    var qh = document.getElementById("divQuickHelp");
    qh.style.width = "700";
    qh.style.height = "500";
    qh.style.position = "absolute";
    qh.style.left = window.screen.availWidth / 2 - 350;
    qh.style.top = window.screen.availHeight / 2 - 350;
    qh.style.backgroundColor = "white";
    qh.style.padding = "5";
    qh.style.border = "solid 1px black";
    qh.style.zIndex = "100";
    qh.style.display = "block";
    qh.innerHTML = HelpItem(help);
}

function HideQuickHelp() {
    var qh = document.getElementById("divQuickHelp");
    qh.style.display = "none";
}

function HelpItem(help) {
    var s = "";
    switch (help) {
        case "regusers":
            s += "<b>Registered Users</b><br /><br />";
            s += "You do not need to register to use this site, however, registration does allow you the ability to perform more advanced searches, create custom map views, and receive updates to the site via email.<br /><br />";
            s += "During registration, you will be asked to provide required and optional information. Your email is required in order to receive updates and in case you forgot your username or password.<br /><br />";
            break;
        case "browsers":
            s += "<b>Browser Settings</b><br />";
            s += "Browser settings...";
            break;
        case "feedback":
            s += "<b>Feedback</b><br />";
            s += "Feedback...";
            break;
    }
    s += "<hr /><a href='javascript:HideQuickHelp()'>Close</a>";
    return s;
}