/// <reference path="jquery/jquery-1.3.2.js" />
this._SearchEffect = null;
function InializePB() {
    $('#AjaxWait').hide();
    PBMgr.ToggleSearchBrowser();
    //FLUInit();
}
PBMgr = new function () {
    this.SIDXSel = {};
    this.TIDXLoaded = {};
    this.HideAllSelection = false;
    this._ServerPage = new String();
    this._Params = {};
    this._Params.SingleSelect = false;
    this._Params.SearchLeftToRight = true;
    this._Params.TabsSearchIndependent = true;
    this._Params.PBSVALS = {};
    this._Params.PBRESQM = {};
}
PBMgr.BindFormAndPage = function (ParamVals, ServerPage) {
    for (var Key in ParamVals) { this._Params[Key] = ParamVals[Key]; }
    if (ServerPage != undefined && ServerPage.length > 0) {
        this._ServerPage = ServerPage;
    }

}
PBMgr.ParamsInit = function() {
    this._Params.TYPE = "AJAX";
}
PBMgr.ToggleSearchBrowser = function() {
    this.ParamsInit();
    try {
        if (typeof(ShowLogout) != 'undefined' && ShowLogout === true) { $('#LogoutButton').show(); } else { $('#LogoutButton').hide(); }
        if (this._SearchEffect != null) { this._SearchEffect.cancel(); }
        PBMgr.ShowTab($('#SRCHTAB0')[0], true);
        this._Params.PBTIDX = 0;
        $('#ProdBrowLoading').hide();
        $('#PBContent').show();
        if (typeof (ShowSingleSelect) != 'undefined' && ShowSingleSelect == 'TRUE') { $('#SingleSelectLayout').show(); }
    }
    catch (ex) { LogErr("PBMgr.ToggleSearchBrowser", ex.message); }
}
PBMgr.GetPropName = function(PID) { return PB.PROPNAMES[PID]; }
PBMgr.GetListName = function(PID, PBTLC) {
    var ListName = PB.PBTNAMES[PID][PBTLC];
    if (ListName == undefined) {
        var MsgDtl = "Missing List Name (PID: " + PID + " PBTLC: " + PBTLC + ")";
        LogErr("PBMgr.GetListName", MsgDtl);
    }
    return ListName;
}

