﻿/*ページのトップへスクロールして移動*/
function setGoTop() {
	var aTagList = document.getElementsByTagName('a');
	for (var i = 0; i < aTagList.length; i++) {
		if (aTagList[i].href.match(/#top/i)) {
			aTagList[i].onclick = goPageTop;
		}
	}
}
var goTopMove = 15; // 加速度（0:停止〜大きいほど遅くなる）
var goTopPosi;
function goPageTop() { // 距離取得と実行
	var yPos = document.body.scrollTop || document.documentElement.scrollTop;
	mObj(yPos);
	return false;
}
function mObj(y, s) { // 上に加速移動
	if (s) goTopMove = s;
	goTopPosi = parseInt(y - y * 2 / goTopMove);
	scrollTo(0, goTopPosi);
	if (goTopPosi > 0) setTimeout('mObj(goTopPosi, goTopMove)', 1);
}
if (window.addEventListener) window.addEventListener('load', setGoTop, false);
if (window.attachEvent) window.attachEvent('onload', setGoTop);



/*rollover*/

var preLoadImg = new Object();

function initRollOvers(){

	$("img.imgover").each(function(){
		var imgSrc = this.src;
		var sep = imgSrc.lastIndexOf('.');
		var onSrc = imgSrc.substr(0, sep) + '_on' + imgSrc.substr(sep, imgSrc.length-sep);
		preLoadImg[imgSrc] = new Image();
		preLoadImg[imgSrc].src = onSrc;
		$(this).hover(
			function() { this.src = onSrc; },
			function() { this.src = imgSrc; }

		);

	});

}

$(function(){
	initRollOvers();
});


/*Div全体をクリックできるようにする*/
$(function(){
     $(".subnavibox01,.pagetop,.bigtarget li,.bigtarget .contbox").click(function(){
         window.location=$(this).find("a").attr("href");
         return false;
    });
});

/*aタグの点線を消す*/jQuery(document).ready(function($) {
	$('a').focus(function(){this.blur();});
});


// Open the new window
function openNW(theURL,winName,features) {
  window.open(theURL,winName,features);
}

