//画像ロールオーバー
function ROfunction(){
	iniSet();
	var imgNum=document.getElementsByTagName("img");
	var inputNum=document.getElementsByTagName("input");
	overNum=new Array;
	for(i=0;i<imgNum.length;i++){overNum[i]=imgNum[i];}
	for(i=0;i<inputNum.length;i++){overNum[i+imgNum.length]=inputNum[i];}
	for(i=0;i<overNum.length;i++){
		if(overNum[i].className.indexOf("Rover")!=-1){
			overNum[i].overimg=new Image();
			if(overNum[i].className.indexOf(":")!=-1){
				Replace=overNum[i].className.split(":");
				Replace=Replace[1].split(" ");
				overNum[i].overimg.src=Replace[0];
			}else{
				Replace = overNum[i].src.length;
				overNum[i].overimg.src=overNum[i].src.substring(0,Replace-4)+"_o"+overNum[i].src.substring(Replace-4,Replace);
			}
			overNum[i].setAttribute("out",overNum[i].src);
			overNum[i].onmouseover=new Function('this.src=this.overimg.src;');
			overNum[i].onmouseout=new Function('this.src=this.getAttribute("out");');
		}
	}
}
window.onload=ROfunction;



//タブメニュー
var nowNum = 1;

function TABfunction01(Num,Length){
	nowNum = Num;
	for(i=1; i<=Length ; i++){
		menuobj=getID('tabMenuA'+i);
		layobj=getID('tabBlockA'+i);
		if(i==Num){
			menuobj.backgroundPosition ="0px -42px";
			layobj.display='block';
		}else{
			menuobj.backgroundPosition ="0px 0px";
			layobj.display='none';
		}
	}
}


function onMouseOver(Num,Length){
	for(i=1; i<=Length ; i++){
		menuobj=getID('tabMenuA'+i);
		if(i==Num){
			menuobj.backgroundPosition ="0px -42px";
		}
	}
}


function onMouseOut(Num,Length){
	for(i=1; i<=Length ; i++){
		menuobj=getID('tabMenuA'+i);
		if(nowNum != i){
			menuobj.backgroundPosition ="0px 0px";
		}
	}
}


function getID(layName){
	if(document.getElementById)return document.getElementById(layName).style;
	if(document.layers)return document.layers[layName];
	if(document.all)return document.all(layName).style;
}



//スムーズスクローリング（ページトップ）
/* Smooth scrolling
	Changes links that link to other parts of this page to scroll
	smoothly to those links rather than jump to them directly, which
	can be a little disorienting.

	sil, http://www.kryogenix.org/

	v1.0 2003-11-11
	v1.1 2005-06-16 wrap it up in an object
*/

