
// Popup window routines

// is browser sufficiently advanced for true W3C DOM scripting ?
var W3CDOM;

if (document.getElementById && document.createElement && document.childNodes)
	W3CDOM = true;
else
	W3CDOM = false;


var popUpWin=0;
var screenW, screenH;
var popX=150, popY=100, popW=575, popH=660;


	if (W3CDOM)
	{
		screenW = screen.width;
		screenH = screen.height;
		popX = (screenW / 2) - (popW / 2);
		popY = (screenH / 2) - (popH / 2) - 25;
	}


var intRotationNum=1, intNumImages=0;

var strImagesPath = "images/products/";

var strImageProdName = "";


function OpenProdPopWin(URLStr)
{
	OpenPopWin(URLStr,popX,popY,popW,popH)
}


function OpenPopWin(URLStr, left, top, width, height)
{
	if(popUpWin)
	{
		if(!popUpWin.closed) popUpWin.close();
	}
	popUpWin = open(URLStr, 'popUpWin', 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbar=yes,resizable=no,copyhistory=yes,width='+width+',height='+height+',left='+left+', top='+top+',screenX='+left+',screenY='+top+'');
}


function CloseWin()
{
	window.close();
}


function RotateImage(intImageNum, strDir)
{
	if(W3CDOM)
	{
		if (strDir == "left")
		{
		intRotationNum--;
		if (intRotationNum < 1) intRotationNum = intNumImages;
		}

		if (strDir == "right")
		{
		intRotationNum++;
		if (intRotationNum > intNumImages) intRotationNum = 1;
		}

		strNewImageSrc = strImagesPath + strImageProdName + intRotationNum + ".jpg";

		document.getElementById( "ProductCloserImage" ).src = strNewImageSrc;
	}
}
