﻿/*
    <script language="javascript" src="../APP_Java/_FormInfo.js"></script>
    <script>DebugInfo();</script>
*/

var loForm = document.forms(0);
var lsProcess = "";

function ErrorHandler(tsErrorMsg, tsURL, tiLine){
    alert(tsErrorMsg + "\nURL: "+tsURL+"\nLine:"+tiLine);
    return false;
}
function NoSpaces(tsString){
    return tsString.replace(" ","");
}
function ConfirmOption(tsSender){
    lsProcess = tsSender;

    // BUTTON [DELETE] 
    if(tsSender=="lbtnDelete"){
        var lbDelete = confirm("Are you sure you want to delete this?");
        return lbDelete;
    }

    if(typeof(lsFormValidation)=="string" && lsFormValidation=="FormValidation()"){
        try {
            return FormValidation(tsSender);
        } catch (lsErrorMsg){
            // Trap the error (assumed to be string)
            alert(lsErrorMsg);
            // return false to prevent processing on error
            return false;
        }
    }
}
function setupWindow() {
 outputWindow = open("","output")
 outputWindow.document.write("<HTML><HEAD><TITLE>Output Window</TITLE></HEAD><BODY>")
}
function describeBrowser() {
 outputWindow.document.write("<H2>Browser Properties</H2>")
 outputWindow.document.write(navigator.appCodeName+" ")
 outputWindow.document.write(navigator.appName+" ")
 outputWindow.document.write(navigator.appVersion+"<BR>")
 outputWindow.document.write(navigator.mimeTypes.length+" MIME types are defined. ")
 outputWindow.document.write(navigator.plugins.length+" plug-ins are installed.")
}
function describeWindow() {
 outputWindow.document.write("<H2>Window Properties</H2>")
 outputWindow.document.write("Frames: "+frames.length+"<BR>")
 outputWindow.document.write("URL: "+location.href+"<BR>")
}
function describeDocument() {
 outputWindow.document.write("<H2>Document Properties</H2>")
 describeLinks()
 describeForms()
}
function describeLinks(){
 outputWindow.document.write("<H3>Links</H3>")
 outputWindow.document.write("This document contains "+document.links.length+" links:<BR>")
 for(i=0;i<document.links.length;++i)
  outputWindow.document.write(document.links[i].href+"<BR>")
}
function describeForms() {
 outputWindow.document.write("<H3>Forms</H3>")
 for(i=0;i<document.forms.length;++i) describeForm(i)
}
function describeForm(n) {
 outputWindow.document.write("Form "+n+" has "+document.forms[n].elements.length+" elements:")
 for(j=0;j<document.forms[n].elements.length;++j)
   outputWindow.document.write("<BR>"+document.forms[n].elements[j].id)
 outputWindow.document.write("<BR>")
}
function finishWindow() {
 outputWindow.document.write("<FORM><INPUT Type='button' Value='Close Window' onClick='window.close()'></FORM>")
 outputWindow.document.write("</BODY></HTML>")
}
function DebugInfo(){
    setupWindow()
    describeDocument()
    describeBrowser()
    describeWindow()
    finishWindow()
}

/*
<script language="javascript">var lbDebug=false;</script>
<script language="javascript">
    if(lbDebug)
        DebugInfo();
</script>
*/