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=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"></EMBED></OBJECT>')
}


/* iframeをポップアップとして表示します。
 * 表示場所がhtml上にタグとして用意してある必要があります。
 *
 * 例：
 * <div id="tag_bg" style="visibility:hidden;"></div>
 * <div id="tag_window" style="visibility:hidden;">
 *	<p><a href="javascript:void(0);"  onclick="closePopupFrame('tag_window');">閉じる</a></p>
 *	<div id="frame_target"></div>
 * </div>
 *
 * tag_window:ポップアップとして表示するdivタグ
 * tag_bg:BGとして利用するdivタグ
 * frame_target:iframeを挿入するdivタグのid
 */

/**
 * iframeをポップアップで開く
 * @param popupId ポップアップとして表示するdivタグのid
 * @param bgId 背景として利用するdivタグのid
 * @param urlId iframeを挿入するdivタグのid
 * @param url iframeに表示するURL
 */
function onPopupFrame(popupId, bgId, urlId, url, delIdList) {
	window.onscroll=function() {
		_redrawFrame(popupId);
	};
	window.onresize=function() {
		_redrawFrame(popupId);
	};

	var pObj = document.getElementById(popupId);
	pObj.style.zIndex = 100;
	pObj.style.position="absolute";
	pObj.style.filter = "alpha(opacity=0)";
	pObj.style.opacity = 0;
	pObj.bgId = bgId;
	pObj.delIdList = delIdList;

	//消す
	var txtObj = document.getElementById(urlId);
	txtObj.src = url;

	var bgObj = document.getElementById(pObj.bgId);
	bgObj.style.zIndex = 50;
	bgObj.style.position="absolute";
	bgObj.style.filter = "alpha(opacity=0)";
	bgObj.style.opacity = 0;

	for(var pos=0; pos < delIdList.length; pos++) {
		var delObj = document.getElementById(delIdList[pos]);
		delObj.style.visibility="hidden";
	}

	_setFramePos(popupId);

	_fadeIn(pObj.bgId, 70, 0);
	_fadeIn(popupId, 100, 0);
}
/**
 * ポップアップを閉じる処理
 * @param id ポップアップid
 */
function closePopupFrame(popupId) {
	window.onscroll=null;
	window.onresize=null;
	var obj = document.getElementById(popupId);
	_fadeOut(popupId, 0, 100, 100);
	_fadeOut(obj.bgId, 0, 70, 70);
}
function _redrawFrame(id) {
	var obj = document.getElementById(id);
	_setFramePos(id);
	_fadeIn(obj.bgId, 70, 70);
	_fadeIn(id, 100, 100);
}
function _setFramePos(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);
	left = (document.body.scrollLeft || document.documentElement.scrollLeft);

	var bgObj = document.getElementById(pObj.bgId);
	bgObj.style.width=width+'px';
	bgObj.style.height=height+'px';
	bgObj.style.left = left+'px';
	bgObj.style.top = scroll+'px';

	if(pObj.offsetWidth > width) {
		pObj.style.left = left+'px';
	} else {
		pObj.style.left = 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 _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";
			if(obj.delIdList) {
				for(var pos=0; pos < obj.delIdList.length; pos++) {
					var delObj = document.getElementById(obj.delIdList[pos]);
					delObj.style.visibility="visible";
				}
			}
		}
	}
}



/**
 * 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.src = this.getAttribute('defImg');
			};
		}
	}
}

function init() {
	initOnMouseFunc('img', 'roimage');
	initOnMouseFunc('input', 'roimage');
}

window.onload = init