var ss = {
	fixAllLinks: function() {
		// Get a list of all links in the page
		var allLinks = document.getElementsByTagName('a');
		// Walk through the list
		for (var i=0;i<allLinks.length;i++) {
			var lnk = allLinks[i];
			if ((lnk.href && lnk.href.indexOf('#head') != -1) && 
			( (lnk.pathname == location.pathname) ||
			('/'+lnk.pathname == location.pathname) ) && 
			(lnk.search == location.search)) {
			// If the link is internal to the page (begins in #)
			// then attach the smoothScroll function as an onclick
			// event handler
			ss.addEvent(lnk,'click',ss.smoothScroll);
		}
	}
},

smoothScroll: function(e) {
	// This is an event handler; get the clicked on element,
	// in a cross-browser fashion
	if (window.event) {
		target = window.event.srcElement;
	} else if (e) {
			target = e.target;
	} else return;

		// Make sure that the target is an element, not a text node
		// within an element
		if (target.nodeName.toLowerCase() != 'a') {
			target = target.parentNode;
		}

		// Paranoia; check this is an A tag
		if (target.nodeName.toLowerCase() != 'a') return;

		// Find the <a name> tag corresponding to this href
		// First strip off the hash (first character)
		anchor = target.hash.substr(1);
		// Now loop all A tags until we find one with that name
		var allLinks = document.getElementsByTagName('a');
		var destinationLink = null;
		for (var i=0;i<allLinks.length;i++) {
			var lnk = allLinks[i];
			if (lnk.name && (lnk.name == anchor)) {
				destinationLink = lnk;
				break;
			}
		}
		if (!destinationLink) destinationLink = document.getElementById(anchor);

		// If we didn't find a destination, give up and let the browser do
		// its thing
		if (!destinationLink) return true;

		// Find the destination's position
		var destx = destinationLink.offsetLeft; 
		var desty = destinationLink.offsetTop;
		var thisNode = destinationLink;
		while (thisNode.offsetParent && 
		(thisNode.offsetParent != document.body)) {
			thisNode = thisNode.offsetParent;
			destx += thisNode.offsetLeft;
			desty += thisNode.offsetTop;
		}

		// Stop any current scrolling
		clearInterval(ss.INTERVAL);

		cypos = ss.getCurrentYPos();

		ss_stepsize = parseInt((desty-cypos)/ss.STEPS);
		ss.INTERVAL =
		setInterval('ss.scrollWindow('+ss_stepsize+','+desty+',"'+anchor+'")',10);

		// And stop the actual click happening
		if (window.event) {
			window.event.cancelBubble = true;
			window.event.returnValue = false;
		}
		if (e && e.preventDefault && e.stopPropagation) {
			e.preventDefault();
			e.stopPropagation();
		}
	},

	scrollWindow: function(scramount,dest,anchor) {
		wascypos = ss.getCurrentYPos();
		isAbove = (wascypos < dest);
		window.scrollTo(0,wascypos + scramount);
		iscypos = ss.getCurrentYPos();
		isAboveNow = (iscypos < dest);
		if ((isAbove != isAboveNow) || (wascypos == iscypos)) {
			// if we've just scrolled past the destination, or
			// we haven't moved from the last scroll (i.e., we're at the
			// bottom of the page) then scroll exactly to the link
			window.scrollTo(0,dest);
			// cancel the repeating timer
			clearInterval(ss.INTERVAL);
			// and jump to the link directly so the URL's right
			location.hash = anchor;
		}
	},

	getCurrentYPos: function() {
		if (document.body && document.body.scrollTop)
		return document.body.scrollTop;
		if (document.documentElement && document.documentElement.scrollTop)
		return document.documentElement.scrollTop;
		if (window.pageYOffset)
		return window.pageYOffset;
		return 0;
	},

	addEvent: function(elm, evType, fn, useCapture) {
		// addEvent and removeEvent
		// cross-browser event handling for IE5+,  NS6 and Mozilla
		// By Scott Andrew
		if (elm.addEventListener){
			elm.addEventListener(evType, fn, useCapture);
			return true;
		} else if (elm.attachEvent){
			var r = elm.attachEvent("on"+evType, fn);
			return r;
		} else {
			alert("Handler could not be removed");
		}
	} 
}

ss.STEPS = 25;

ss.addEvent(window,"load",ss.fixAllLinks);



//swfオブジェクト
var swfVersion="8";
var swfDirectory="./"

var VBflash="ShockwaveFlash.ShockwaveFlash."+swfVersion;
var plugin = (navigator.mimeTypes && navigator.mimeTypes["application/x-shockwave-flash"]) ? navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin : 0;
if (plugin){
	plugin = parseInt(plugin.description.match(/\d+\.\d+/)) >= swfVersion;
}else{
	document.write('<script language=VBScript>\n');
	document.write('on error resume next\n');
	document.write('plugin=(IsObject(CreateObject(VBflash)))\n');
	document.write('</script\>');
}

function showSwf(){
	if (plugin){
		document.write('<style type="text/css">#noflashContents{display:none;}</style>');
		document.write('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="'+swfWidth+'" height="'+swfHeight+'">');
		document.write('<param name="movie" value="'+ swf +'" /><param name="loop" value="true" /><param name="quality" value="high" /><param name="base" value="'+swfDirectory+'"><param name="wmode" value="transparent">');
		document.write('<embed src="'+ swf +'" base="'+swfDirectory+'" loop="true" quality="high" swLiveConnect="false" width="'+swfWidth+'" height="'+swfHeight+'" wmode="transparent" type="application/x-shockwave-flash"></embed>');
		document.write('</object>');
	}
}



