﻿// JScript File

String.prototype.endsWith = function(str) {
    return (this.match(str + "$") == str)
}

/*<script language="javascript" type="text/javascript">*/
    function show(objid)
    {
        var block = document.getElementById(objid);
        block.style.display = block.style.display=="block"||block.style.display==""?"none":"block";
    }
    /*</script>*/
    
    var activePopUpWindow = '';
    function PopUpOnClickFunction(popupName, el) {
        if (activePopUpWindow == '') {
            activePopUpWindow = '#' + popupName;
            ShowhelpPopUp($(activePopUpWindow), absPosition(el))
        } else {
            HidehelpPopUp($(activePopUpWindow));
            if (activePopUpWindow != '#' + popupName) {
                ShowhelpPopUp($('#' + popupName), absPosition(el));
                activePopUpWindow = '#' + popupName;
            } else {
                activePopUpWindow = '';
            }
        }
    }

    function ShowhelpPopUp(infoEl, coord) {
        if (infoEl != null) {
            coord.x += 0;
            coord.y -= infoEl.height() - 5;
            infoEl[0].style.left = coord.x + 'px';
            infoEl[0].style.top = coord.y + 'px';
            infoEl[0].style.display = '';
        }
    }

    function HidehelpPopUp(infoEl) {
        if (infoEl != null) {
            infoEl[0].style.display = 'none';
        }
    }

    function absPosition(obj) {
        var x = y = 0;
        while (obj) {
            x += obj.offsetLeft;
            y += obj.offsetTop;
            obj = obj.offsetParent;
        }
        return { x: x, y: y };
    }


    function makeBMark(title, url) {
        if (window.sidebar) {
            window.sidebar.addPanel(title, url, "");
        } else if (window.opera && window.print) {
            var mbm = document.createElement('a');
            mbm.setAttribute('rel', 'sidebar');
            mbm.setAttribute('href', url);
            mbm.setAttribute('title', title);
            mbm.click();
        } else if (document.all) {
            window.external.AddFavorite(url, title);
        }
    }
