﻿var wnd;
var wnd2;
var ctrlcbkgetElementById;

function cbkgetElementById(ctrlName)
{
    ctrlcbkgetElementById = document.getElementById("ctl00_cp_" + ctrlName);
    if (ctrlcbkgetElementById)
        return ctrlcbkgetElementById;

    ctrlcbkgetElementById = document.getElementById("ctl00_" + ctrlName);
    if (ctrlcbkgetElementById)
        return ctrlcbkgetElementById;

    ctrlcbkgetElementById = document.getElementById(ctrlName);
    if (ctrlcbkgetElementById)
        return ctrlcbkgetElementById;

    return null;
}

function EnableCBKImageButton(btnname, is_enabled)
{
    try { cbkgetElementById(btnname).disabled = !is_enabled; } catch (ex) { };
    try { cbkgetElementById("img_" + btnname).disabled = !is_enabled; } catch (ex) { };
    try { cbkgetElementById("lbl_" + btnname).disabled = !is_enabled; } catch (ex) { };

    if (browser.isIE == false)
        cbkgetElementById(btnname).className += " DisabledImage";
}

function Create_Async_Call_Object()
{
    var _xmlhttp;
    try
    {
        _xmlhttp = new XMLHttpRequest();
    } catch (e)
    {
        _xmlhttp = false;
    }
    if (!_xmlhttp)
    {
        try
        {
            xmlhttp.overrideMimeType('text/xml');
        }
        catch (e) { }
    }

    if (!_xmlhttp && typeof XMLHttpRequest != 'undefined')
    {
        try
        {
            _xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
        }
        catch (e)
        {
            try
            {
                _xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
            }
            catch (E)
            {
                _xmlhttp = false;
            }
        }
    }

    if (!_xmlhttp && window.createRequest)
    {
        try
        {
            _xmlhttp = window.createRequest();
        }
        catch (e)
        {
            _xmlhttp = false;
        }
    }

    return _xmlhttp;
}

function DisplayPrintReady(url)
{
    Open_Win(url, '', 'width=1000, height=700, status=0, scrollbars=yes, titlebar=0, resizable=1');
}

function GetBrowserHeight()
{
    var viewportheight;

    // the more standards compliant browsers (mozilla/netscape/opera/IE7) use window.innerWidth and window.innerHeight    
    if (typeof window.innerWidth != 'undefined')
    {
        viewportheight = window.innerHeight;
    }
    // IE6 in standards compliant mode (i.e. with a valid doctype as the first line in the document)
    else if (typeof document.documentElement != 'undefined'
        && typeof document.documentElement.clientWidth !=
        'undefined' && document.documentElement.clientWidth != 0)
    {
        viewportheight = document.documentElement.clientHeight;
    }
    // older versions of IE                
    else
    {
        viewportheight = document.getElementsByTagName('body')[0].clientHeight;
    }

    return viewportheight;
}

function GetBrowserWidth()
{
    var viewportwidth;

    // the more standards compliant browsers (mozilla/netscape/opera/IE7) use window.innerWidth and window.innerHeight    
    if (typeof window.innerWidth != 'undefined')
    {
        viewportwidth = window.innerWidth;
    }
    // IE6 in standards compliant mode (i.e. with a valid doctype as the first line in the document)
    else if (typeof document.documentElement != 'undefined'
        && typeof document.documentElement.clientWidth !=
        'undefined' && document.documentElement.clientWidth != 0)
    {
        viewportwidth = document.documentElement.clientWidth;
    }
    // older versions of IE                
    else
    {
        viewportwidth = document.getElementsByTagName('body')[0].clientWidth;
    }

    return viewportwidth;
}

function replaceAll(oldStr, findStr, repStr)
{
    try
    {
        var srchNdx = 0;
        var newStr = "";
        while (oldStr.indexOf(findStr, srchNdx) != -1)
        {
            newStr += oldStr.substring(srchNdx, oldStr.indexOf(findStr, srchNdx));
            newStr += repStr;
            srchNdx = (oldStr.indexOf(findStr, srchNdx) + findStr.length);
        }
        newStr += oldStr.substring(srchNdx, oldStr.length);
        return newStr;
    }
    catch (ex)
    {
        return oldStr;
    }
}

function back()
{
    window.history.back();
}

function go(url)
{
    document.location.href = url;
}

function hide(ctrl)
{
    try
    {
        ctrl.style.display = 'none';
    }
    catch (ex) { }
}

