if(screen != null) { 
	var xpos = screen.width; 
	var ypos = screen.height; 
}else{ 
	var xpos = 640; 
	var ypos = 480; 
}

function pics(pageToLoad, w, h, caption) {
	
	var winheight = parseInt(h) + 20;
	var scrollingwidth = w;
	var scrollingheight = winheight;
	var scrolling = 0;
	
	if(xpos > 800) {
		if(h > 700) { scrollingwidth = parseInt(w) + 20; scrollingheight = 700; scrolling = 1; }
		if(w > 1000) { scrollingheight = parseInt(winheight) + 20; scrollingwidth = 1000; scrolling = 1; }
		if((w > 1000) && (h > 700)) { scrollingheight = 700; scrollingwidth = 1000; scrolling = 1; }
	}else{
		if(h > 450) { scrollingwidth = parseInt(w) + 20; scrollingheight = 450; scrolling = 1; }
		if(w > 730) { scrollingheight = parseInt(winheight) + 20; scrollingwidth = 730; scrolling = 1; }
		if((w > 730) && (h > 450)) { scrollingheight = 450; scrollingwidth = 730; scrolling = 1; }
	}
	xposition = (xpos - scrollingwidth) / 2;
	yposition = (ypos - scrollingheight) / 2;
	args = "width=" + scrollingwidth + ","
		+ "height=" + scrollingheight + ","
		+ "location=0, menubar=0, resizable=1, scrollbars=" + scrolling + ","
		+ "status=0, titlebar=0, toolbar=0, hotkeys=0, "
		+ "screenx=" + xposition + ","
		+ "screeny=" + yposition + ","
		+ "left=" + xposition + ","
		+ "top=" + yposition;
	oWin = window.open("","_blank",args);
	pic_pop =  '<HTML><TITLE>View Image</TITLE>';
	pic_pop += '<BODY bgcolor="#000000" text="#000000" rightmargin="0" bottommargin="0" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0" style="margin:0">';
	pic_pop += '<div align="center" style="cursor:hand" onClick="window.close();" onload="window.focus();"><img src="'+ pageToLoad +'" width="'+ w +'" height="'+ h +'" vspace="0" hspace="0" border="0"><br><font color="white" face="Arial" size="2">'+ caption +'</font></div>'; 
	pic_pop += '</BODY></HTML>';
	oWin.document.open();
	oWin.document.writeln(pic_pop);
	oWin.document.close();
}

