MJL.event.add(window, "load", function() {
    MJL.enable.styleSwitcher("styleSwitcher");
    /*MJL.enable.tab("tabs");*/
    MJL.enable.flash("flash");
    MJL.enable.heightEqualizer("equalize");
    /*MJL.enable.heightEqualizer("equalize2col", {groupBy : 2});*/
    MJL.enable.rollover("roll", {
        disable   : "unroll",
        active    : "active",
        switchers : {
            // 接尾辞 "_c" が付与されている場合は削除
            // (グローバルナビゲーション用)
            on  : {cond : /(?:_c)?(\.[^\.]+)$/, replace : "_o$1"},
            off : {cond : "",                   replace : ""}
        }
    });
}, false);



//開校情報XML読み込み
MJL.event.add(window, "load", function() {
	var tableContainer = document.getElementById("school-info-container");
	if(!tableContainer){return false;}
	
	//create table
	
	var infoTable = document.createElement("table");
	var infoTableBody = document.createElement("tbody");
	
	infoTable.appendChild(infoTableBody);
	
	infoTable.setAttribute("cellspacing","0");
	infoTable.setAttribute("cellpadding","0");
	infoTable.setAttribute("summary","開校情報");
	
	function getXHR() {
	  try {
	    xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
		return xmlhttp;
	  } catch (e) {
	    try {
	      xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
	    } catch (e2) {
	      xmlhttp = false;
	    }
	  }
	  if (!xmlhttp && typeof XMLHttpRequest!=='undefined') {
	    xmlhttp = new XMLHttpRequest();
		return xmlhttp;
	  }
	}
	
	var XHR = getXHR();

	XHR.onreadystatechange = function(){
	if (XHR.readyState == 4 && XHR.status == 200) {
		XML_obj = XHR.responseXML;
			get_XML(XML_obj);
		}
	};

	XHR.open('GET', '/shared/xml/school.xml',true);
	XHR.send(null);
	
	function get_XML(XML){
		
		var schools = XML.getElementsByTagName("school");
		var schoolsLength = schools.length;
		
		var iconHTML = '<span class="new"><img src="/images/icon_new.gif" alt="New" width="26" height="11" /></span>';

		function appendTabel(name,date,url,icon,target){
			
			var tr = document.createElement("tr");
			
			var th = document.createElement("th");
			th.appendChild(date);
			th.className = "date";
			th.setAttribute("scope","row");
			tr.appendChild(th);
			
			var td_icon = document.createElement("td");		
			if(icon === "true" ){
				td_icon.innerHTML = iconHTML;
			}
			tr.appendChild(td_icon);
			
			var td_link = document.createElement("td");	
			
			if(url === ""){
				td_link.appendChild(name);
				tr.appendChild(td_link);
			}else{
				var tag_a =  document.createElement("a");
				tag_a.setAttribute("href",url);
				if(target === "true" ){
					tag_a.setAttribute("target","_blank");
				}
				tag_a.appendChild(name);
				td_link.appendChild(tag_a);
				tr.appendChild(td_link);
			}			
			infoTableBody.appendChild(tr);
			
		}

		
		for (var i=0; i<schoolsLength; i++) {
			var name = document.createTextNode(schools[i].getAttribute("name"));	
			var date =  document.createTextNode(schools[i].getAttribute("date"));	
			var url =  schools[i].getAttribute("url");
			var icon = schools[i].getAttribute("new");
			var target = schools[i].getAttribute("blank");
			
			appendTabel(name,date,url,icon,target);
		}
		
		tableContainer.appendChild(infoTable);
	}

}, false);