var g_town_plan;

function openPlan(town_plan) {

	g_town_plan = town_plan;
	var page_code;

	plan_size = new Array("width", "height");
	plan_size["width"] = new Array();
	plan_size["height"] = new Array();

	plan_size["width"]["cb"] = 779;
	plan_size["height"]["cb"] = 1073;
	plan_size["width"]["telc"] = 815;
	plan_size["height"]["telc"] = 829;
	plan_size["width"]["ta"] = 799;
	plan_size["height"]["ta"] = 825;
	plan_size["width"]["st"] = 826;
	plan_size["height"]["st"] = 872;
	plan_size["width"]["pt"] = 792;
	plan_size["height"]["pt"] = 1122;
	plan_size["width"]["pi"] = 790;
	plan_size["height"]["pi"] = 862;
	plan_size["width"]["pe"] = 780;
	plan_size["height"]["pe"] = 917;
	plan_size["width"]["jh"] = 786;
	plan_size["height"]["jh"] = 1132;
	plan_size["width"]["ck"] = 833;
	plan_size["height"]["ck"] = 926;
	plan_size["width"]["trebon"] = 749;
	plan_size["height"]["trebon"] = 1326;

	var win_width = plan_size["width"][town_plan] + 30;
	var win_height = plan_size["height"][town_plan] + 30;

	var win_x_pos = (screen.width - win_width) / 2;
	var win_y_pos = (screen.height - win_height) / 2;

	if ((win_height + 40) > screen.availHeight) {
		win_y_pos = 0;
		win_height = screen.availHeight - 40;
	}

	var win_params = "toolbar=0, location=0, status=0, menubar=0, scrollbars=1, resizable=0, ";
		win_params += "width=" + win_width + ", height=" + win_height + ", left=" + win_x_pos + ", top=" + win_y_pos;

/*
	page_code = "<html>\n<head><title>Town plan (click to close)</title>\n";
	page_code += "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\">\n";
	page_code += "</head>\n";
	page_code += "<body bgcolor=\"#EEEEEE\" style=\"margin: 0px;\" onKeyDown=\"if (event.keyCode==27) window.close();\">\n";
	page_code += "<table border=\"0\" bordercolor=\"#EEEEEE\" cellspacing=\"0\" cellpadding=\"0\" width=\"100%\" height=\"100%\"><tr><td align=\"center\">";
	page_code += "<img src=\"../bg/plans/" + town_plan + ".gif\" border=\"0\" onClick=\"window.close();\">";
	page_code += "</td></tr><tr><td bgcolor=\"#EEEEEE\" style=\"font-family: helvetica ce, verdana, arial, sans-serif; font-size: 11px; color: black; text-align: center; vertical-align: bottom;\">";
	page_code += "</td></tr></table>\n";
	page_code += "</body></html>";
*/

	WinTPlan = window.open("../bg/plans/townplan.htm", "townplan", win_params);

//	WinTPlan.document.write(page_code);

	WinTPlan.focus();

}