function topSwf(){
	if (plugin){
			document.write('<style type="text/css">#noflashContents{display:none;}</style>');
			document.write('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="950" height="312">');
			//document.write("FLASH読み込まれてます");
				document.write('<param name="movie" value="index.swf" />');
				document.write('<param name="FlashVars" value="mSecond={$mSecond}" />');
				document.write('<param name="loop" value="true" />');
				document.write('<param name="base" value="./">');
				document.write('<param name="quality" value="high" />');
				document.write('<param name="wmode" value="transparent">');
				document.write('<embed src="index.swf" quality="high" FlashVars="mSecond={$mSecond}" pluginspage="http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash" base="./" loop="true" quality="high" swLiveConnect="false" wmode="transparent" type="application/x-shockwave-flash" width="950" height="312"></embed>');
				//document.write('<noembed><img src="/en/resources/images/top/top_flash.jpg" alt="OLC" width="950" height="312"></noembed>');
			document.write('</object>');
		}
}	



function topSwfbg(){
	if (plugin){
		document.write('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="100%" height="516">');
		document.write('<param name="movie" value="bg.swf" />');
		document.write('<param name="FlashVars" value="mSecond={$mSecond}" />');
		document.write('<param name="loop" value="true" />');
		document.write('<param name="quality" value="high" />');
		document.write('<param name="base" value="./">');
		document.write('<param name="wmode" value="transparent">');
		document.write('<embed src="bg.swf"  FlashVars="mSecond={$mSecond}" base="./" loop="true" quality="high" swLiveConnect="false" width="100%" height="516" wmode="transparent" type="application/x-shockwave-flash"></embed>');
		document.write('</object>');
	}
}




// load CSS
//分岐の必要があれば、ここに設定。

	document.writeln("<link rel='stylesheet' type='text/css' media='screen,print' href='/en/resources/styles/common/medium.css' title='medium' />");
	document.writeln("<link rel='alternate stylesheet' type='text/css' media='screen,print' href='/en/resources/styles/common/large.css' title='large' />");


// 初期設定
cookieName = "z_style"; // Cookieの名前
defaultSize = 0; // Defaultのスタイルシート
saveDates = 14; // 保持日数


// スタート処理1
function iniSet(){
	var cData = loadCookie(cookieName);
	//alert(loadCookie(cookieName));
	if(cData == false){ //falseだったらCookie初期設定
		saveCookie(cookieName,defaultSize,saveDates);
		//フォント変更処理
		//alert("defaultSize1:"+defaultSize);
	setActiveStyle();
	} else {
		defaultSize = parseInt(cData);
		//alert("dparseInt(cData):"+parseInt(cData));
		//フォント変更処理
	setActiveStyle();
	}	
}

// ボタンイベント処理
function clickSet(num){
	if(((defaultSize) <= 1) && ((defaultSize) >= 0)){
		//CSS切り替え処理
		defaultSize = num;
		//CSS設定
		setActiveStyle();

		//Cookie書き込み
		saveCookie(cookieName,defaultSize,saveDates);
		//alert("clickSet_defaultSize:"+defaultSize);
	}
}


// ブラウザ終了処理

window.unload = function() {
	saveCookie(cookieName,defaultSize,saveDates);
}


//----------------------------------------------------

// CSS設定
function setActiveStyle(){

	for(i=0;i <= 1;i++){
		document.getElementsByTagName("link")[i].disabled = true;
		if(i == (defaultSize)){
			document.getElementsByTagName("link")[i].disabled = false;
		} else {
			document.getElementsByTagName("link")[i].disabled = true;
		}
	}
}


function saveCookie(arg1,arg2,arg3){ //arg1=dataname arg2=data arg3=expiration days
	//if(arg1&&arg2){
		if(arg3){
			xDay = new Date;
			xDay.setDate(xDay.getDate() + eval(arg3));
			xDay = xDay.toGMTString();
			_exp = ";expires=" + xDay;
		}
		else _exp ="";
		document.cookie = escape(arg1) + "=" + escape(arg2) + _exp + ";path=/;";
	//}
}

