		var win=null;

		function popup(url,w,h,title,extra)
		{
			//css = 'width: '+w+'px;height: '+h+'px;margin: 0px;';
			css = 'height: '+h+'px;margin: 0px;vertical-align: middle;';
			html = '<HTML>\n<HEAD>\n<TITLE>'+title+'</TITLE>\n</HEAD>\n<BODY BGCOLOR="#ffffff" LEFTMARGIN=0 MARGINWIDTH=0 TOPMARGIN=0 MARGINHEIGHT=0>\n<div style="width: 100%;height: 100%;text-align: center;"><IMG style="'+css+'" SRC="'+url+'" BORDER=0 NAME=imageTest></div>\n</BODY>\n</HTML>';
			
			/*win.document.open("text/html", "replace");
			win.document.write(html);
			win.document.close();

			img=new Image;
			img.src=url;
			w=img.width;
			h=img.height;	*/

			offsetw=20;
			offseth=60;

			var macie=false;var ie=false;
			var agt=navigator.userAgent.toLowerCase();
			var plat=navigator.platform.toLowerCase();
			if (agt.indexOf("msie") != -1 && plat.indexOf("mac") != -1) macie=true;
			if (agt.indexOf("msie")!=-1) ie=true;

			if(ie){
				offsetw=20;
	                        offseth=100;
			}

			str="height="+(h+offseth)+",width="+(w+offsetw)+","+extra;
			str+=",left="+(screen.width -w)/2+",top="+parseInt((screen.height -h)/3);
			str+=",toolbar=no, location=no,status=no,menubar=no,scrollbars=no,resizable=no";

			if(win==null || !win.open || win.closed){
				win=window.open('','name',str);
				win.resizeTo((w+offseth), (h+offseth));
				with (win.document) {
				  win.document.open(); //("text/html", "replace");
				  win.document.write(html);
				  win.document.close();
				}
			}else{
				if (win && win.open && !win.closed) {
					  win.resizeTo((w+offsetw), (h+offseth));
					  win.document.open(); //("text/html", "replace");
					  win.document.write(html);
					  win.document.close();
				}
			}
			win.focus();
			if(macie) win=null;
		}