function SubmitForm()
{
    var theform;
    if (window.navigator.appName.toLowerCase().indexOf("microsoft") > -1)
    {
        theform = document.aspnetForm;
    }
    else
    {
        theform = document.forms["aspnetForm"];
    }
    theform.submit();
}

function is_IE()
{
    if (navigator.appName == "Microsoft Internet Explorer")
        return true;
    else
        return false;
}

function OpenURL(theURL, winName, features)
{
    Open_Telerik_Window(theURL);
}

function GetRadWindow()
{
    var oWindow = null;
    if (window.radWindow)
    {
        oWindow = window.radWindow;

    }
    else if (window.frameElement.radWindow)
    { oWindow = window.frameElement.radWindow; }

    return oWindow;
}

function Close_Window()
{
    //window.parent.document.body.className = 'allowscroll';

    try { window.close(); }
    catch (ex) { }
    try
    {
        //Close the RadWindow
        var oWnd = GetRadWindow();
        oWnd.close();
    }
    catch (ex) { }

}

function Close_Telerik_Window_If_Login_Required()
{

    var oWnd = null;

    try
    {
        oWnd = GetRadWindow();
    }
    catch (ex) { }

    if (oWnd)
    {
        window.parent.document.location.reload(true);
        Close_Window();
    }
}

function querySt(url, ji)
{
    hu = url.substring(1);
    gy = hu.split("&");
    for (i = 0; i < gy.length; i++)
    {
        ft = gy[i].split("=");
        if (ft[0] == ji)
        {
            return ft[1];
        }
    }
}

function Open_Resizable_Telerik_Window(url)
{
    var oManager = GetRadWindowManager();
    var wnd;
    try
    {
        wnd = oManager.open(url, "DialogWindow");
    }
    catch (e)
    {
        wnd = oManager.getWindowByName("DialogWindow");
    }
    var width = parseInt(querySt(url.toLowerCase(), "width"));
    var height = parseInt(querySt(url.toLowerCase(), "height")) + 40;
    wnd.set_behaviors(Telerik.Web.UI.WindowBehaviors.Close + Telerik.Web.UI.WindowBehaviors.Move + Telerik.Web.UI.WindowBehaviors.Resize + Telerik.Web.UI.WindowBehaviors.Maximize);
    wnd.set_modal(true);
    wnd.setSize(width, height);
    wnd.center();

    Resize_Telerik_Overlay_Div(null, false);
}

function Resize_Telerik_Overlay_Div(wnd, pAddCloseWindowCode)
{
    var divs = document.getElementsByTagName("div");
    for (var i = divs.length; i > 0; )
    {
        var div = divs[--i];
        if (div.className == "TelerikModalOverlay")
        {
            if (pAddCloseWindowCode)
                div.onclick = function() { wnd.close(); }
            div.style.width = (parseInt(div.style.width.replace("px", ""))) + "px";
            div.style.height = (parseInt(div.style.height.replace("px", ""))) + "px";
            break;
        }
    }
}

function OpenCBKURL()
{
    wnd2 = window.open('http://www.cbksoft.com', '', '');
    wnd2.focus();
}

function Open_Win(url, winName, features)
{
    var wnd3 = window.open(url, '', features);
    wnd3.focus();
}

function getParent(ctrl)
{
    var ret;
    try
    {
        if (is_IE())
            ret = ctrl.parentElement;
        else
            ret = ctrl.parentNode;
    }
    catch (ex)
    {
        ret = null;
    }
    return ret;
}

var arrRadTabMultipageID_To_RadTabStripObject = new Array();
function getTabStrips_MultipageIDs()
{
    var components = Sys.Application.getComponents();
    var ix = 0;
    for (var i = 0; i < components.length; i++)
    {
        var type = Object.getType(components[i]).getName();
        if (type == "Telerik.Web.UI.RadTabStrip")
        {
            var obj = new Object();
            obj.MultiPageID = components[i].get_multiPageID();
            obj.TabStrip = components[i];
            arrRadTabMultipageID_To_RadTabStripObject[ix] = obj;
            ix++;
        }
    }
    Sys.Application.remove_load(getTabStrips_MultipageIDs);
}

