﻿// JScript File
//<![CDATA[
function show(obj) { obj.style.display = 'inline'; }
function hide(obj) { obj.style.display = 'none'; }
function mrug(obj) { obj.style.display == 'none' ? obj.style.display = 'inline' : obj.style.display = 'none'; }
function mrug1(obj) { var images = document.getElementsByTagName('img'); for (i = 0; i < images.length; i++) if (images[i].className == 'colorPalette' && images[i] != obj) images[i].style.display = 'none'; if (obj != null) obj.style.display == 'none' ? obj.style.display = 'inline' : obj.style.display = 'none'; }

function findPos(obj) { var curtop = 0; if (obj.offsetParent) { do { curtop += obj.offsetTop; } while (obj = obj.offsetParent); return curtop; } } function ScrollToEl(id) { var el = findPos(document.getElementById(id)); var br = (document.all) ? document.documentElement.scrollTop : window.pageYOffset; var st = (br - el) / 1; for (i = 0; i < 1; i++) { br -= st; window.scroll(0, br); } }

function get_cookie(cookie_name) {
    var results = document.cookie.match('(^|;) ?' + cookie_name + '=([^;]*)(;|$)');

    if (results)
        return (unescape(results[2]));
    else
        return null;
}
var PageRequestManagerEx =
{
    _initialized: false,

    init: function() {
        if (!PageRequestManagerEx._initialized) {
            var _callQueue = new Array();
            var _executingElement = null;
            var _prm = Sys.WebForms.PageRequestManager.getInstance();

            _prm.add_initializeRequest(initializeRequest);
            _prm.add_endRequest(endRequest);

            PageRequestManagerEx._initialized = true;
        }

        function initializeRequest(sender, args) {
            if (_prm.get_isInAsyncPostBack()) {
                var postBackElement = args.get_postBackElement();
                if (_executingElement != postBackElement) {
                    args.set_cancel(true);
                    Array.enqueue(_callQueue, postBackElement);
                }
                _executingElement = null;
            }
        }

        function endRequest(sender, args) {
            if (_callQueue.length > 0) {
                _executingElement = Array.dequeue(_callQueue);
                _prm._doPostBack(_executingElement.id, '');
            }
        }
    }
}
function updateComponentEx(comp, timeStamp) {
    PageRequestManagerEx.init();
    stamp = get_cookie("HistoryTimeStamp");
    if (timeStamp < stamp) {
        __doPostBack(comp, '');

    }
}
function getStyleBySelector(selector) {
    var sheetList = document.styleSheets;
    var ruleList;
    var i, j;

    for (i = sheetList.length - 1; i >= 0; i--) {
        ruleList = sheetList[i].cssRules;
        for (j = 0; j < ruleList.length; j++) {
            if (ruleList[j].type == CSSRule.STYLE_RULE &&
               ruleList[j].selectorText == selector) {
                return ruleList[j].style;
            }
        }
    }
    return null;
}
function show(obj) {
    obj.style.display = 'inline';
}
function hide(obj) {
    obj.style.display = 'none';
}
function mrug(obj) {
    obj.style.display == 'none' ? obj.style.display = 'inline' : obj.style.display = 'none';
}
function mrug1(obj) {
    var images = document.getElementsByTagName('img');
    for (i = 0; i < images.length; i++) if (images[i].className == 'colorPalette' && images[i] != obj) images[i].style.display = 'none';

    if (obj != null)
        obj.style.display == 'none' ? obj.style.display = 'inline' : obj.style.display = 'none';
}
function TreeviewExpandCollapseAll(treeViewId, expandAll) {
    var displayState = (expandAll == true ? "none" : "block");
    var treeView = document.getElementById(treeViewId);
    if (treeView) {
        var treeLinks = treeView.getElementsByTagName("a");
        var nodeCount = treeLinks.length;
        for (i = 0; i < nodeCount; i++) {
            if (treeLinks[i].firstChild.tagName) {
                if (treeLinks[i].firstChild.tagName.toLowerCase() == "img") {
                    var currentToggleLink = treeLinks[i];
                    var childContainer = GetParentByTagName("table", currentToggleLink).nextSibling;
                    if (childContainer.style.display == displayState) {
                        eval(currentToggleLink.href);
                    }
                }
            }
        }
    }
}
function GetParentByTagName(parentTagName, childElementObj) {
    var parent = childElementObj.parentNode;
    while (parent.tagName.toLowerCase() != parentTagName.toLowerCase()) {
        parent = parent.parentNode;
    }
    return parent;
}
//]]>