/*
 * Global variables
 */
var loading = false;
var admin = 0;
var serverURL = '';

/*
 * AJAX window functions.
 */
function grayOutWindow (_zIndex, _opacity)
{
	if(_zIndex=='') _zIndex = '15000';
	
	// gray out the background
	wndWidth = Window.getScrollWidth();
	wndHeight = Window.getScrollHeight();
	$('ajaxWindow').setStyles({
		position: 'absolute',
		left: 0, top: 0,
		width: wndWidth, height: wndHeight,
		backgroundColor: '#000000',
		opacity: _opacity,
		zIndex: _zIndex,
		visibility: 'visible'
	});
}

function openAjaxWindow (wnd, ajaxWndWidth, ajaxWndHeight)
{
	grayOutWindow('15000', 0.5);
	
	wndWidth = Window.getWidth();
	wndHeight = Window.getHeight();

	$(wnd).setStyles({
		left: (wndWidth-ajaxWndWidth)/2,
		top: ((wndHeight-ajaxWndHeight)/2)+Window.getScrollTop(),
		width: ajaxWndWidth,
		height: ajaxWndHeight,
		opacity: 1,
		visibility: 'visible',
		'z-index': 15001
	});
}

function closeAjaxWindow (wnd)
{
	$(wnd).setOpacity(0);
	$(wnd).setStyles({width: 0, height: 0 });
	$(wnd).setStyle('visibility', 'hidden');
	$(wnd).setStyle('border-width', '0px');

	$('ajaxWindow').setOpacity(0);
	$('ajaxWindow').setStyles({width: 0, height: 0});
}