function Flash_Call(swf,widht,height){
quality = 'high';
scale = 'noscale';

document.write('<OBJECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" WIDTH="'+widht+'" HEIGHT="'+height+'" id="flash" ALIGN="middle"><PARAM NAME=movie VALUE="'+swf+'"><param name="salign" value="lt" /><PARAM NAME=quality VALUE='+quality+'><param name="scale" value="'+scale+'" /><param name="wmode" value="transparent"> <PARAM NAME=bgcolor VALUE=#FFFFFF><EMBED src="'+swf+'" quality='+quality+' bgcolor=#FFFFFF scale='+scale+' salign="lt" WIDTH="'+widht+'" HEIGHT="'+height+'" NAME="flash" ALIGN="middle" TYPE="application/x-shockwave-flash" wmode="transparent"></EMBED></OBJECT>')
}



/**
 * onmouseove/onmouseoutに自動で関数を設定する
 * @param {Object} tagName 設定したいタグ名（画像をつけられるもの）
 * @param {Object} className 関数を設定するタグにつけるクラス名
 */
function initOnMouseFunc(tagName, className) {
	var elements = document.getElementsByTagName(tagName);
	
	for(cnt = 0; cnt < elements.length; cnt++) {
		obj = elements[cnt];
		if(obj.className == className) {
			var defImg = obj.src;
			var dotPos = defImg.lastIndexOf(".");
			var onImg  = defImg.substr(0, dotPos)+"o"+defImg.substr(dotPos);
			
			obj.setAttribute('defImg', defImg);
			obj.setAttribute('onImg' , onImg);
			obj.onmouseover = function() {
				this.src = this.getAttribute('onImg');
			};
			
			obj.onmouseout = function() {
				this.src = this.getAttribute('defImg');
			};

			obj.onerror = function() {
				this.onmouseover = function() {};
				this.onmouseout = function() {};
				this.src = this.getAttribute('defImg');
			};
		}
	}
}

function init() {
	initOnMouseFunc('img', 'roimage');
	initOnMouseFunc('input', 'roimage');
}

window.onload = init







