var win;
var showpic;
var caption;
var attributes;

function picwin(pic,w,h,text){
	if (win && !win.closed){
		win.close();
	}
	if(text != ''){
		w = w+35;
		h = h+150;
		attributes = 'width=' + w + ',height=' + h + ',scrollbars';
	}else{
		w = w+15;
		h = h+100;
		attributes = 'width=' + w + ',height=' + h + ',scrollbars=no';
	}
	caption = text;
	showpic = pic;
	win = window.open("gallery_popup.htm","",attributes);
	win.resizeTo(w,h);
	win.moveTo((screen.width - w) / 2,(screen.height - h) / 2);
	if (!win.opener){
		win.opener = window;
	}
}