 // function to prevent closing of telerik dropdown control
    function stopPropagation(e) {
        e.cancelBubble = true;
        if (e.stopPropagation) {
            e.stopPropagation();
        }
    }

    //Get the current telerik RadWindow
    function GetRadWindow() {
        var oWindow = null;
        if (window.radWindow) oWindow = window.radWindow;
        else if (window.frameElement.radWindow) oWindow = window.frameElement.radWindow;
        return oWindow;
    }

    function CloseRadWindow() {
        var wnd = GetRadWindow();
        wnd.close();
    }

    function CloseRadWindowWithArgument(arg) {
        var wnd = GetRadWindow();
        if (wnd != null) 
        {
            wnd.close(arg);
        }
    }

    function CloseRadWindowWithReload(toReload) {
        var wnd = GetRadWindow();
        if (wnd != null) {
            var obj = new Object();
            obj.reload = toReload;
            wnd.close(obj);
        }
    }

    function OpenRadWindow(mngrId, wndId, url) {
        var mngr = $find(mngrId);
        if (mngr != null) {
            var wnd = mngr.GetWindowByName(wndId);
            if (wnd != null) {
                wnd.setUrl(url);
                wnd.show();
                //wnd.maximize();
            }
        }
    }


    //String trim functions
    String.prototype.trim = function() {
        return this.replace(/^\s+|\s+$/g, "");
    }
    String.prototype.ltrim = function() {
        return this.replace(/^\s+/, "");
    }
    String.prototype.rtrim = function() {
        return this.replace(/\s+$/, "");
    }
    
    //Check if a value is numeric
    function isNumber(n) {
        return !isNaN(parseFloat(n)) && isFinite(n);
    }

    function showDayOfWeekName(containerId, dayOfWeekIndex) {

        var containerObj = document.getElementById(containerId);
        if (containerObj != null) {
            containerObj.innerHTML = DaysOfWeekArray[dayOfWeekIndex];
        }
   }

    /***********************************************
    * Disable Text Selection script- © Dynamic Drive DHTML code library (www.dynamicdrive.com)
    * This notice MUST stay intact for legal use
    * Visit Dynamic Drive at http://www.dynamicdrive.com/ for full source code
    ***********************************************/

    function disableSelection(target) {
        if (typeof target.onselectstart != "undefined") //IE route
            target.onselectstart = function() { return false }
        else if (typeof target.style.MozUserSelect != "undefined") //Firefox route
            target.style.MozUserSelect = "none"
        else //All other route (ie: Opera)
            target.onmousedown = function() { return false }
        target.style.cursor = "default"
    }