﻿// Generic AJAX ResponseEnd handler
function ResponseEnd() {
	//hide the loading panel and clean up the global variables
	var currentLoadingPanel = $find(currentLoadingPanelClientID);
	if (currentLoadingPanel != null) { currentLoadingPanel.hide(currentUpdatedControl); }
	currentUpdatedControl = null;
	currentLoadingPanel = null;
}
function showLoadingPanel(sender, args) { toggleLoadingPanel(sender.get_id(), true); }
function hideLoadingPanel(sender, args) { toggleLoadingPanel(sender.get_id(), false); }
function toggleLoadingPanel(elementId, show) {
	var loadingPanel = $find(currentLoadingPanelClientID);
	if (show) {loadingPanel.show(elementId);} else {loadingPanel.hide(elementId);}
	}
var splashWindowName;
function ToggleSplash(windowName, windowUrl, windowTitle) {
	if (!windowName) { windowName = splashWindowName; }
	var oManager = GetRadWindowManager();
	var oWnd = oManager.getWindowByName(windowName);
	if (oWnd.isClosed()) {
		splashWindowName = windowName;
		oWnd.setUrl(windowUrl);
		oWnd.set_title(windowTitle);
		oWnd.show();
		document.onclick = ToggleSplash;
	}
	else {
		oWnd.close();
		document.onclick = null;
	}
}		