function show(ctrl)
{
    if (ctrl.get_id())
        ctrl = cbkgetElementById(ctrl.get_id());

    var ctrlparent;
    ctrl.style.display = "";
    ctrlparent = getParent(ctrl);
    var ctrlTelerik;
    var pageviewid = "";
    while (ctrlparent)
    {
        if (ctrlparent.id != "")
        {
            try
            {
                ctrlTelerik = $find(ctrlparent.id);
            }
            catch (ex)
            {
                ctrlTelerik = null;
            }
            if (ctrlparent.id.indexOf("RadPageView") > 0)
                pageviewid = ctrlparent.id; //containing radpageviewid

            if (ctrlTelerik)
            {
                if (ctrlTelerik.get_selectedPageView) //if this is a radmultipage control
                {
                    var i;
                    for (i = 0; i < ctrlTelerik.get_pageViews().get_count(); i++)
                    {
                        if (ctrlTelerik.get_pageViews().getPageView(i).get_id() == pageviewid);
                        {
                            ctrlTelerik.get_pageViews().getPageView(i).set_selected(true);

                            for (var j = 0; j < arrRadTabMultipageID_To_RadTabStripObject.length; j++)
                            {
                                if (arrRadTabMultipageID_To_RadTabStripObject[j])
                                {
                                    if (arrRadTabMultipageID_To_RadTabStripObject[j].MultiPageID == ctrlTelerik.get_id())
                                        arrRadTabMultipageID_To_RadTabStripObject[j].TabStrip.get_tabs().getTab(i).select();
                                }
                            }
                            break;
                        }
                    }
                }
            }
        }
        ctrlparent = getParent(ctrlparent);
    }
}

function toggleShow(ctrl)
{
    if (ctrl.style.display == '')
        ctrl.style.display = 'none';
    else
        ctrl.style.display = '';
}

function setFocus(ctrlid)
{
    var ctrl;
    ctrl = cbkgetElementById(ctrlid);
    if (ctrl)
    {
        show(ctrl);
        ctrl.focus();
    }
}

function htmlEncode(s)
{
    var str = new String(s);
    str = str.replace(/&/g, "&amp;");
    str = str.replace(/</g, "&lt;");
    str = str.replace(/>/g, "&gt;");
    str = str.replace(/javascript:/g, "{JS}");
    return str;
}

function EncodeData(myctrl)
{
    myctrl.value = htmlEncode(myctrl.value);
}

//COOKIE functions by battal 10/04/2006
function createCookie(name, value, days)
{
    try
    {
        var expires = new Date();
        expires.setTime(expires.getTime() + (days * 24 * 60 * 60 * 1000));
        var secure = true;
        document.cookie = name + "=" + (value) +
		((expires == null) ? "" : ("; expires=" + expires.toGMTString()));
    }
    catch (ex) { }
}

function readCookie(name)
{
    var nameEQ = name + "=";
    var ca = document.cookie.split(';');
    for (var i = 0; i < ca.length; i++)
    {
        var c = ca[i];
        while (c.charAt(0) == ' ') c = c.substring(1, c.length);
        if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length, c.length);
    }
    return null;
}

function removeCookie(name)
{
    createCookie(name, "", -1);
}
//------------------------------------

function findPosX(obj)
{
    var curleft = 0;
    if (obj.offsetParent)
    {
        while (obj.offsetParent)
        {
            curleft += obj.offsetLeft;
            obj = obj.offsetParent;
        }
    }
    else if (obj.x)
        curleft += obj.x;
    return curleft;
}

function findPosY(obj)
{
    var curtop = 0;
    if (obj.offsetParent)
    {
        while (obj.offsetParent)
        {
            curtop += obj.offsetTop;
            obj = obj.offsetParent;
        }
    }
    else if (obj.y)
        curtop += obj.y;
    return curtop;
}

//new page message functions and grid menu functions
var curr_grid_menu_div, curr_tr_name;

function _HL(id, isHighlighted) //highlight menu item
{
    if (isHighlighted)
        cbkgetElementById(id).style.background = '#f8700a';
    else
        cbkgetElementById(id).style.background = '#f1ffff';
}

function _go(url) //go
{
    window.location.href = url;
}

function _m_over(img_ctrl)
{
    img_ctrl.src = baseURL() + 'images/grid_menu_img_selected.gif';
}

function _m_out(img_ctrl)
{
    img_ctrl.src = baseURL() + 'images/grid_menu_img.gif';
}

function _conf(msg)
{
    if (confirm(msg))
        return true;
    else
        return false;
}

