function GetRadWindow()  
{  
    var oWindow = null;
      
    if (window.radWindow) oWindow = window.radWindow; //Will work in Moz in all cases, including clasic dialog  
    else if (window.frameElement.radWindow) oWindow = window.frameElement.radWindow;//IE (and Moz az well)  
          
    return oWindow;  
}

function OpenLoginWindow()
{    
    window.radopen("/Login.aspx" , "Login");
}

function OpenCreditsWindow()
{    
    window.radopen("/Credits.aspx" , "Credits");
}

function OpenPageEditorWindow(pageId)
{    
    window.radopen("/PageEditor.aspx?PageId="+pageId , "Popup");
}

function OpenContentAddWindow(contentPageId, contentGroupId, extendContentGroup)
{    
    window.radopen("/ContentEditor.aspx?PageId="+contentPageId+"&GroupId="+contentGroupId+"&extend="+extendContentGroup , "Popup");
}

function OpenContentEditorWindow(contentItemId)
{    
    window.radopen("/ContentEditor.aspx?ItemId="+contentItemId , "Popup");
}

function OpenContentDeleteWindow(contentItemId, contentPageId)
{    
    window.radopen("/ContentDelete.aspx?ItemId="+contentItemId+"&PageId="+contentPageId , "Popup");
}

function RefreshPage()
{
    window.location.href=unescape(window.location);
}

function CallFunctionOnParentPageAndCloseWindow(fnName)
{
	GetRadWindow().Close();
	
	var oWindow = GetRadWindow();
	
	if (oWindow.BrowserWindow[fnName] && typeof(oWindow.BrowserWindow[fnName]) == "function")
	{
		oWindow.BrowserWindow[fnName](oWindow);
	}	
}

function CloseWindow()
{
    GetRadWindow().Close();
}