function loadCookie(arg){ //arg=dataname
	if(arg){
		cookieData = document.cookie + ";" ;
		arg = escape(arg);
		startPoint1 = cookieData.indexOf(arg);
		startPoint2 = cookieData.indexOf("=",startPoint1) +1;
		endPoint = cookieData.indexOf(";",startPoint1);
		if(startPoint2 < endPoint && startPoint1 > -1 &&startPoint2-startPoint1 == arg.length+1){
			cookieData = cookieData.substring(startPoint2,endPoint);
			cookieData = unescape(cookieData);
			return cookieData
		}
	}
	return false
}

function deleteCookie(arg){ //arg=dataname
	if(arg){
		arg = escape(arg);
		yDay = new Date;
		yDay.setHours(yDay.getHours() - 1); 
		yDay = yDay.toGMTString(); 
		document.cookie = arg + "=xxx" + ";expires=" + yDay;
	}
}


function movePage(d){
	path = href=d.options[d.selectedIndex].value;
	if(path) location.href=d.options[d.selectedIndex].value;
}

function setCSSClassById(elem, value) {
	if(document.getElementById) {
		var obj = document.getElementById(elem);
		if(obj) { obj.className = value; }
	}
}


//inputテキスト制御
function inputValueHidden(Obj,State,Num){
	if(State=='onfocus' && Obj.value==Num) Obj.value="";
	if(State=='onblur' && Obj.value=="") Obj.value=Num;
}



//ポップアップ
function openWindow(Url,Name,Width,Height) {
	var features = 'toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=1,width=' + Width + ',height=' + Height;
	Name = window.open(Url,Name,features);
	Name.focus();
}


// IE5.5+ PNG Alpha Fix v2.0 Alpha: Background Tiling Support
// (c) 2008-2009 Angus Turnbull http://www.twinhelix.com

// This is licensed under the GNU LGPL, version 2.1 or later.
// For details, see: http://creativecommons.org/licenses/LGPL/2.1/

var IEPNGFix = window.IEPNGFix || {};

