// JavaScript Document
$(document).ready(function(){
	$("img[src*='_off.']").rollOver();
	$("button").rollOver("img");
	$("a.pn[href^='#']").smScroll({speed:800, easing:"easeOutCubic"});
	$(".ar").alphaRo({from:1, to:0.8, group:false});
	$(".arg").alphaRo({from:1, to:0.8, group:true});
	$("dl#t_changer dd a").fontChanger({"medium":12, "big":14});
	$("a[rel='jump'], area[rel='jump']").anotherWin({width:650});
	$("a[rel='jump2']").anotherWin({width:1000});
	$("a[rel='jumpV']").anotherWin({width:740});
	$("a[rel='jumpArea']").anotherWin({width:1200, name:"areaWindow"});
});

jQuery.fn.extend({
	fontChanger : function(size) {
		var menu = $(this);
		$(this).click(function() {
			var hash = getHash( $(this).attr("href") );
			$("body").css("font-size", size[hash]);
			$.cookie("nouhiFont", hash, {path:'/'});
			
			menu.find("img").rollOver().trigger("mouseleave");
			$(this).find("img").trigger("mouseenter").unbind("mouseenter").unbind("mouseleave");
			return false;
		});
		function getHash(url) {
			return url.split("#")[1];
		}
	
		var ck = $.cookie("nouhiFont");
		if( ck ) {
			menu.filter("[href*='"+ck+"']").trigger('click');
		} else {
			menu.eq(0).trigger('click');
		}
	}
});
