// 画像オーバー時切り替え
function changeImage(THIS,FLAG){
	SRC = THIS.src;
	if(FLAG == 1){
		THIS.src = THIS.src.replace('_off.','_on.');
	}else{
		THIS.src = THIS.src.replace('_on.','_off.');
	}
}

function initChangeImage(){
	for(i=0;i<document.images.length;i++){
		if(document.images[i].className == 'changeImage'){
			addEvent(document.images[i], 'mouseover', function(){changeImage(this,1);})
			addEvent(document.images[i], 'mouseout', function(){changeImage(this,0);})
		}
	}
}

// swf書き出し
function writeSwf(SRC,ID,WIDTH,HEIGHT,ALLOWSCRIPT,MENU,WMODE){
	var outStr = '';
	outStr += '<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" width="' + WIDTH + '" height="' + HEIGHT + '" id="' + ID + '">\n';
	outStr += '<param name="movie" value="' + SRC + '">\n';
	outStr += '<param name="quality" value="high">\n';
	if(WMODE != undefined){
		outStr += '<param name="wmode" value="' + WMODE + '">\n';
	}
	if(ALLOWSCRIPT != undefined){
		outStr += '<param name="allowScriptAccess" value="' + ALLOWSCRIPT + '">\n';
	}
	if(MENU != undefined){
		outStr += '<param name="menu" value="' + MENU + '">\n';
	}
	outStr += '<embed type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" quality="high" align="middle" src="' + SRC + '" width="' + WIDTH + '" height="' + HEIGHT + '" name="' + ID + '"';
	if(WMODE != undefined){
		outStr +=  ' wmode="' + WMODE + '"';
	}
	if(ALLOWSCRIPT != undefined){
		outStr +=  ' allowScriptAccess="' + ALLOWSCRIPT + '"';
	}
	if(MENU != undefined){
		outStr +=  ' menu="' + MENU + '"';
	}
	outStr += '>\n';
	outStr += '</object>';
	document.write(outStr);
}

// 別ウィンドウ開く
function openWindow(URL,WINNAME,STATUS){
	var new_window = window.open(URL,WINNAME,STATUS);
	if(new_window){
		new_window.focus();
	}
}

// イベント登録（ブラウザ共通）
function addEvent(target, type, listener){
	if (target.addEventListener) {
		target.addEventListener(type, listener, false);
	} else if (target.attachEvent) {
		target.attachEvent('on' + type, function(){
		listener.call(target, window.event);
		});
	} else {
		target['on' + type] = function(e){
			listener.call(target, e || window.event);
		};
	}
}

// 初期処理
function initiarize(){
	// 画像オーバー時
	initChangeImage();
}
addEvent(window, 'load', initiarize);