PBMgr.WriteTabSrchPanes = function (TIDX, PBTLIST) {
    try {
        var W = PBMgr.GetSrchPaneWidth(PB.TABDEF[TIDX]);
        var S = [];
        S.push("<table class=\"TabSrchPanes\" cellspacing=\"0\"><tr>");
        for (var SIDX in PB.TABDEF[TIDX]) {
            S.push("<td class=\"SrchPaneCell\" style=\"width:" + W + "px\"><span class=\"SrchPaneHead\">" + PBMgr.GetPropName(PB.TABDEF[TIDX][SIDX]) + "</span><div id=\"SrchPane_T" + TIDX + "_S" + SIDX + "\" class=\"SrchPane\" style=\"width:" + W + "px\">");
            S.push(PBMgr.WriteSrchPane(TIDX, PBTLIST[PB.TABDEF[TIDX][SIDX]], PB.TABDEF[TIDX][SIDX], SIDX));
            S.push("</div></td>");
            S.push("<td id=\"SpacerPane_T" + TIDX + "_S" + SIDX + "\" class=\"SpacerColumn\"></td>");
        }
        S.push("</tr></table>");
        $('#Tab' + TIDX + 'SrchPane').html(S.join(''));
    }
    catch (ex) { LogErr("PBMgr.WriteTabSrchPanes", ex.message); }
}
PBMgr.WriteSrchPane = function(TIDX, PBTREE, PID, SIDX) {
    try {
        if (this.SIDXSel[TIDX] == undefined) { this.SIDXSel[TIDX] = new Object(); }
        if ((this._Params.SearchLeftToRight) || this.SIDXSel[TIDX][SIDX] == undefined) {
            this.SIDXSel[TIDX][SIDX] = new Object();
        }
        var Parents = "[";
        var S = [];
        S.push("<table style=\"width:100%\" border=\"0\" cellpadding=\"1\" cellspacing=\"1\">");
        S = PBMgr.WriteChild(TIDX, PBTREE, PID, SIDX, 0, S, Parents, 0);
        S.push("</table>");
        return S.join('');
    }
    catch (ex) { LogErr("PBMgr.WriteSrchPane", ex.message); }
}
PBMgr.WriteChild = function(TIDX, PBTREE, PID, SIDX, LIDX, S, PARENTS, PARENTID) {
    //PID - IDES PID, SIDX - Search Index on current tab, LIDX - Current Level
    //Parents - String representation of Parents, PARENTID - TREE ID.
    try {
        if (PBTREE["LC"] == undefined) {
            LIDX++;
            if (PARENTID != 0) {
                if (PARENTS.length > 1) { PARENTS += ","; }
                PARENTS += PARENTID;
            }
            for (var Child in PBTREE) {
                var LCArray = PARENTS;
                if (PARENTS.length > 1) { LCArray += ","; }
                LCArray += Child;
                var CellID = "T" + TIDX + "S" + SIDX + "C" + Child;
                S.push("<tr><td id=\"D" + CellID + "\"><a id=\"A" + CellID + "\" href=\"#\" onclick=\"javascript:PBMgr.SIDXSearch(" + SIDX + ",'" + LCArray + "]','" + CellID + "');\" class=\"LVL_" + LIDX + "\">");
                if (LIDX == 3) { S.push("- "); }
                var ListName = PBMgr.GetListName(PID, Child);
                var CNT = PBTREE[Child]["CNT"];
                if (CNT != undefined) { S.push(ListName.replace('{0}', CNT)); }
                else { S.push(ListName); }
                S.push("</a></td></tr>");
                S = PBMgr.WriteChild(TIDX, PBTREE[Child], PID, SIDX, LIDX, S, PARENTS, Child)
            }
        }
        else { LIDX = LIDX - 1; }
        return S;
    }
    catch (ex) { LogErr("PBMgr.WriteChild", ex.message); }
}
PBMgr.GetAllChildLC = function(PBTREE, LCArray) {
    try {
        if (PBTREE["LC"] == undefined) {
            for (var Child in PBTREE) {
                LCArray = PBMgr.GetAllChildLC(PBTREE[Child], LCArray);
            }
        }
        else {
            if (LCArray.length > 0) { LCArray.push("|"); }
            LCArray.push(PBTREE["LC"]);
        }
        return LCArray;
    }
    catch (ex) { LogErr("PBMgr.GetAllChildLC", ex.message); }
}
PBMgr.Logout = function () {
    try {
        $('#LogoutButton').enabled = false;
        this._Params.A = 'LOGOUT';
        if (IDES.Page) {
            IDES.Page.ajax({ data: this._Params, success: Logout_callback  });
        }
        else {
            $.get(this._ServerPage, this._Params, Logout_callback, 'json');
        }
    }
    catch (ex) { LogErr("PBMgr.Logout", ex.message); }
}
PBMgr.GetSrchPaneWidth = function(PBSRCH) {
    try {
        var W = 0; var retVal;
        for (var SIDX in PBSRCH) { W++; }
        if (typeof PBMgr._Params.PageWidth != 'undefined') { retVal = PBMgr._Params.PageWidth / W; }
        else { retVal = 760 / W; }
        return retVal;
    }
    catch (ex) { LogErr("PBMgr.GetSrchPaneWidth", ex.message); }
}
PBMgr.ClearAllSearch = function (Append) {
    try {
        var Redirect = PBMgr._Params.ErrorRedirect;
        if (Append != undefined) {
            if (Redirect.indexOf("?") == -1) { Redirect += "?"; }
            Redirect += "&" + Append;
        }
        $('#AjaxWait').show();
        location.href = Redirect;
    }
    catch (ex) { LogErr("PBMgr.ClearAllSearch", ex.message); }
}
function Logout_callback(LogoutResp) {
    $('#AjaxWait').show();
    location.href = LogoutResp.Redirect;
}
PBMgr.SIDXSearch = function (SIDX, PBID, UID) {
    try {
        $('#AjaxWait').show();
        var TIDX = this._Params.PBTIDX;
        var SCRIT = [];
        var QMCRIT = [];
        if ((SIDX > -1) && (PBID != undefined) && (UID != undefined)) {
            PBMgr.SelectItem(TIDX, SIDX, PBID, UID);
            for (var iSIDX in PB.TABDEF[TIDX]) {
                if ((iSIDX <= SIDX && this._Params.SearchLeftToRight === true) || this._Params.SearchLeftToRight === false) {
                    //Go through all selected items for this Tab & Search Pane.
                    TSSelItem = PBMgr.SIDXSel[TIDX][iSIDX];
                    var LCArray = [];
                    for (var Selected in TSSelItem) {
                        //Retrieve all of the Link Codes for the selected item.
                        var PBIDs = eval(TSSelItem[Selected]);
                        var PBTREE = PB.PBTLIST[PB.TABDEF[TIDX][iSIDX]]
                        if (PBIDs != null) {
                            for (var i = 0; i < PBIDs.length; i++) {
                                PBTREE = PBTREE[PBIDs[i]];
                            }
                            LCArray = PBMgr.GetAllChildLC(PBTREE, LCArray);
                        }
                    }
                    var LC = LCArray.join('');
                    //Build Compact QM string notation.
                    if (SCRIT.length > 0) { SCRIT.push("~"); }
                    if (LC.length == 0) { LC = "-1"; }
                    SCRIT.push(PB.TABDEF[TIDX][iSIDX] + ":" + LC);
                    if (LC != "-1") {
                        if (QMCRIT.length > 0) { QMCRIT.push('~'); }
                        QMCRIT.push(PB.TABDEF[TIDX][iSIDX] + ":" + LC);
                    }
                }

            }
            this._Params.PBSVALS[this._Params.PBTIDX] = SCRIT.join('');
            this._Params.PBRESQM[this._Params.PBTIDX] = QMCRIT.join('');
        }
//        else { LC = -1; }
        this._Params.A = 'SEARCH';
        this._Params.PBSIDX = SIDX;
//        this._Params.PBSVALS[this._Params.PBTIDX] = SCRIT.join('');
       // this._Params.PBRESQM[this._Params.PBTIDX] = QMCRIT;
        var callback = ((SIDX > -1) && (PBID != undefined) && (UID != undefined)) ? PBMgr.SIDXSearch_callback : PBMgr.SIDXReload_callback;
        this.ServerUpdate(callback);
       // IDES.Page.ajax({ data: this._Params, success: callback, url: this._ServerPage });
    }
    catch (ex) { LogErr("SIDXSearch", ex.message); }
}
PBMgr.ServerUpdate = function (callback) {
    if ($().jquery == "1.3.1" || $().jquery == "1.3.2") {
        var PBSVALSLocal = this._Params.PBSVALS; 
        for (var IDX in PBSVALSLocal) {
            this._Params["PBSVALS[" + IDX + "]"] = PBSVALSLocal[IDX];
        }
        var PBRESQMLocal = this._Params.PBRESQM
        for (var IDX in PBRESQMLocal) {
            this._Params["PBRESQM["+ IDX + "]"] = PBRESQMLocal[IDX];
        }
    }

    var PageAjaxParams = { data: this._Params, success: callback };
    if (this._ServerPage != "") { PageAjaxParams["url"] = this._ServerPage; }
    IDES.Page.ajax(PageAjaxParams);
}
PBMgr.SelectItem = function(TIDX, SIDX, PBID, UID) {
    try {
        var TDName = "D" + UID;

        if (PBID == '[1]')  //Only 'all' needs to be selected.
        {
            TSSelItem = PBMgr.SIDXSel[TIDX][SIDX];
            for (var Selected in TSSelItem) {
                var CellName = "D" + Selected;
                $('#' + CellName).removeClass();
            }
            this.SIDXSel[TIDX][SIDX] = new Object();
        }
        else if (this._Params.SingleSelect) {
            TSSelItem = PBMgr.SIDXSel[TIDX][SIDX];
            for (var Selected in TSSelItem) {
                var CellName = "D" + Selected;
                if (Selected != UID) {
                    $('#' + CellName).removeClass();
                    this.SIDXSel[TIDX][SIDX][Selected] = null;
                }
            }
        }
        else  //Verify 'all' is not selected.
        {
            TSSelItem = PBMgr.SIDXSel[TIDX][SIDX];
            for (var Selected in TSSelItem) {
                if (TSSelItem[Selected] == ['[1]']) {
                    //Clear from the SIDXSel index & then unselect the user interface.
                    this.SIDXSel[TIDX][SIDX][Selected] = null;
                    var CellName = "D" + Selected;
                    if (this.HideAllSelection) {
                        $('#' + CellName).removeClass().addClass('HideItem');
                    }
                    else {
                        $('#' + CellName).removeClass();
                    }
                }
            }
        }
        if (this.SIDXSel[TIDX][SIDX][UID] != null) {
            //Unselect the item.
            $('#' + TDName).removeClass();
            this.SIDXSel[TIDX][SIDX][UID] = null;
        }
        else {
            //Select Item.
            this.SIDXSel[TIDX][SIDX][UID] = PBID;
            $('#' + TDName).removeClass().addClass("SelItem");
        }
        if (PBID == '[1]' && this.HideAllSelection) {
            $('#' + TDName).removeClass().addClass("HideItem");
        }
    }
    catch (ex) { LogErr("PBMgr.SelectItem", ex.message); }
}
PBMgr.ShowTab = function (tabElement, InitLoad) {
    try {
        TabsLocked = false;
        if (TabsLocked) { return; }
        for (var tNum in PB.TABDEF) {
            var tab = $('#' + TabIDBase + tNum);
            if (tab.length > 0) {
                if (tab.attr('id') == tabElement.id) {
                    this._Params.PBTIDX = tNum;
                    tab.removeClass().addClass('currentTab');
                    if ((PBMgr.TIDXLoaded[tNum] == undefined)) {
                        PBMgr.TIDXLoaded[tNum] = true;
                        PBMgr.WriteTabSrchPanes(tNum, PB.PBTLIST);
                    }
                    
                    PBMgr.TIDXChange(tNum);
                    $('#Tab' + tNum + 'SrchPane').show();
                }
                else {
                    tab.removeClass().addClass('inactive');
                    $('#Tab' + tNum + 'Results').hide();
                    $('#Tab' + tNum + 'ResultsInfo').hide();
                    $('#Tab' + tNum + 'SrchPane').hide();
                }
            }
        }
    }
    catch (ex) { LogErr("PBMgr.ShowTab", ex.message); }
}
PBMgr.TIDXChange = function (TIDX) {
    this._Params.A = 'SEARCH';
    var callback = (this._Params.TabsSearchIndependent) ? PBMgr.SIDXSearch_callback : PBMgr.SIDXReload_callback;
    if (PBMgr.TabHasSearches(TIDX) || (!this._Params.TabsSearchIndependent && PBMgr.TabHasSearches(-1))) {
        if (!this._Params.TabsSearchIndependent) {
            for (var SIDX in PB.TABDEF[TIDX]) {
                $('#SrchPane_T' + TIDX + '_S' + SIDX).html('');
            }
        }
        this.ServerUpdate(callback);
    }
    if (this._Params.TabsSearchIndependent && typeof (ReloadResultsTabChange) == 'function') {
        ReloadResultsTabChange(PBMgr.TabHasSearches(TIDX));
    }
    else {
        if ($('#Tab' + TIDX + 'Results').length > 0) {
            $('#Tab' + TIDX + 'Results').show();
            var RI = $('#Tab' + TIDX + 'ResultsInfo').html();
            if (RI.length > 0) {
                $('#Tab' + TIDX + 'ResultsInfo').show();
            }
        }
    }
}
PBMgr.TabHasSearches = function (TIDX) {
    var HasSearches = false;
    for (var iTab in PB.TABDEF) {
        if ((TIDX == -1) || (iTab == TIDX)) {
            for (var iSIDX in PB.TABDEF[iTab]) {
                if (PBMgr.SIDXSel[iTab]) {
                    TSSelItem = PBMgr.SIDXSel[iTab][iSIDX];
                    for (var Check in TSSelItem) {
                        HasSearches = true;
                        break;
                    }
                }
                if (HasSearches) { break; }
            }
            if (HasSearches) { break; }
        }
    }
    return HasSearches;
}
PBMgr.HandleSearchResponse = function(SrchResp, LoadResults) {
    try {
        var TIDX = this._Params.PBTIDX;
        var Results = (SrchResp['RC'] == 0) ? 'No Materials' : ((SrchResp['RC'] == 1) ? '1 Material' : SrchResp['RC'] + ' Materials');
        var DYM = SrchResp['DYM'];
        if (SrchResp.ServerReset == 'True') {
            LogErr("HandleSearchResponse", "Server Requested Reset!");
            PBMgr.WriteTabSrchPanes(TIDX, PB.PBTLIST);
            $('#Tab' + TIDX + 'ResultsInfo').html('An Error has occured.');
            $('#Tab' + TIDX + 'Results').html('');
            LoadResults == false;
        }
        else if (SrchResp['RC'] > 0) {
            for (var SRKey in SrchResp) {
                if ((List[SRKey]) && (SrchResp[SRKey] != null)) {
                    if (SrchResp[SRKey] == '') {
                        PruneList($('#LOOKUP_' + SRKey));
                    }
                    else {
                        if ($('#LOOKUP_' + SRKey).length > 0) { PopulateList($('#LOOKUP_' + SRKey), SrchResp[SRKey], List[SRKey], true); }
                    }
                }
            }
        }
        else if (this._Params.PBSIDX == -1 && this._Params.SearchLeftToRight) {
            PBMgr.WriteTabSrchPanes(TIDX, SrchResp.SRCHLIST);
        }
        else {
            for (var SIDX in PB.TABDEF[TIDX]) {
                if (!this._Params.SearchLeftToRight) {
                    //Select all items that have been preselected.
                    $('#SrchPane_T' + TIDX + '_S' + SIDX).html(PBMgr.WriteSrchPane(TIDX, SrchResp.SRCHLIST[PB.TABDEF[TIDX][SIDX]], PB.TABDEF[TIDX][SIDX], SIDX));
                    if (this.SIDXSel[TIDX][SIDX]) {
                        for (var UID in this.SIDXSel[TIDX][SIDX]) {
                            if (this.SIDXSel[TIDX][SIDX][UID] != null) {
                                var TDName = "D" + UID;
                                $('#' + TDName).removeClass().addClass("SelItem");
                            }
                        }
                    }
                }
                else {
                    //Prepopulate the 'All' function if previous pane has been searched.
                    if (SIDX > this._Params.PBSIDX) {
                        $('#SrchPane_T' + TIDX + '_S' + SIDX).html(PBMgr.WriteSrchPane(TIDX, SrchResp.SRCHLIST[PB.TABDEF[TIDX][SIDX]], PB.TABDEF[TIDX][SIDX], SIDX));
                        var UID = "T" + TIDX + "S" + SIDX + "C1";
                        if ($('#D' + UID).length > 0) {
                            PBMgr.SelectItem(TIDX, SIDX, "[1]", UID);
                        }
                    }
                }
            }
        }
        $('#Tab' + TIDX + 'SrchPane').show();
        if (!this._Params.TabsSearchIndependent) {
            if (SrchResp.CRITSUMMARY)
            { $('#PBSearchSummary').html('<span class="PBSearchLabel">Searched: </span><span class="PBSearchCriteria">' + SrchResp.CRITSUMMARY + '</span>'); }
            else { $('#PBSearchSummary').html('&nbsp;'); }
        }
        if (LoadResults == true) { GetResults(); }
        else { $('#AjaxWait').hide(); }
    }
    catch (ex) { LogErr("PBMgr.HandleSearchResponse", ex.message); }
}

