﻿var szWebPageRoot = '';
var oConstantContactWindow = null;
var editorContent = null;
var IsDirty = false;

function OpenCustomWindow(id)
{
    var wnd = window.radopen("Popup.aspx?PageId=" + id, "wndPopup");
    wnd.moveTo(20,20); 
}
var oLoginWindow = null;
function OpenLoginWindowSpecial(RootURL)
{
    oLoginWindow=window.open(RootURL + 'Login.aspx', 'LoginWindow', 'height=400,width=280,toolbar=no,directories=no,status=no, menubar=no,scrollbars=no,resizable=no ,modal=no');
    if (window.focus) {oLoginWindow.focus()}
    return false;
}
//function OpenLoginWindowSpecial2(RootURL)
//{
//    oLoginWindow=window.open(RootURL + 'Login.aspx', 'LoginWindow', 'height=400,width=280,toolbar=no,directories=no,status=no, menubar=no,scrollbars=no,resizable=no ,modal=no');
//    if (window.focus) {oLoginWindow.focus()}
//}
function CloseLoginWindow()
{
    if(oLoginWindow != null)
        oLoginWindow.close();
}
function OpenConstantContactWindow(URI)
{
    oConstantContactWindow=window.open(URI,'ConstantContacts');
    if (window.focus) {oConstantContactWindow.focus()}
}
function RefreshPage()
{
    if(IsDirty)
        document.getElementById('ucMiniMenu_lnkRefreshPage').click();
    IsDirty = false;
}
function ForceRefreshPage()
{
    document.getElementById('ucMiniMenu_lnkRefreshPage').click();
    IsDirty = false;
}
function SetEditorContent(content){}
function SetDialogContent(oWnd){}

function SetRootURL(root)
{
    szWebPageRoot = root;
}
function LoadEditor(PageId, AllowRefresh)
{
    if(AllowRefresh==null) AllowRefresh = 'true';
    if(PageId==0)
        alert("Cannot edit this page.\n\nThis web page cannot be edited or no Page Id was supplied.\nPlease navigate to the desired page using the site menu.");
    else
        radopen(szWebPageRoot + "Editor.aspx?PageId=" + PageId + "&AllowRefresh=" + AllowRefresh, "wndEditor"); 
    return false;
}
function LoadSiteMap()
{
    radopen(szWebPageRoot + "SiteMap.aspx?AllowRefresh=true", "wndSiteMap"); 
    return false;
}
function LoadPageProperties(PageId, AllowRefresh)
{
    if(AllowRefresh==null) AllowRefresh = 'true';
    if(PageId==0)
        alert("Cannot edit this page.\n\nThis web page cannot be edited or no Page Id was supplied.\nPlease navigate to the desired page using the site menu.");
    else
        radopen(szWebPageRoot + "PageProperties.aspx?PageId=" + PageId + "&AllowRefresh=" + AllowRefresh, "wndPageProperties"); 
    return false;
}
var oTestWindow = null;
function OpenTestWindow(TestType, UnitId, UnitTestId, StudentId)
{
    oTestWindow=window.open(TestType + '.aspx?UnitTestId=' + UnitTestId + '&UnitId=' + UnitId + '&StudentId=' + StudentId, 'TestWindow');
    //if (window.focus) {oTestWindow.focus()}
    return false;
}