function PopWin(url,name,options) {
	var ContextWindow = window.open(url,name,options);
	ContextWindow.opener = this;
	ContextWindow.focus();
}
/* 	for example:
	var ContextWindow = window.open(url,name,'width=800,height=320,resizable=no,scrollbars=no,toolbar=no,status=no'); */



function PopViewpic(url,width,height) {

	/* this is the default width (W) and height (H) of all viewpic popup windows */
	var W = 548;
	var H = 548;

	/* but if the width and/or height have been specified by the caller, use those */
	if(width)
		W = width;
	if(height)
		H = height;

	/* the rest of this is all just to make sure the window doesn't exceed people's screen space */
	var screenHeight = screen.height;
	var screenWidth = screen.width;
	var X = 0;
	var Y = 0;
	
	if (screenWidth < 800)
		W = screenWidth - 40;
	else if (screenWidth > 840)
		X = 40;

	if (screenHeight < 780)
		H = screenHeight - 60;

	/* finally call PopWin with the appropriate values */
	PopWin(url, 'viewpic-window',
		'width='+W+',height='+H+',resizable=yes,scrollbars=yes,toolbar=no,status=no,left='+X+',top='+Y+',screenX='+X+',screenY='+Y+'');

}


