function popupWindow(win,winWidth,winHeight,winName)
{
	leftPos = 0; topPos = 0;

	if (screen)
	{

		if (winWidth>screen.width)
		{
			winWidth = screen.width;
		}

		if (winHeight>screen.height)
		{
			winHeight = screen.height - 55;
		}

		if (winWidth <= 0)
		{
			winWidth = screen.width;
		}

		if (winHeight <= 0)
		{
			winHeight = screen.height - 55;
		}

		leftPos = screen.width/2 - winWidth/2;
		topPos = screen.height/2 - winHeight/2;
	}

	newWindow = window.open(win,winName,'toolbar=no,location=no,scrollbars=yes,resizable=yes,width='+winWidth+',height='+winHeight+',left='+leftPos+',top='+topPos+''); 

	newWindow.focus();
}

  
// Image opener					  
function popImg(img, w, h, t) {
	
	// Check for Mac
	if (navigator.userAgent.indexOf("Mac") != -1){
	// Reduce window measurements accordingly
	    w = w-0
		h = h-0
		}
	var s1 ="<html><head>"
	var s2 ="<title>"+t+"</title>"
	var s3 ="</head>"
	var s4 ="<body topmargin=0 bgcolor=\"#ffffff\" leftmargin=0 marginheight=0 marginwidth=0><center><img src='"+img+"' border=0>"
	var s5 ="</center></body>"
	var s6 ="</html>"
	
	var windowprops = ",top=50, left=50,location=no,scrollbars=no,menubars=no,toolbars=no,resizable=no" + ",width=" + w + ",height=" + h;
	
	if (img!='')
	{
		imgWin=window.open("","picWin",windowprops);
		imgWin.document.write(s1+s2+s3+s4+s5+s6)
		imgWin.document.close()
	}
	else
	{
		alert("No image to view.")
	}
}