PBMgr.SIDXSearch_callback = function (JSONResp) {
    try {
        var Resp = ((JSONResp.Data)&&(JSONResp.Info)) ? JSONResp.Data : JSONResp;
        PBMgr.HandleSearchResponse(Resp, true);
    }
    catch (ex) { LogErr("PBMgr.SIDXSearch_callback", ex.message); }
}
PBMgr.SIDXReload_callback = function(JSONResp) {
    try {
        var Resp = ((JSONResp.Data) && (JSONResp.Info)) ? JSONResp.Data : JSONResp;
        PBMgr.HandleSearchResponse(Resp, false); }
    catch (ex) { LogErr("PBMgr.SIDXReload_callback", ex.message); }
}


HtmlUtility = function() {}
HtmlUtility.FancyAnchorWithOnclick = function(href, target, cssClass, hoverStatus, content, onClickEvent) {
    try {
        if (target != '') { target = ' target=\"' + target + '\"'; }
        if (cssClass != '') { cssClass = ' class=\"' + cssClass + '\"'; }
        if (hoverStatus != '') { hoverStatus = ' onMouseOver=\"status=\'' + hoverStatus.replace('\'', '\\\'').replace('\"', '') + '\'; return true;\" onMouseOut=\"status=\'\'; return true;\"' }
        if (onClickEvent != '') { onClickEvent = ' onclick=\"' + onClickEvent + '\"'; }
        return '<a href=\"' + href + '\"' + target + cssClass + hoverStatus + onClickEvent + '>' + content + '</a>';
    }
    catch (ex) { LogErr("HtmlUtility.FancyAnchorWithOnclick", ex.message); }
}
HtmlUtility.FancyAnchor = function(href, target, cssClass, hoverStatus, content) {
    return HtmlUtility.FancyAnchorWithOnclick(href, target, cssClass, hoverStatus, content, '');
}
function FLUInit() {
    if ((List == undefined) || (List == null)) { LoadList(); }
    else { InitLists(); }
}
function InitLists() {
    try {
        for (var PID in List) {
            if ($('#LOOKUP_' + PID).length > 0) { PopulateList($('#LOOKUP_' + PID), List[PID], null, true); }
        }
    }
    catch (ex) { LogErr("InitLists", ex.message); }
}
function PruneList(ListBoxElem) {
    try {
        if (ListBoxElem.selectedIndex >= 0) {
            var SelOption = ListBoxElem.options[ListBoxElem.selectedIndex];
            ListBoxElem.options.length = 0;
            ListBoxElem.options[0] = SelOption;
        }
    }
    catch (ex) { LogErr("PruneList", ex.message); }
}
function PopulateList(ListBoxElem, ListData, AllListData, ShowCount) {
    try {
        if (ListBoxElem[0].length > 0) { ListBoxElem[0].length = 0; }
        var i = 0;
        ListBoxElem[0].options[i++] = new Option('All...', ' ')
        for (var LinkCode in ListData) {
            var Display;
            var Count;
            var LCData = ListData[LinkCode];
            if (LCData.length) {
                Display = LCData[0];
                if ((Display == '') && (AllListData != null)) { Display = AllListData[LinkCode][0]; }
                Count = LCData[1];
            }
            else {
                Display = AllListData[LinkCode][0];
                Count = LCData;
            }
            if (ShowCount) { Display += ' (' + Count + ')'; }
            ListBoxElem[0].options[i++] = new Option(Display, LinkCode);
        }
    }
    catch (ex) { LogErr("PopulateList", ex.message); }
}
function LoadList() {
    try {
        $('#AjaxWait').show();
        LkpFrm.elements['A'].value = 'FULLLIST';
        new Ajax.Request('lookup.aspx', { method: 'post', onSuccess: LoadList_Callback, parameters: Form.serialize('LkpFrm') });
    }
    catch (ex) { LogErr("LoadList", ex.message); }
}
function LoadList_Callback(transport) {
    $('#AjaxWait').hide();
    try { eval('List = ' + transport.responseText); +';' }
    catch (ex) { LogErr("LoadList_Callback", ex.message); }
    InitLists();
}
function ListSearch(ListBox) {
    try {
        for (var TIDX in PB.TABDEF) {
            $('#Tab' + TIDX + 'Results').html('');
            $('#Tab' + TIDX + 'Results').css('height', '');
            $('#Tab' + TIDX + 'Results').css('overflowY', '');
            $('#Tab' + TIDX + 'ResultsInfo').html('');
            $('#Tab' + TIDX + 'ResultsInfo').hide();
            if (TIDX != PBMgr._Params.PBTIDX) {
                PBMgr.TIDXLoaded[TIDX] = false;
                for (var SIDX in PB.TABDEF[TIDX]) {
                    if ($('#SrchPane_T' + TIDX + '_S' + SIDX).length > 0) { $('#SrchPane_T' + TIDX + '_S' + SIDX).html(''); }
                }
            }
        }
    }
    catch (ex) { LogErr("ListSearch", ex.message); } finally { }
    PBMgr.SIDXSearch(-1, undefined, undefined);
}
function CkmouseDown(e) {
 var ctrlPressed=0;
 var altPressed=0;
 var shiftPressed=0;

 if (parseInt(navigator.appVersion)>3) {

  var evt = navigator.appName=="Netscape" ? e:event;

  if (navigator.appName=="Netscape" && parseInt(navigator.appVersion)==4) {
   // NETSCAPE 4 CODE
   var mString =(e.modifiers+32).toString(2).substring(3,6);
   shiftPressed=(mString.charAt(0)=="1");
   ctrlPressed =(mString.charAt(1)=="1");
   altPressed  =(mString.charAt(2)=="1");
   self.status="modifiers="+e.modifiers+" ("+mString+")"
  }
  else {
   // NEWER BROWSERS [CROSS-PLATFORM]
   shiftPressed=evt.shiftKey;
   altPressed  =evt.altKey;
   ctrlPressed =evt.ctrlKey;
   self.status=""
    +  "shiftKey="+shiftPressed 
    +", altKey="  +altPressed 
    +", ctrlKey=" +ctrlPressed 
  }
  if (ctrlPressed) return true;
 }
 return false;
}

function LogErr(CallFctn, MsgDtl, Msg, Severity) {
    if (CallFctn == undefined) { CallFctn = "Calling Function Not Specified"; }
    if (MsgDtl == undefined) { MsgDtl = "Undefined JS Error"; }
    if (Msg == undefined) { Msg = "JS Exception"; }
    if (Severity == undefined) { Severity = "INFO"; }
    MsgDtl = CallFctn + "\n" + MsgDtl;
    var ErrorPage = "http://services.ides.com/AJAXServices/Logging.aspx";
    var QS = '?MSG=' + escape(Msg) + '&SEV=' + escape(Severity) + '&MSGDTL=' + escape(MsgDtl);
    try {
        var ErrPost = new Image();
        ErrPost.src = ErrorPage + QS;
        ErrPost = null;
    }
    catch (ex) { }
}
function ShowTab(A,B) { PBMgr.ShowTab(A,B); }
function ClearAllSearchPage () { return PBMgr.ClearAllSearch();}








