var followingMenu = new Class({
	initialize: function(menu, stage){
		this.menu = menu;
		startMargin = this.menu.getStyle('margin-top').toInt();
		stageHeight = window.getScrollHeight();
		this.move.bind(this).periodical(500);
		startTop = this.menu.offsetTop.toInt();
	},
	move: function() {
		this.top = window.getSize().scroll.y;
		menuHeight = this.menu.getStyle('height').toInt();
		menuBottom = this.top + menuHeight;
		var patternEffect = this.menu.effect("margin-top",{duration:500, wait:false, transition: Fx.Transitions.backOut});
		if (this.top < startTop) {
			patternEffect.start(startMargin);
		}
		else if(stageHeight < this.top + menuHeight + startTop/2 ) {
			patternEffect.stop();
		}
		else {
			patternEffect.start(this.top - startTop + 10);
		}
	}
});
followingMenu.implement(new Events, new Options);

window.addEvent('domready', function() {
//ページ読み込み時のスタイル設定
$$('.dn').setStyle('display','none');
$$('.imgreplace','a.prev','a.next').setStyle('text-indent','-9999px');
//Tips初期設定
new Tips($$('.tips'));
//DisableOutlineの設定
disable_links_outline();
});

//リンクの点線(クリックフォーカス)を消す
function disable_links_outline() {
var blur = function () { this.blur() };
for (var i = 0; i < document.links.length; i++)
document.links[i].onfocus = blur;
}
