var legendWin;
function createWin(url,width,height) {
	var left = (screen.width - width) / 2;
	var top = (screen.height - height) / 2;
	if(legendWin == null || legendWin.closed) {
		var props = "resizable,scrollbars=no,left=" + left + ",top=" + top + ",width=" + width + ",height=" + height;
		legendWin = window.open(url, "legend", props);
		legendWin.focus();
	} else {
		legendWin.close();
		var props = "resizable,scrollbars=no,left=" + left + ",top=" + top + ",width=" + width + ",height=" + height;
		legendWin = window.open(url, "legend", props);
		legendWin.focus();
	}
}
