﻿function showPopupMenu(layerId, parentMenu, offsetX, offsetY)
{
	var parentMenuObj = document.getElementById(parentMenu);
	var popupObj = document.getElementById(layerId);
    var offsetX =10;
    var offsetY =22;
	popupObj.style.left = getAbsX(parentMenuObj) + offsetX;
	popupObj.style.top = getAbsY(parentMenuObj) + offsetY;
	popupObj.style.visibility = "visible";
	popupObj.style.display = "inline";
}

function hidePopupMenu(layerId)
{
	var popupObj = document.getElementById(layerId);

	popupObj.style.visibility = "hidden";
}

function getAbsX(obj) //gets absolute X coordinate of an object
{
	var leftOffset = 0;
	
	if (obj.offsetParent)
	{
		while (obj.offsetParent)
		{
			leftOffset += obj.offsetLeft;
			obj = obj.offsetParent;
		}
	}
	else if (obj.x) //for Netscape v.4
	{
		leftOffset = obj.x;
	}
	return leftOffset;
}
          
function getAbsY(obj) //gets absolute Y coordinate of an object
{
	var topOffset = 0;
	
	if (obj.offsetParent)
	{
		while (obj.offsetParent)
		{
			topOffset += obj.offsetTop;
			obj = obj.offsetParent;
		}
	}
	else if (obj.y) //for Netscape v.4
	{
		topOffset = obj.y;
	}
	return topOffset;
}

function stopMarquee()
{
	document.getElementById("products").stop();
}
function startMarquee()
{
	document.getElementById("products").start();
}
function showPicture(picturename)
{
    var strContent = "";
    strContent = "<table border='0' cellpadding='0' cellspacing='0' style='width:300px;height:200px;border:solid 5px #949494;'>" +
                "<tr><td align='right' style='height:15px;padding-right:3px;background-color:#5b5b5b'>" +
                "<img src='App_Themes/Default/Products/ct-iconclose.gif' bober='0' alt='' onclick='hidePicture();'/>" +
                "</td></tr>" + 
                "<tr>" +
                "<td><img src='App_Themes/Default/Products/" + picturename + "'/></td>" +
                "</tr>" +
                "</table>";
    if(window.navigator.appName == 'Microsoft Internet Explorer')
    {
        document.getElementById("divPicture").style.left = 167;
        document.getElementById("divPicture").style.top = 320;//document.body.scrollTop;
    }
    else
    {
        document.getElementById("divPicture").style.left = 167;
        document.getElementById("divPicture").style.top = 319;//document.body.scrollTop;;
    }
    document.getElementById("divPicture").innerHTML= strContent;
    document.getElementById("divPicture").style.diplay= 'inline';
}
function hidePicture()
{
    document.getElementById("divPicture").innerHTML= "";
    document.getElementById("divPicture").style.diplay= 'none';
}