//------------------------------------------------------------------------------
//
//	This group of functions are called by the dialogs
//
//------------------------------------------------------------------------------
function DLG_CloseDialog(retVal)
{
	var w = DLG_GetDialogHostWindow();
	if (w == null)
	{
		alert ("Cant find DialogHostWindow");
		return;
	}
	w.window.DLG_CloseDialog_Impl(retVal);
} // DLG_CloseDialog
//------------------------------------------------------------------------------
function DLG_GetDialogHostWindow()
{
	// walk up the window tree to find the containing window
	// that offers the DLG_ShowDialog_Impl function
	
	var w = window;
	while (w && w.parent && w.parent.window)
	{
		if (w.parent.window.DLG_ShowDialog_Impl)
			return w.parent;
		if (w == w.parent)
			return null;
		w = w.parent;
	}
	return null;
} // DLG_GetDialogHostWindow
//------------------------------------------------------------------------------
function DLG_ResizeDialog(wid, hgt)
{
	var w = DLG_GetDialogHostWindow();
	if (w == null)
	{
		alert ("Cant find DialogHostWindow");
		return;
	}
	w.window.DLG_ResizeDialog_Impl(wid,hgt);
} // DLG_ResizeDialog
//------------------------------------------------------------------------------
function DLG_SetCaption(caption)
{
	var w = DLG_GetDialogHostWindow();
	if (w == null)
	{
		alert ("Cant find DialogHostWindow");
		return;
	}
	w.window.DLG_SetCaption_Impl(caption);
} // DLG_SetCaption
//------------------------------------------------------------------------------

//------------------------------------------------------------------------------
//
//	This group of functions are called by the callers of the dialogs
//
//------------------------------------------------------------------------------
function DLG_ShowDialog(url, OnCloseFn)
{
	var w = DLG_GetDialogHostWindow();
	if (w == null)
	{
		alert ("Cant find DialogHostWindow");
		return null;
	}
	return w.window.DLG_ShowDialog_Impl(url, OnCloseFn, false, '');
} // function DLG_ShowDialog
//------------------------------------------------------------------------------
function DLG_ShowDialog2(url, OnCloseFn, bOpaque)
{
	var w = DLG_GetDialogHostWindow();
	if (w == null)
	{
		alert ("Cant find DialogHostWindow");
		return null;
	}
	return w.window.DLG_ShowDialog_Impl(url, OnCloseFn, bOpaque, '');
} // function DLG_ShowDialog2
//------------------------------------------------------------------------------
function DLG_ShowDialog3(url, OnCloseFn, bOpaque, DoOnExitFn)
{
	var w = DLG_GetDialogHostWindow();
	if (w == null)
	{
		alert ("Cant find DialogHostWindow");
		return null;
	}
	return w.window.DLG_ShowDialog_Impl(url, OnCloseFn, bOpaque, DoOnExitFn);
} // function DLG_ShowDialog3
//------------------------------------------------------------------------------
function DLG_onmousedownInCaption()
{
	var w = DLG_GetDialogHostWindow();
	if (w == null)
	{
		alert ("Cant find DialogHostWindow");
		return;
	}
	w.window.DLG_onmousedownInCaption_Impl();

} // DLG_onmousedownInCaption
//------------------------------------------------------------------------------

