function showContentEditor(radWindow, args) {
    var arg = args.Command.get_name().split("$");
    var oManager = GetRadWindowManager();
    if (oManager != null) {
        var oWnd = oManager.getWindowByName("winEditor");
        if (oWnd != null) {
            oWnd.setUrl("/Admin/ContentEditor.aspx?partid=" + arg[1] + "&purl=" + arg[3] + "&md=1&stb=0");
            oWnd.show(); 
        }
    }
    else alert("RadWindowManager is not available on the page. Please update your template.");
}
function closeContentEditor(radWindow, returnValue) {
    if (returnValue == "showPreview") showPreviewFromEditor();
    else if (returnValue) window.location.href = window.location.href; 
}
function maximizeEditor(radWindow, args) {
    var oManager = GetRadWindowManager();    
    if (oManager != null) {
        var oWnd = oManager.getWindowByName("winEditor");        
        if (oWnd != null) oWnd.maximize();
    }
}
function showPage(url) {
    var oManager = GetRadWindowManager();    
    if (oManager != null) {
        var oWnd = oManager.getWindowByName("winPage");        
        if (oWnd != null) {        
            oWnd.setUrl(url);
            oWnd.show(); 
        }
    }
    else alert("RadWindowManager is not available on the page. Please update your template.");
}
function redirectPage(radWindow, returnValue) {
    if (returnValue) window.location.href = returnValue;
}
function toolbarMoved(dock) 
{
    createCookie("toolbarTop", dock.get_top(), 1);
    createCookie("toolbarLeft", dock.get_left(), 1);
}
function toolbarInit(dock, args)
{
    // freaking set_top and set_left don't work!!!
    if (readCookie("toolbarTop")) dock.get_element().style.top = readCookie("toolbarTop");
    if (readCookie("toolbarLeft")) dock.get_element().style.left = readCookie("toolbarLeft");
}