function containsDOM(container, containee)
{
    var isParent = false;
    do
    {
        if ((isParent = (container == containee)))
            break;
        containee = containee.parentNode;
    }
    while (containee != null);
    return isParent;
}

function _om(event, img_ctrl, menu_id, isVisible, grd_name) //open menu
{
    var x, y, container_ctrl, offset_x, offset_y, table_ctrl, div_height, shift_y;

    //find the id of the table row this menu is related to
    tr_name = grd_name + '_' + cbkgetElementById('HID_RC_' + menu_id).value;
    shift_y = 0;
    if (isVisible)
    {
        container_ctrl = cbkgetElementById(menu_id);
        x = findPosX(img_ctrl) - 5;
        y = findPosY(img_ctrl) - 20;
        if (curr_grid_menu_div)
            curr_grid_menu_div.style.display = 'none';

        container_ctrl.style.left = x + 'px';
        container_ctrl.style.top = y + 'px';
        container_ctrl.style.display = '';
        //container_ctrl.scrollIntoView(false);
        curr_grid_menu_div = container_ctrl;

        setTimeout("ClearPreviousSelection('" + menu_id + "', '" + tr_name + "', '" + cbkgetElementById(tr_name).className + "')", 500);
        curr_tr_name = tr_name;
        cbkgetElementById(tr_name).className = "GridMouseOverItemStyle"
    }
    else
    {
        var stillInPopup; //battal 25 Apr 2009
        if (img_ctrl.contains && event.toElement)
            stillInPopup = img_ctrl.contains(event.toElement);
        else if (event.relatedTarget)
            stillInPopup = containsDOM(img_ctrl, event.relatedTarget);

        if (stillInPopup)
            return;

        cbkgetElementById(menu_id).style.display = 'none';
        curr_grid_menu_div = null;

        if (Math.floor(parseInt(cbkgetElementById('HID_RC_' + menu_id).value, 10) / 2) * 2 == parseInt(cbkgetElementById('HID_RC_' + menu_id).value, 10))
            cbkgetElementById(tr_name).className = "GridItemStyle";
        else
            cbkgetElementById(tr_name).className = "GridAlternateItemStyle";
    }
}

function ClearPreviousSelection(menu_id, tr_name, tr_org_class)
{
    if (cbkgetElementById(menu_id) == null)
        return;

    if (curr_tr_name != tr_name)
    {
        cbkgetElementById(tr_name).className = tr_org_class;
        cbkgetElementById(menu_id).style.display = 'none';
    }

    //if this one is not hidden yet, try again later!
    if (cbkgetElementById(menu_id).style.display != 'none')
        window.setTimeout("ClearPreviousSelection('" + menu_id + "', '" + tr_name + "', '" + tr_org_class + "')", 1000);
}

function f_clientWidth()
{
    return f_filterResults(
		        window.innerWidth ? window.innerWidth : 0,
		        document.documentElement ? document.documentElement.clientWidth : 0,
		        document.body ? document.body.clientWidth : 0
	        );
}
function f_clientHeight()
{
    return f_filterResults(
		        window.innerHeight ? window.innerHeight : 0,
		        document.documentElement ? document.documentElement.clientHeight : 0,
		        document.body ? document.body.clientHeight : 0
	        );
}
function f_scrollLeft()
{
    return f_filterResults(
		        window.pageXOffset ? window.pageXOffset : 0,
		        document.documentElement ? document.documentElement.scrollLeft : 0,
		        document.body ? document.body.scrollLeft : 0
	        );
}
function f_scrollTop()
{
    return f_filterResults(
		        window.pageYOffset ? window.pageYOffset : 0,
		        document.documentElement ? document.documentElement.scrollTop : 0,
		        document.body ? document.body.scrollTop : 0
	        );
}
function f_filterResults(n_win, n_docel, n_body)
{
    var n_result = n_win ? n_win : 0;
    if (n_docel && (!n_result || (n_result > n_docel)))
        n_result = n_docel;
    return n_body && (!n_result || (n_result > n_body)) ? n_body : n_result;
}

