function linkurl(elementId,styleclass){
	var i;
	if (!document.getElementById) {
		return;
	}
	var linkElms = document.getElementById(elementId).getElementsByTagName('a');
	for(i = 0; i < linkElms.length; i++){
		var linkElm = linkElms[i];
		if(linkElm.className != styleclass){
			continue;
		}
		linkElm.onclick = function(){
			window.open("./link/link.html?url="+encodeURI(this.href),"_blank");
			return false;
		}
	}
}

function windowonlod(){
  toThisTopLinkAdd();
}
function toThisTopLinkAdd(){
	if (document.getElementById) {
		var linkElms = document.getElementsByTagName('a');
		for(i = 0; i < linkElms.length; i++){
			if(linkElms[i].href.match(/#headerArea$/)){
				linkElms[i].onclick = function(){toThisTop(); return false;}
			}
		}
	}
}



//(c) M



function toThisTop() {
	var x1 = x2 = x3 = 0;
	var y1 = y2 = y3 = 0;
	if (document.documentElement) {
		x1 = document.documentElement.scrollLeft || 0;
		y1 = document.documentElement.scrollTop || 0;
	}else if (document.body) {
		x2 = document.body.scrollLeft || 0;
		y2 = document.body.scrollTop || 0;
	}
	x3 = window.scrollX || 0;
	y3 = window.scrollY || 0;
	var x = Math.max(x1, Math.max(x2, x3));
	var y = Math.max(y1, Math.max(y2, y3));
	window.scrollTo(Math.floor(x / 2), Math.floor(y / 2));
	if (x > 0 || y > 0) {
		window.setTimeout("toThisTop()", 20);
	}
}


//TOPページバナー
var bannerScroll = new Object();
// setInterval, setTimeout
//バナーローテーションの設定
bannerScroll.changeBannerBottomSet = function (){
	if(!document.getElementById('bannerList')){
		return;
	}
	//margin,paddingも含めたバナーの幅
	this.bannerWidth = 156;
	//スピード一覧
	this.bannerSpeedList = new Array();
	//スピード：通常
	this.bannerSpeedList.NS = 1;
	//スピード：早送り
	this.bannerSpeedList.FF = -20;
	//スピード：巻き戻し
	this.bannerSpeedList.FR = 20;
	//バナースピード現状：初期値：通常
	//this.bannerSpeed = this.bannerSpeedList.NS;
	//バナースピード現状：初期値：停止
	this.bannerSpeed = 0;
	//バナースピード目標値：初期値：通常
	this.bannerSpeedTo = this.bannerSpeedList.NS;
	//インターバル
	this.ctmtimeoutid = null;
	//バナー一覧
	this.bannerTargetElm = document.getElementById('bannerList').getElementsByTagName('ul')[0];
	//バナーの数
	this.bannerItems = this.bannerTargetElm.getElementsByTagName('li').length;
	//バナーの位置調整
	this.bannerPosition = this.bannerItems * this.bannerWidth * 1;
	//ループするので、バナーを３回コピー
	var banners = this.bannerTargetElm.innerHTML + this.bannerTargetElm.innerHTML + this.bannerTargetElm.innerHTML;
	this.bannerTargetElm.innerHTML = banners;
	//バナーを動かす
	//this.changeBannerBottom();
	//this.ctmtimeoutid = setInterval('bannerScroll.changeBannerBottom()', 50);
	this.changeSpeed('NS');
}
//バナーを動かす
bannerScroll.changeBannerBottom = function (){
	//バナースピードの変更
	//変化ゆっくり
	this.bannerSpeed = (this.bannerSpeed * 9 + this.bannerSpeedTo * 1) / 10;
	//端に来てたら元に戻す
	this.bannerPosition = this.bannerPosition % (this.bannerWidth * this.bannerItems * 1) + this.bannerWidth * this.bannerItems * 1;
	//バナーを表示
	this.bannerTargetElm.style.marginLeft =  Math.round(this.bannerPosition * -1) + 'px';
	this.bannerPosition = this.bannerPosition + this.bannerSpeed;
	//this.ctmtimeoutid = setTimeout('bannerScroll.changeBannerBottom()', 50);
}
//バナーのスピードを変える
bannerScroll.changeSpeed = function(speed){
	clearTimeout(this.ctmtimeoutid);
	this.bannerSpeedTo = this.bannerSpeedList[speed];
	//this.changeBannerBottom();
	this.ctmtimeoutid = setInterval('bannerScroll.changeBannerBottom()', 50);
}
//




var pickupBanner = new Object();
pickupBanner.init = function(n) {
	//サムネイル
	/*
	document.getElementById('navi_m_jogakuin').onmouseover = function(){pickupBanner.set('topPickup_j');},
	document.getElementById('navi_m_jogakuin').onmouseout = function(){pickupBanner.change('topPickup_j');}

	document.getElementById('navi_m_dental').onmouseover = function(){pickupBanner.set('topPickup_s');}
	document.getElementById('navi_m_dental').onmouseout = function(){pickupBanner.change('topPickup_s');}

	document.getElementById('navi_m_business').onmouseover = function(){pickupBanner.set('topPickup_b');}
	document.getElementById('navi_m_business').onmouseout = function(){pickupBanner.change('topPickup_b');}

	document.getElementById('navi_m_design').onmouseover = function(){pickupBanner.set('topPickup_d');}
	document.getElementById('navi_m_design').onmouseout = function(){pickupBanner.change('topPickup_d');}

	document.getElementById('navi_m_computer').onmouseover = function(){pickupBanner.set('topPickup_c');}
	document.getElementById('navi_m_computer').onmouseout = function(){pickupBanner.change('topPickup_c');}
*/
	document.getElementById('topthumb_001').onmouseover = function(){pickupBanner.set('topPickup_001');}
	document.getElementById('topthumb_001').onmouseout = function(){pickupBanner.change('topPickup_001');}

	document.getElementById('topthumb_002').onmouseover = function(){pickupBanner.set('topPickup_002');}
	document.getElementById('topthumb_002').onmouseout = function(){pickupBanner.change('topPickup_002');}

	document.getElementById('topthumb_003').onmouseover = function(){pickupBanner.set('topPickup_003');}
	document.getElementById('topthumb_003').onmouseout = function(){pickupBanner.change('topPickup_003');}
	
	//アニメーション用一覧作成。一覧はHTMLの [ #topPickup div.topPickupStage ] から持ってくる
	var stageDivElms = document.getElementById('topPickup').getElementsByTagName('div');
	var ii = 0;
	this.stageElms = new Array();
	this.stageElmsNo = new Array();
	for(var i = 0; i < stageDivElms.length; i++){
		if(stageDivElms[i].className == 'topPickupStage' && stageDivElms[i].id){
			this.stageElms[stageDivElms[i].id] = ii;
			this.stageElmsNo[ii] = stageDivElms[i].id;
			ii++;
			if(ieVersion > 0 && ieVersion < 9){
				stageDivElms[i].style.visibility = 'hidden';
			}else{
				stageDivElms[i].style.opacity = 0.0;
			}
		}
	}
	
	
	//最初に表示する内容セット
	this.elmNow = stageDivElms[0].id;
	this.set(this.elmNow);
	pickupBanner.change(this.elmNow);
	
}
pickupBanner.set = function(elm){
	clearTimeout(this.ctmtimeoutid);
	
	document.getElementById(this.elmNow).style.zIndex = 2;
	if(ieVersion > 0 && ieVersion < 9){
		//e8 filter
		document.getElementById(this.elmNow).style.filter = 'blendTrans(duration=0.2)'; 
		document.getElementById(elm).style.filter = 'blendTrans(duration=0.2)'; 
		
		document.getElementById(this.elmNow).style.visibility = 'visible';
		//document.getElementById(elm).style.visibility = 'hidden';
		
		document.getElementById(this.elmNow).filters.blendTrans.Apply(); 
		document.getElementById(elm).filters.blendTrans.Apply(); 
		
		document.getElementById(this.elmNow).style.visibility = 'hidden';
		document.getElementById(elm).style.visibility = 'visible';
		
		document.getElementById(this.elmNow).filters.blendTrans.Play(); 
		document.getElementById(elm).filters.blendTrans.Play();
		
	}else{
		//CSS3
		//前回分
		document.getElementById(this.elmNow).style.opacity = 0.0;
		//今回分
		document.getElementById(elm).style.opacity = 1.0;
	}
	document.getElementById(elm).style.zIndex = 3;
	document.getElementById('topPickup').onmouseover = function(){clearTimeout(pickupBanner.ctmtimeoutid);}
	document.getElementById('topPickup').onmouseout  = function(){pickupBanner.change(elm);}

	//document.getElementById(elm).onmouseover = function(){clearTimeout(pickupBanner.ctmtimeoutid);}
	//document.getElementById(elm).onmouseout  = function(){pickupBanner.change(elm);}

	this.elmNow = elm;
}

pickupBanner.change = function(elm){
	clearTimeout(this.ctmtimeoutid);
	pickupBanner.set(elm);
	this.elmNowNo = (this.stageElms[elm] + 1) % this.stageElmsNo.length;
	var elm = this.stageElmsNo[this.elmNowNo];
	this.ctmtimeoutid = setTimeout('pickupBanner.change("'+elm+'")', 6000);
}




var ieVersion = 0;
function getIeVersion(){
	document.write('<!--[if lt IE 6 ]><script type="text/javascript">ieVersion = 5;</script><![endif]-->');
	document.write('<!--[if IE 6 ]><script type="text/javascript">ieVersion = 6;</script><![endif]-->');
	document.write('<!--[if IE 7 ]><script type="text/javascript">ieVersion = 7;</script><![endif]-->');
	document.write('<!--[if IE 8 ]><script type="text/javascript">ieVersion = 8;</script><![endif]-->');
	document.write('<!--[if IE 9 ]><script type="text/javascript">ieVersion = 9;</script><![endif]-->');
	document.write('<!--[if gte IE 10 ]><script type="text/javascript">ieVersion = 10;</script><![endif]-->');
	return;
}
document.write('<!--[if IE ]><script type="text/javascript">getIeVersion();</script><![endif]-->');

function winopen(winname,url,w,h){
var winop=window.open(url,winname,'scrollbars=0,location=0,menubar=0,toolbar=0,width='+w+',height='+h+'');
}
