function popup(url, params) {
 if (win) win.close(); else { var win; win = window.open(url, 'win', params); win.focus(); }
 return false;
}

function imgpopup(img, w, h, caption, title) { 
		if (!w) w=200; w += 50; 	if (!h) h=200; h += 85; if(caption&&caption!='') h +=40;	win = window.open('', 'win', 'width=' + w + ',height=' + h + ',scrollbars=0, resizable=1');
		win.document.open();
		win.document.write('<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">')
		win.document.write('<html  xmlns="http://www.w3.org/1999/xhtml">')
		win.document.write('<head>')
		if(title&&title!='') win.document.write('<title>' + title + '</title>'); else win.document.write('<title>NMMA Image Gallery</title>');
		win.document.write('</head>')
		win.document.write('<body style="font-size: x-small; font-family:Verdana, Arial, Helvetica, sans-serif; margin:15px 0; padding:0; background-color:#AAB;">')
		win.document.write('<div align="center" style="text-align:center; border-top:1px solid #666; border-bottom:1px solid #666; margin:0 auto; background-color:#FFF;">')
		win.document.write('<a href="javascript:window.close();"><img src="' + img + '" border="0"  alt="Close Window" style="padding:15px 15px 35px 15px;"/></a>')
		if(caption&&caption!='') win.document.write('<p style="border-top:1px solid #AAA; padding:10px; margin:0; background-color:#DDE; width:100%;">' + caption + '</p>')
		win.document.write('</div>')
		win.document.write('</body>')
		win.document.write('</html>');
		win.document.close();
}

function openManager(url){
 var winOptions = 'toolbar=0, resizable=0, directories=0, location=0, scrollbars=0, status=1, left=20, top=20, width=760, height=600';
 var win = window.open(url, 'manager', winOptions);
 if(win) win.focus();
}
	
function openReport(url){
 var winOptions = 'toolbar=0, resizable=1, directories=0, location=0, scrollbars=1, status=1, left=20, top=20, width=760, height=600';
 var win = window.open(url, 'report', winOptions);
 if(win) win.focus();
}