var Navigation = function() {
};//コンストラクタ
Navigation.prototype = {

	imgs:[],
	selectedImgs:[],
		
    /** init:テンプレートのHTMLファイルを読込み  */
	init:function(){
		imgs = $("img",$("li",$("#navi")).not(".selected"));
		selectedImgs = $('img',$('.selected',$("#navi")));
		this.preloadImages();
		this.setOverAction();
		this.setSelected();
		this.setScroll();
		this.pngFix();
	},
	
	init_top:function(){
		$("#mainvisual img").pngfix();
	},
	
	setScroll:function(){
		$("a",$("#contents_bottom")).click(function(){
			$(document).scrollTo({top:0,left:0},500);
			return false;
		});
	},
	
	pngFix:function(){
		$("#search").pngfix();
		selectedImgs.pngfix();
	},
	
	preloadImages:function(){
		$(imgs).each(function(){
			var preload = new Image;
			var img = $("img",this);
			preload.src = this.src.replace(/^(.+)(\.[a-z]+)$/, "$1_over$2");
		})
	},
	
	setOverAction:function(){
		$(imgs)
			.bind("mouseover",function(){
				this.src = this.src.replace(/^(.+)(\.[a-z]+)$/, "$1_over$2");
			})
			.bind("mouseout",function(){
				this.src = this.src.replace(/^(.+)_over(\.[a-z]+)$/, "$1$2");
			})
			.pngfix({mouseover:true,overimagePath:"_over"});	
	},
	
	setSelected:function(){
		$(selectedImgs).each(function(){
			var img = $(this);
			img.unbind("mouseover").unbind("mouseout");
			img.attr("src",img.attr("src").replace(/^(.+)(\.[a-z]+)$/, "$1_down$2"));
		});
	}
	
};
