var height = screen.height;
var width = screen.width;
var leftpos = width / 2 - 50;
var toppos = height / 2 - 50;
function encode(str){ // Netscape fix thanks to Cyanide_7
	return escape(str.replace(/ /g,'%20'));
}
function view(what) {
	var name = navigator.appName;
	var agent = navigator.userAgent.toLowerCase();
	var isWindows = agent.indexOf("win") != -1;
	var url ;
	url = 'viewer.aspx?pic=' + encode(what);
	var urlNet;
	urlNet = 'viewer.html?pic=' + encode(what);
	if (isWindows){
		var win = window.open(url,'WIN','scrollbars=no,status=no,toolbar=no,resizable=1,location=no,menu=no,width=100,height=100,left=' + leftpos + ',top=' + toppos);
	}else{
		if (name != "Microsoft Internet Explorer"){
			var win = window.open(urlNet,'WIN','scrollbars=no,status=no,toolbar=no,resizable=1,location=no,menu=no,width=100,height=100,left=' + leftpos + ',top=' + toppos);
		}else{
			var win = window.open(url,'WIN','scrollbars=no,status=no,toolbar=no,resizable=1,location=no,menu=no,width=100,height=100,left=' + leftpos + ',top=' + toppos);
		}
	}
	win.focus();
}

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() {
	//params = getParams();
	//if (eval(pic).height) {
		var name = navigator.appName;
		var agent = navigator.userAgent.toLowerCase();
		var isWindows = agent.indexOf("win") != -1;
		if (name == "Microsoft Internet Explorer") {
			if (isWindows){
				myHeight = eval(pic).height + 31;
				myWidth = eval(pic).width + 12;
			}else{
				myHeight = eval(pic).height + 400;
				myWidth = eval(pic).width + 668;
			}
		}else {
			if (isWindows){
				myHeight = eval(pic).height;
				myWidth = eval(pic).width;
			}else{
				myHeight = eval(pic).height + 200;
				myWidth = eval(pic).width + 200;
			}
		}
//		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);
}
