//// ============================//  file name : common.js//  author : staff015// ============================///////////////////////////////////////////////////////////////////////////////////////////// smartScroll 1.7function smartScroll (){		var allLinks = new Array();	var as = document.getElementsByTagName('a');	var areas = document.getElementsByTagName('area');	for (var i=0; i<as.length; i++){		allLinks.push(as[i]);	}	for (var i=0; i<areas.length; i++){		allLinks.push(areas[i]);	}		for (var i=0;i<allLinks.length;i++)	{		var lnk = allLinks[i];				if ((lnk.href && lnk.href.indexOf('#') != -1) && ((lnk.pathname == location.pathname) || ('/'+lnk.pathname == location.pathname)))		{			var myHash = lnk.hash.replace(/#/g,"");			if (!(myHash.length == 0)) //hrefが"#"だった場合は処理を中止			{				lnk.onclick = function ()				{					//移動先のid名を取得					var hash = this.hash;					var targetId = hash.replace(/#/g,"");									if (!document.getElementById(targetId)) return;										//移動先の位置（y座標）					if (document.all)					{						var element = document.getElementById(targetId);						var targetY = 0;						do						{							targetY += element.offsetTop || 0;						} while (element = element.offsetParent);					} else {						var targetY = document.getElementById(targetId).offsetTop;					}										var scrollTop = document.body.parentNode.scrollTop || window.pageYOffset || document.body.scrollTop; //現在の表示位置（y座標）										//スクール量の調整								var windowHeight = window.innerHeight || document.documentElement.clientHeight; //ウィンドウの高さ						var bodyHeight = document.body.offsetHeight; //bodyの高さ					var footHeight = bodyHeight - targetY;					var adjust = windowHeight - footHeight;											//移動距離を計算					if (windowHeight > footHeight)					{										var toY = targetY - scrollTop - adjust;					} else					{						var toY = targetY - scrollTop;					}										function windowScroll ()					{						var moveY = Math.floor(toY*.2);											window.scrollBy(0,moveY);						toY -= moveY; 						myTimer = setTimeout(windowScroll,30);						if (moveY == 0) clearTimeout(myTimer);					}													windowScroll();						return false;				};			}		}	}	}/////////////////////////////////////////////////////////////////////////////////////////function init(){	smartScroll();}//addLoadEventfunction addLoadEvent(func) {	if (typeof window.addEventListener == 'function') {		window.addEventListener('load', func, false);		return true;	} else if (typeof window.attachEvent == 'object') {		window.attachEvent('onload', func);		return true;	}		var oldonload = window.onload;	if (typeof window.onload != 'function') {		window.onload = func;	} else {		window.onload = function() {			oldonload();			func();		}	}}addLoadEvent(init);