IEPNGFix.tileBG = function(elm, pngSrc, ready) {
	// Params: A reference to a DOM element, the PNG src file pathname, and a
	// hidden "ready-to-run" passed when called back after image preloading.

	var data = this.data[elm.uniqueID],
		elmW = Math.max(elm.clientWidth, elm.scrollWidth),
		elmH = Math.max(elm.clientHeight, elm.scrollHeight),
		bgX = elm.currentStyle.backgroundPositionX,
		bgY = elm.currentStyle.backgroundPositionY,
		bgR = elm.currentStyle.backgroundRepeat;

	// Cache of DIVs created per element, and image preloader/data.
	if (!data.tiles) {
		data.tiles = {
			elm: elm,
			src: '',
			cache: [],
			img: new Image(),
			old: {}
		};
	}
	var tiles = data.tiles,
		pngW = tiles.img.width,
		pngH = tiles.img.height;

	if (pngSrc) {
		if (!ready && pngSrc != tiles.src) {
			// New image? Preload it with a callback to detect dimensions.
			tiles.img.onload = function() {
				this.onload = null;
				IEPNGFix.tileBG(elm, pngSrc, 1);
			};
			return tiles.img.src = pngSrc;
		}
	} else {
		// No image?
		if (tiles.src) ready = 1;
		pngW = pngH = 0;
	}
	tiles.src = pngSrc;

	if (!ready && elmW == tiles.old.w && elmH == tiles.old.h &&
		bgX == tiles.old.x && bgY == tiles.old.y && bgR == tiles.old.r) {
		return;
	}

	// Convert English and percentage positions to pixels.
	var pos = {
			top: '0%',
			left: '0%',
			center: '50%',
			bottom: '100%',
			right: '100%'
		},
		x,
		y,
		pc;
	x = pos[bgX] || bgX;
	y = pos[bgY] || bgY;
	if (pc = x.match(/(\d+)%/)) {
		x = Math.round((elmW - pngW) * (parseInt(pc[1]) / 100));
	}
	if (pc = y.match(/(\d+)%/)) {
		y = Math.round((elmH - pngH) * (parseInt(pc[1]) / 100));
	}
	x = parseInt(x);
	y = parseInt(y);

	// Handle backgroundRepeat.
	var repeatX = { 'repeat': 1, 'repeat-x': 1 }[bgR],
		repeatY = { 'repeat': 1, 'repeat-y': 1 }[bgR];
	if (repeatX) {
		x %= pngW;
		if (x > 0) x -= pngW;
	}
	if (repeatY) {
		y %= pngH;
		if (y > 0) y -= pngH;
	}

	// Go!
	this.hook.enabled = 0;
	if (!({ relative: 1, absolute: 1 }[elm.currentStyle.position])) {
		elm.style.position = 'relative';
	}
	var count = 0,
		xPos,
		maxX = repeatX ? elmW : x + 0.1,
		yPos,
		maxY = repeatY ? elmH : y + 0.1,
		d,
		s,
		isNew;
	if (pngW && pngH) {
		for (xPos = x; xPos < maxX; xPos += pngW) {
			for (yPos = y; yPos < maxY; yPos += pngH) {
				isNew = 0;
				if (!tiles.cache[count]) {
					tiles.cache[count] = document.createElement('div');
					isNew = 1;
				}
				var clipR = Math.max(0, xPos + pngW > elmW ? elmW - xPos : pngW),
					clipB = Math.max(0, yPos + pngH > elmH ? elmH - yPos : pngH);
				d = tiles.cache[count];
				s = d.style;
				s.behavior = 'none';
				s.left = (xPos - parseInt(elm.currentStyle.paddingLeft)) + 'px';
				s.top = yPos + 'px';
				s.width = clipR + 'px';
				s.height = clipB + 'px';
				s.clip = 'rect(' +
					(yPos < 0 ? 0 - yPos : 0) + 'px,' +
					clipR + 'px,' +
					clipB + 'px,' +
					(xPos < 0 ? 0 - xPos : 0) + 'px)';
				s.display = 'block';
				if (isNew) {
					s.position = 'absolute';
					s.zIndex = -999;
					if (elm.firstChild) {
						elm.insertBefore(d, elm.firstChild);
					} else {
						elm.appendChild(d);
					}
				}
				this.fix(d, pngSrc, 0);
				count++;
			}
		}
	}
	while (count < tiles.cache.length) {
		this.fix(tiles.cache[count], '', 0);
		tiles.cache[count++].style.display = 'none';
	}

	this.hook.enabled = 1;

	// Cache so updates are infrequent.
	tiles.old = {
		w: elmW,
		h: elmH,
		x: bgX,
		y: bgY,
		r: bgR
	};
};


IEPNGFix.update = function() {
	// Update all PNG backgrounds.
	for (var i in IEPNGFix.data) {
		var t = IEPNGFix.data[i].tiles;
		if (t && t.elm && t.src) {
			IEPNGFix.tileBG(t.elm, t.src);
		}
	}
};
IEPNGFix.update.timer = 0;

if (window.attachEvent && !window.opera) {
	window.attachEvent('onresize', function() {
		clearTimeout(IEPNGFix.update.timer);
		IEPNGFix.update.timer = setTimeout(IEPNGFix.update, 100);
	});
}




// ニュースリリース //
function movePage(d){
	path = href=d.options[d.selectedIndex].value;
	if(path) location.href=d.options[d.selectedIndex].value;
}

function setCSSClassById(elem, value) {
	if(document.getElementById) {
		var obj = document.getElementById(elem);
		if(obj) { obj.className = value; }
	}
}


function changeMode(flg){
	if(flg == 1)
	{
		setCSSClassById("tag_01","display_no");
		setCSSClassById("tag_02","display_show");
		setCSSClassById("tag_03","display_no");
	}
	else if(flg == 2)
	{
		setCSSClassById("tag_01","display_no");
		setCSSClassById("tag_02","display_no");
		setCSSClassById("tag_03","display_show");
	}
	else
	{
		setCSSClassById("tag_01","display_show");
		setCSSClassById("tag_02","display_no");
		setCSSClassById("tag_03","display_no");
	}
}

function mymenu(board){

if((document.getElementById) && (!document.all))
{
board=document.getElementById(board).style;
if (board.display=='none') board.display="block";
else board.display='none';
}

else{

board=document.all[board].style;
if (board.display=='none') board.display="block";
else board.display='none';
}
}