var wndMessage = null;
function ShowPageMessage(msg, isError, fnCallBack)
{
    var title;
    if (isError)
    {
        msg = "<span class='message' style='color:#ff0000;'>" + msg + "</span><br><br>";
        try
        {
            title = get_RSC_HATALI_GIRIS();
        }
        catch (ex)
        {
            title = "Hata"
        }
    }
    else
    {
        msg = "<span class='message' style='color:#006400;'>" + msg + "</span><br><br>";
        try
        {
            title = get_RSC_MESAJ();
        }
        catch (ex)
        {
            title = "Message"
        }
    }

    try
    {
        wndMessage = radalert(msg, 400);
        wndMessage.SetTitle(title);
        if (fnCallBack)
            wndMessage.add_close(fnCallBack);
        Resize_Telerik_Overlay_Div(wndMessage, true);
    }
    catch (ex)
    {
        function cbk_msg()
        {
            wndMessage = radalert(msg, 400);
            wndMessage.SetTitle(title);
            Resize_Telerik_Overlay_Div(wndMessage, true);
            if (fnCallBack)
                wndMessage.add_close(fnCallBack);
            Sys.Application.remove_load(cbk_msg);
        }
        Sys.Application.add_load(cbk_msg);
    }
    return;
}

function HidePageMessage()
{
}
//end of new page message functions and grid menu functions

//START document management functions
function AskPassword()
{
    var res = showDialog(get_RSC_BU_DOKUMAN_SIFRE_ILE_KORUNMAKTADIR_LUTFEN_SIFRENIZI_GIRINIZ(), 'CONFIRM', get_RSC_TAMAM(), get_RSC_IPTAL(), '', get_RSC_SIFRENIZI_GIRINIZ() + ' : ', 1, true);

    if (res == 1)
    {
        cbkgetElementById('hidPassword').value = modal_dlg_text;
        return true;
    }
    else if (res == 2)
    {
        return false;
    }

    return false;
}

function processDocumentClick(typ, docID, prm)
{
    try
    {
        cbkgetElementById('hidDocumentID').value = docID;
        if (typ == "INFO")
        {
            window.location.href = prm;
        }
        else
        {
            if ((prm == "True") || (prm == "true"))
            {
                if (!AskPassword())
                    return;
            }

            if (typ == "VIEW")
            {
                __doPostBack('ctl00$cp$btnView', '');
            }
            else if (typ == "CHECKOUT")
            {
                __doPostBack('ctl00$cp$btnCheckout', '');
            }
            else if (typ == "UNDOCHECKOUT")
            {
                __doPostBack('ctl00$cp$btnUndoCheckout', '');
            }
            else if (typ == "DELETE")
            {
                __doPostBack('ctl00$cp$btnDeleteDoc', '');
            }
        }
    }
    catch (ex)
    {
        alert("processDocumentClick");
    }
}

function DisplayDIV(div_ctrl, width, height, top, left, hdn_holding_height, item1_to_hide, item2_to_hide)
{
    try
    {
        if (!img_clicked)
        {
            if (hdn_holding_height != null)
            {
                if (cbkgetElementById(hdn_holding_height))
                    div_ctrl.style.height = cbkgetElementById(hdn_holding_height).value + "px";
            }

            if (width != null)
                div_ctrl.style.width = width + "px";
            if (height != null)
                div_ctrl.style.height = height + "px";
            if (top != null)
                div_ctrl.style.top = top + "px";
            if (left != null)
                div_ctrl.style.left = left + "px";

            div_ctrl.style.display = '';
            if (item1_to_hide != null)
            {
                if (cbkgetElementById(item1_to_hide))
                {
                    cbkgetElementById(item1_to_hide).style.display = 'none';
                }
            }
            if (item2_to_hide != null)
            {
                if (cbkgetElementById(item2_to_hide))
                {
                    cbkgetElementById(item2_to_hide).style.display = 'none';
                }
            }
            div_ctrl.style.zIndex = 999;
            //alert();
        }
        else
        {
            img_clicked = false;
        }
    }
    catch (ex)
    {
        alert("DisplayDIV");
    }
}

function fromCharCode(i)
{

    var h = i.toString(16);
    if (h.length == 1)
        h = "0" + h;
    h = "%" + h;
    return unescape(h);

}


function Show_Preview(doc_id)
{
    if (doc_id == null)
        return;

    if (doc_id <= 0)
        return;

    var wnd = Open_Resizable_Telerik_Window(baseURL() + "GetFile.aspx?Type=6&ID=" + doc_id + "&width=650&height=500");
}