function redraw(id) {
	var obj = document.getElementById(id);
	setPos(id);
	fadeIn(obj.bgId, 50, 50);
	fadeIn(id, 100, 100);
}
function setPos(id) {
	var pObj = document.getElementById(id);
 
	var width = 0;
	var height = 0;
	var scroll = 0;
	if(document.documentElement.clientWidth) {
		width = document.documentElement.clientWidth;
		height = document.documentElement.clientHeight;
	} else if(document.body.clientWidth){
		width = document.body.clientWidth;
		height = document.body.clientHeight;
	} else {
		width = window.innerWidth;
		height = window.innerHeight;
	}
	scroll = (document.body.scrollTop || document.documentElement.scrollTop);
 
	var maxHeight = height;
	if (typeof document.documentElement.style.msInterpolationMode != "undefined") {
		//IE7
		if(document.documentElement.clientHeight && document.documentElement.clientHeight > maxHeight) {
			maxHeight = document.documentElement.clientHeight;
		}
		if(document.body.clientHeight && document.body.clientHeight > maxHeight) {
			maxHeight = document.body.clientHeight;
		}
		if(window.innerWidth && window.innerWidth > maxHeight) {
			maxHeight = window.innerWidth;
		}
		maxHeight -= scroll;
	}
 
	var bgObj = document.getElementById(pObj.bgId);
	bgObj.style.width=width+'px';
	bgObj.style.height=maxHeight+'px';
	bgObj.style.left = '0px';
	bgObj.style.top = scroll+'px';
 
	if(pObj.offsetWidth > width) {
		pObj.style.left = '0px';
	} else {
		pObj.style.left = ((width-pObj.offsetWidth)/2)+'px';
	}
	if(pObj.offsetHeight > height) {
		pObj.style.top = scroll+'px';
	} else {
		pObj.style.top = scroll+((height-pObj.offsetHeight)/2)+'px';
	}
}
function onPopup(popupId, imgId) {
	window.onscroll=function() {
		redraw(popupId);
	};
	window.onresize=function() {
		redraw(popupId);
	};
 
	var pObj = document.getElementById(popupId);
	pObj.style.zIndex = 100;
	pObj.style.position="absolute";
	pObj.style.filter = "alpha(opacity=0)";
	pObj.style.opacity = 0;
 
	var srcObj = document.getElementById(pObj.srcId);
	srcObj.style.width=pObj.imgList[imgId].width+'px';
	srcObj.style.height=pObj.imgList[imgId].height+'px';
	srcObj.style.backgroundImage = 'url('+pObj.imgList[imgId].src+')';
	
	//消す
	var txtObj = document.getElementById(pObj.textId);
	var child = txtObj.firstChild;
	if(child) {
		while(child.nextSibling) {
			txtObj.removeChild(child.nextSibling);
		}
		txtObj.removeChild(child);
	}
	var tmpObj = document.createElement("div");
	tmpObj.innerHTML = pObj.imgList[imgId].text;
	txtObj.appendChild(tmpObj);
	
	var bgObj = document.getElementById(pObj.bgId);
	bgObj.style.zIndex = 50;
	bgObj.style.position="absolute";
	bgObj.style.filter = "alpha(opacity=0)";
	bgObj.style.opacity = 0;
 
	var imgFilterObj = document.getElementById("ImgFilter");
	if(!imgFilterObj) {
		var imgFilterObj = document.createElement("div");
		imgFilterObj.setAttribute("class", srcObj.className);
		imgFilterObj.setAttribute("className", srcObj.className);	//IE
		imgFilterObj.id = "ImgFilter";
		srcObj.parentNode.insertBefore(imgFilterObj, srcObj);
	}
	imgFilterObj.style.zIndex = 110;
	imgFilterObj.style.position="absolute";
	imgFilterObj.style.visibility = "visible";
	imgFilterObj.style.width = pObj.imgList[imgId].width+'px';
	imgFilterObj.style.height = pObj.imgList[imgId].height+'px';
	imgFilterObj.style.left = srcObj.offsetLeft+'px';
	imgFilterObj.style.top = srcObj.offsetTop+'px';
	imgFilterObj.style.background = 'none';
	
	setPos(popupId);
 
	fadeIn(pObj.bgId, 50, 0);
	fadeIn(popupId, 100, 0);
}
function closePopup(id) {
	window.onscroll=null;
	window.onresize=null;
	var obj = document.getElementById(id);
	fadeOut(id, 0, 100, 100);
	fadeOut(obj.bgId, 0, 50, 50);
	
	document.getElementById("ImgFilter").style.visibility="hidden";
}
function fadeIn(id, max, now) {
	var obj = document.getElementById(id);
	obj.style.visibility="visible";
	if(max > now) {
		var next = now + (max / 5);
		obj.style.filter = "alpha(opacity=" + next + ")";
		obj.style.opacity = next/100;
		setTimeout("fadeIn('"+id+"',"+max+","+next+")", 100);
	} else {
		obj.style.filter = "alpha(opacity=" + max + ")";
		obj.style.opacity = max/100;
	}
}
function fadeOut(id, min, start, now) {
	var obj = document.getElementById(id);
	if(min < now) {
		var next = now - ((start-min) / 5);
		obj.style.filter = "alpha(opacity=" + next + ")";
		obj.style.opacity = next/100;
		setTimeout("fadeOut('"+id+"',"+min+","+start+","+next+")", 100);
	} else {
		obj.style.filter = "alpha(opacity=" + min + ")";
		obj.style.opacity = min/100;
		if(min <= 0) {
			obj.style.visibility="hidden";
		}
	}
}
function initImg(idList, imgList) {
	var pObj = document.getElementById(idList[0]);
	pObj.imgList = new Array();
	for(var imgId in imgList) {
		pObj.imgList[imgId] = new Image();
		pObj.imgList[imgId].src = imgList[imgId][0];
		pObj.imgList[imgId].text = imgList[imgId][1];
	}
	pObj.bgId = idList[1];
	pObj.srcId = idList[2];
	pObj.textId = idList[3];
}

/*留学生の方へ*/
/*110119追加*/
function ChangeTab(tabname) {
   document.getElementById('tab1').style.display = 'none';
   document.getElementById('tab2').style.display = 'none';
   document.getElementById('tab3').style.display = 'none';
   document.getElementById('tab4').style.display = 'none';
   document.getElementById(tabname).style.display = 'block';
}
/*110119追加おわり*/
