﻿// JScript File


function doPrint(elId) {

}


function doPrintRaw(elId) {
    var inHtml = GetInnerHtml(elId);
    var sprint = window.open('', '', 'toolbar=0,scrollbars=0');

    if (sprint) {
        sprint.document.write("<HTML>");
        sprint.document.write("<HEAD>");
        sprint.document.write("<HEAD>");
        sprint.document.write(inHtml);
        sprint.document.write("</BODY ></HTML>");
        sprint.document.close();
        sprint.focus();
        sprint.print();
        sprint.close();
    }
    else {
        window.print();
    }
}


function ConfirmedNavigation(question, url) {
    if (confirm(question)) {
        window.location.href = url;
    }
}

function ShowPopupMessage(text) {
    alert(text);
}




// JScript File
var showDebug = 1;

function SetVisibility(id, vis) {
    var elmStyle = GetElementStyle(id);
    if (elmStyle) {
        elmStyle.visibility = (vis) ? 'visible' : 'hidden';
    }
}

function SetDisplay(id, vis) {
    var elmStyle = GetElementStyle(id);
    if (elmStyle) {
        elmStyle.display = (vis) ? '' : 'none';
        //alert(id + ": " + elmStyle.display);
        //elmStyle.display = (vis) ? '' : 'none';
        //alert(id + ": " + elmStyle.display);
    }
}






function SetInnerHtml(id, value) {
    var elm = GetElement(id);
    if (elm) {
        if (!elm.innerHTML) {
            ReportError('SetInnerHtml(' + id + '): Element has no .innerHTML  property');
        }
        else {
            elm.innerHTML = value;
        }
    }
}


function GetInnerHtml(id) {
    var elm = GetElement(id);
    if (elm) {
        if (!elm.innerHTML) {
            ReportError('GetInnerHtml(' + id + '): Element has no .innerHTML  property');
        }
        else {
            return elm.innerHTML;
        }
    }
    return null;
}


function GetElement(id) {
    var elm = document.getElementById(id);
    if (!elm) {
        ReportError('GetElement(' + id + '): Element not found');
    }
    return elm;
}

function ElementExists(id) {
    return (document.getElementById(id)) ? true : false;
}


function GetElementStyle(id) {
    var elm = GetElement(id);
    if (elm) {
        if (!elm.style) {
            ReportError('GetElementStyle(' + id + '): Element has no style');
        }
        return elm.style;
    }
    return null;
}

function ReportError(err) {
    if (showDebug) {
        alert(err);
    }
}