function Print_Barcode(barcode_text, barcode_prefix)
{
    //var wnd = Open_Telerik_Window(baseURL() + "ManagementModule/GEN_Print_Barcode.aspx?ID=" + barcode_text + "&PRE=" + barcode_prefix + "&width=340&height=120"); 
    //document.frames['ctl00_ifrmPrint'].location.href = baseURL() + "ManagementModule/GEN_Print_Barcode.aspx?ID=" + barcode_text + "&PRE=" + barcode_prefix + "&width=340&height=120";
    window.open(baseURL() + "ManagementModule/GEN_Print_Barcode.aspx?ID=" + barcode_text + "&PRE=" + barcode_prefix, 'popup', 'width=340, height=120, scrollbars=no, titlebar=0');
}

function Mouse_Over_Editable_Effect(ctrl)
{
    ctrl.style.cursor = 'pointer';
    ctrl.style.color = 'maroon';
    //ctrl.style.filter = "progid:DXImageTransform.Microsoft.BasicImage(invert=1);";
    ctrl.style.filter = "progid:DXImageTransform.Microsoft.BasicImage(grayscale=1, opacity=0.5);";
}

function Mouse_Out_Editable_Effect(ctrl)
{
    ctrl.style.color = '';
    ctrl.style.filter = "";
}

function Cancel_Bubble_Effect()
{
    window.event.cancelBubble = true;
}

function Select_All_Text(ctrlid)
{
    var ctrl;
    ctrl = document.getElementById(ctrlid);
    if (ctrl)
    {
        ctrl.select();
    }
}

function OpenURL(theURL, winName)
{
    if (winName == null)
        winName = '';
    if (is_IE())
        wnd = window.open(theURL, winName, 'status=no,toolbar=yes,menubar=no,location=no');
    else
    {
        if (theURL.indexOf("http") < 0)
        {
            base = location.href.substring(0, location.href.lastIndexOf('\/'));
            wnd = window.open(base + "/" + theURL, winName, features);
        }
        else
            wnd = window.open(theURL, winName, features);
    }

    if (wnd != null)
    {
        try { wnd.focus(); } catch (ex) { }
    }
    else
        alert('Window cannot be opened. Possibly, popup blocker of your browser is the cause of this problem.\nPlease allow popups for this site to see the requested page.');
}
function OpenURL_UtkuEdition(theURL, winName, features)
{
    if (winName == null)
        winName = '';
    if (is_IE())
        wnd = window.open(theURL, winName, features, 0);

    else
    {
        if (theURL.indexOf("http") < 0)
        {
            base = location.href.substring(0, location.href.lastIndexOf('\/'));
            wnd = window.open(base + "/" + theURL, winName, features);
        }
        else
            wnd = window.open(theURL, winName, features);
    }

    if (wnd != null)
    {
        try { wnd.focus(); } catch (ex) { }
    }
    else
        alert('Window cannot be opened. Possibly, popup blocker of your browser is the cause of this problem.\nPlease allow popups for this site to see the requested page.');
}

function Open_Telerik_Window(url)
{
    var oManager = GetRadWindowManager();
    var wnd;
    try
    {
        wnd = oManager.open(url, "DialogWindow");
    }
    catch (e)
    {
        wnd = oManager.getWindowByName("DialogWindow");
    }
    var width;
    try
    {
        width = parseInt(querySt(url.toLowerCase(), "width"));
        if (width > 0 == false)
            width = 950;
    }
    catch (e)
    {
        width = 1050;
    }
    var height;
    try
    {
        height = parseInt(querySt(url.toLowerCase(), "height")) + 40;
        if (height > 40 == false)
        {
            height = 590;
        }
    }
    catch (e)
    {
        height = 590;
    }
    wnd.set_behaviors(Telerik.Web.UI.WindowBehaviors.Close);
    wnd.set_modal(true);
    wnd.setSize(width, height);
    wnd.center();

    Resize_Telerik_Overlay_Div(null, false);

    //window.document.body.className = 'noscroll';
}


function Override_DoPostBack()
{
    var orig_doPostBack = __doPostBack;
    function pd_PostBack(Param1, Param2)
    {
        var theform;
        if (window.navigator.appName.toLowerCase().indexOf('netscape') > -1)
        {
            theform = document.forms['aspnetForm'];
        }
        else
        {
            theform = document.aspnetForm;
        }
        if (document.all)
        {
            window.external.AutoCompleteSaveForm(theform);
        }

        __doPostBack = orig_doPostBack;
        __doPostBack(Param1, Param2);
    }
    __doPostBack = pd_PostBack;
}

//END document management functions