function createHttpRequest() {
	if (window.ActiveXObject) {
		try {
			return new ActiveXObject("Msxml2.XMLHTTP");
		} catch (e) {
			try {
				return new ActiveXObject("Microsoft.XMLHTTP");
			} catch (e2) {
				return null;
			}
		}
	} else if (window.XMLHttpRequest) {
		return new XMLHttpRequest();
	} else {
		return null;
	}
}

function requestFile(data, method, fileName, async) {
	var httpoj = createHttpRequest();
	httpoj.open(method, fileName, async);
	httpoj.onreadystatechange = function() {
		if (httpoj.readyState == 4) {
			xmlDoc = httpoj.responseXML;
			
			var markers = xmlDoc.documentElement.getElementsByTagName("marker");
			var htm = '';
			if (data == "") {
			} else {
				
				//--------------------変更箇所1-------------------------------
				var tablewidth=452;//テーブルの幅
				var areaBgColor="#c4b078";//枠線の色
				
				var colspanNum=2;//項目数
				
				var areaClass="area";//地域テキストのスタイル
				
				var prefClass="pref";//県名テキストのスタイル
				var prefWidth=120;//県名セルの幅
				
				var theaterNameClass="tname";//劇場名テキストのスタイル
				var theaterNameWidth=332;//劇場名セルの幅
				//--------------------変更箇所1-------------------------------
				
				
				
				htm += '<table width="';
				htm += tablewidth;
				htm += '" border="0" cellpadding="0" cellspacing="0"><tr>';
				htm += '<td colspan="';
				htm += colspanNum;
				htm += '" class="';
				htm += areaClass;
				htm += '">';
				htm += data;
				htm += '</td>';
				htm += '</tr>';
				for (i=0; i<markers.length; i++) {
					
					var theatername='';
					theatername += '<td class="'
					theatername += theaterNameClass;
					theatername += '" width="'
					theatername += theaterNameWidth;
					theatername += '">'
					if (markers[i].getAttribute("link") != "" && markers[i].getAttribute("link") != null) {
						theatername += '<a href="';
						theatername += markers[i].getAttribute("link");
						theatername += '", target="_blank">';
						theatername += markers[i].getAttribute("name");
						theatername += '</a>';
					} else if (markers[i].getAttribute("tel") != "" && markers[i].getAttribute("tel") != null) {
						theatername += markers[i].getAttribute("name");
						theatername += '（'
						theatername += markers[i].getAttribute("tel");
						theatername += '）'
					}else{
						theatername += markers[i].getAttribute("name");
					}
					theatername += '</td>'
					
					
					//--------------------変更箇所2-------------------------------
					mainContents='';
					mainContents += theatername;//劇場名
					//--------------------変更箇所2-------------------------------
					
					
					if (markers[i].getAttribute("area") == data && (i == 0 || markers[i].getAttribute("pref") != markers[i-1].getAttribute("pref"))) {
						var vk = 0;
						for (j=i; j<markers.length; j++) {
							if (markers[i].getAttribute("pref") == markers[j].getAttribute("pref")) {
								vk += 1;
							}
						}
						htm += '<tr>'
						htm += '<td width="100" valign="top" rowspan="'
						htm += vk;
						htm += '" class="'
						htm += prefClass;
						htm += '">'
						htm += markers[i].getAttribute("pref");
						htm += '</td>'
						htm += mainContents;
						htm += '</tr>'
					}else if (markers[i].getAttribute("area") == data ) {
						htm += '<tr>'
						htm += mainContents;
						htm += '</tr>'
					}
				}
				htm += '</table>';
				htm += '<table width="452" border="0" cellspacing="0" cellpadding="0">';
				htm += '<tr>';
				htm += '<td align="right">';
				htm += '<a href="#top"><img src="contents/images/pagetop.gif" alt="PAGE TOP" width="51" height="19" border="0" /></a>';
				htm += '</td>';
				htm += '</tr>';
				htm += '</table>';
			}
			document.getElementById('changeArea').innerHTML = htm;
		}
	};
	httpoj.send(data);
}
function theaters(pref){
	requestFile(pref,'GET','./theaters.xml',true)
}
