function tox(w){
	x = (screen.width  - w) / 2;
	return(x);
}

function toy(h){
	y = (screen.height - h) / 2;
	return(y);
}

function w(url, name, w, h){
	var prop = "width=" + w+", height=" + h +", left=" + tox(w) +",top=" + toy(h) + ", resizable=1,toolbar=0,directories=0,location=0,menubar=0,status=0";
	if(url.indexOf(".jpg") > -1 || url.indexOf(".png") > -1){
		var win = window.open('', name, prop+",scrollbars=0");
		var con = "<html><head><title>" + name + "</title>";
		con += "<style>body { margin:0; padding:0; }</style>";
		con += "</head><body>";
		con += "<img src='"+url+"' width="+w+",height="+h+" border=0>";
		con += "</body></html>";
		win.document.write(con);
		win.document.close();
	}else{
		var win = window.open(url, name, prop+",scrollbars=1");
	}
	win.focus();
}

