﻿function coverWindow ()
{
	var cover = document.createElement("div");
	
	cover.id = "background";
	cover.style.pixelWidth	= document.body.scrollWidth;
	cover.style.pixelHeight	= document.body.scrollHeight;
	
	cover.style.top		= 0;
	cover.style.left	= 0;

	cover.style.filter			= "alpha(style=0,opacity=50);";
	cover.style.backgroundColor	= "#fff";
	cover.style.position		= "absolute";
    cover.style.zIndex	= 2;
	document.body.appendChild(cover);
	
}

function unCoverWindow ()
{
	var cover = document.getElementById("background");
	if (cover != null)
	cover.id = "background";
	cover.style.display = 'none';
}


function showBusyMessage(message)
{
	if (message == "") message = "Loading...";
	
	try
	{
		coverWindow();
		
		var loading = document.createElement("div");
		loading.id = "loading";
		
		
		loading.innerHTML = "<table id=\"innerTable\"cellpadding=\"7\" cellspacing=\"0\">" +
							"	<tr>" +
							"		<td style=\"font-size: 12px; color: #000000;\">" + message + "</td>" +
							"	</tr>" +
							"</table>";
							
        var width	= 250;
		var height	= 31;
		
		loading.style.left		= document.body.scrollLeft + ((document.body.clientWidth - width) / 2);
		loading.style.top		= document.body.scrollTop + ((document.body.clientHeight - height) / 2);
		
		loading.style.filter	= "alpha(style=0,opacity=50);";
		loading.style.position	= "absolute";
		loading.style.display	= "";
		loading.style.zIndex	= 999;
		
		document.body.appendChild(loading);
	}
	catch (ex)
	{
		// Do nothing, as we don't want javascript errors -- just don't render the "Loading..." section.
	}
	
	return true;
}

function hideBusyMessage()
{
	try
	{
		unCoverWindow();
		
		var loading = document.getElementById("loading");
		
		loading.style.display	= "none";
	}
	catch (ex)
	{
		// Do nothing, as we don't want javascript errors -- just don't render the "Loading..." section.
	}
}


function ShowProductImage(imagePath, imgID)
{

    window.open(imagePath,"newWindow");

/*
     var img = document.getElementById(imgID);
     if(img != null)
     {
        img.src = imagePath ;
     }
  */   
     return false;
}


function popupWindow(url) {
  window.open(url,'newWindow', 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,copyhistory=no, width=610, height=240,screenX=150,screenY=150,top=150,left=150');
}

