var newWindow = null;

function PopUp2(Url, Width, Height, bResizable, bScrollbars) 
{
  if (Width > (screen.width - 50)) {
   Width = screen.width - 50;
  }
  
  if (Height > (screen.height - 50)) {
   Height = screen.height - 50;
  }
  
  posLeft = (screen.width-Width)/2;
  posTop  = (screen.height-Height)/2;
  
  var Options = "";
  
  if (bResizable) {
    Options += ",resizable=1";
  } else {
    Options += ",resizable=0";
  }
  
  if (bScrollbars) {
    Options += ",scrollbars=1";
  } else {
    Options += ",scrollbars=0";
  }
  
  newWindow = window.open(Url,"newWindow","width="+Width+",height="+Height+",left="+posLeft+",top="+posTop+Options);
  if(newWindow != null) {
	  newWindow.focus();
  }
}

function PopUp(Url, Width, Height) 
{
  PopUp2(Url, Width, Height, false, false);
}

function PopUpImage(imageName, imageWidth, imageHeight) 
{
	if (imageWidth > (screen.width - 50)) {
	 imageWidth = screen.width - 50;
	}

	if (imageHeight > (screen.height - 50)) {
	 imageHeight = screen.height - 50;
	}

	posLeft = (screen.width-imageWidth)/2;
	posTop  = (screen.height-imageHeight)/2;
	
	newWindow = window.open("","newWindow","width="+imageWidth+",height="+imageHeight+",left="+posLeft+",top="+posTop);
	newWindow.document.open();
	newWindow.document.write('<html><title>'+imageName+'</title><body leftmargin="0" topmargin="0" marginheight="0" marginwidth="0" onBlur="self.close()">');
	newWindow.document.write('<img src="'+imageName+'" width="'+imageWidth+'" height="'+imageHeight+'" alt="'+imageName+'">'); 
	newWindow.document.write('</body></html>');
	newWindow.document.close();
	newWindow.focus();
}

