 var height = screen.height;
 var width = screen.width;
 var leftpos = width / 2 - 50 ;
 var toppos = height / 2 - 50 ;

 function encode(str) { return escape(str.replace(/ /g,'+')); }

 function view(what,id) {
			 var url = 'popupimg.php?pic='+encode(what)+'&id='+id;
			 window.open(url,'WIN','scrollbars=yes,status=no,toolbar=no,resizable=0,location=no,menubar=no,width=700,height=500');
			}
 function getParams() {
			var idx = document.URL.indexOf('?');
			var params = new Array();
			if(idx != -1) {
					var pairs = document.URL.substring(idx+1, document.URL.length).split('&');
					for(var i=0; i<pairs.length; i++) {
									   nameVal = pairs[i].split('=');
									   params[nameVal[0]] = nameVal[1];
									  }
				      }
			return params;
		      }



 params = getParams();

 function resize() {
		    if(eval(pic).height) {
					  var name = navigator.appName
					  if(name == "Microsoft Internet Explorer") {
											myHeight = eval(pic).height + 67;
											myWidth = eval(pic).width + 27;
										    } else {
												myHeight = eval(pic).height + 3;
												myWidth = eval(pic).width;
											   }
					  clearTimeout();

					var height = screen.height;
					var width = screen.width;
					var leftpos = width / 2 - myWidth / 2;
					var toppos = height / 2 - myHeight / 2; 
					self.moveTo(leftpos, toppos);
					self.resizeTo(myWidth, myHeight);
					 } else setTimeOut(resize(), 100);
		   }
