var pageHeight;
var pageWidth;
var mykid;

function showCurtain()
{
	pageHeight = (document.height !== undefined) ? document.height : document.body.offsetHeight;
	pageWidth = (document.width !== undefined) ? document.width : document.body.offsetWidth;

	if (document.body.clientHeight > pageHeight)
	{
		pageHeight = document.body.clientHeight;
	}
	pageHeight = document.getElementById('divMain').offsetHeight;
	if (window.innerHeight)
	{
		pageHeight = (window.innerHeight > pageHeight ? window.innerHeight : pageHeight);
	}

	var curtain_div = document.getElementById('divCurtain');
	curtain_div.style.height = (Math.ceil(pageHeight)) + "px";
	curtain_div.style.width = Math.ceil(pageWidth) + "px";
	curtain_div.style.display = "block";
}

function showPopup(name)
{
	var scrollOffset = document.all ? ((document.compatMode && document.compatMode != "BackCompat")? document.documentElement : document.body).scrollTop : pageYOffset;

	mykid = document.getElementById(name);
	
	mykid.style.position = "absolute";
	mykid.style.zIndex = "1000";
	mykid.style.display = "block";
	
	setTimeout(function() { 
			mykid.style.top = (200 + scrollOffset) + "px";
			mykid.style.left = (Math.ceil(pageWidth)/2 - parseInt(mykid.offsetWidth)/2) + "px";
		}, 250);
}


function hideCurtainID(productid)
{    
	document.getElementById('divCurtain').style.display = "none";
	if (mykid)
	{
		mykid.style.display = "none";
	}
}

function hideCurtain()
{
    document.getElementById('divCurtain').style.display = "none";
	if (mykid)
	{
		mykid.style.display = "none";
	}
	document.getElementById('divCartMsg').style.display = "none";
	document.getElementById('divAlreadyAddedMsg').style.display = "none";
}
function showUploadDiv(childDivName)
{
	showCurtain();
	showPopup(childDivName);
}