var imageLoading = new Image();
imageLoading.src = rootDir + "images/loading/pik.gif";

var imageLoadingElem = undefined;

// -----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

function centerLoadingImage()
{
	getViewportSize();

	if (navigator.appName != 'Microsoft Internet Explorer')
	{
		if (imageLoadingElem)
		{
//			imageLoadingElem.style.position = 'fixed';
			imageLoadingElem.style.top = 0.5 * (viewportHeight - imageLoadingElem.offsetHeight);			
		}
	}

	imageLoadingElem.style.left = 0.5 * (viewportWidth - imageLoadingElem.offsetWidth);
}

// -----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

function buildLoading()
{
	imageLoadingElem = dce('img');

	imageLoadingElem.id = 'image-loading';
	imageLoadingElem.src = imageLoading.src;

	centerLoadingImage();

	document.body.appendChild(imageLoadingElem);
}

// -----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

function showLoading()
{
	centerLoadingImage();

	imageLoadingElem.style.visibility = 'visible';
}

// -----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

function hideLoading()
{
	imageLoadingElem.style.visibility = 'hidden';
}

// -----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

