﻿function contextWindowOpen(url, recallElementName, recallIdentifier) {
    var _winName = 'GeneralContextWin';
    var _wnd = radwinOpenRecallWindow(_winName, url, recallElementName, recallIdentifier);
    return _wnd;
    }
    
function contextWindowClose() {
    var _wnd = radwinGetWindowByName('GeneralContextWin');
    _wnd.close();
    }

function contextWindowFormat(width, height, posX, posY, center) {
    var _wnd = radwinGetWindowByName('GeneralContextWin');
    if (width != null) _wnd.set_width(width);
    if (height != null) _wnd.set_height(height);

    if (center != null && center == true) _wnd.center();

    var _bounds = _wnd .getWindowBounds();
    var _posX = _bounds.x;
    var _posY = _bounds.y;

    if (posX != null) _posX = posX;
    if (posY != null) _posY = posY;

    _wnd.moveTo(_posX,_posY);

    return _wnd;
    }

function contextWindowOnCloseEvent(wnd) {
    // set defaults
    wnd.setUrl('/App_Themes/Default/Images/AjaxLoading.gif');
    wnd.set_modal(true);
    wnd.set_title('Loading ...');
    wnd.restore;
    wnd.center;
    wnd.set_width(300);
    wnd.set_height(100);
    wnd.set_behaviors(Telerik.Web.UI.WindowBehaviors.Move + Telerik.Web.UI.WindowBehaviors.Close);
    }
