

$(function(){
// begin //

var agent = navigator.userAgent.toLowerCase() ;
var mac_os = agent.indexOf("mac") != -1 ;
if(mac_os && $.browser.mozilla){
	$('body').css({letterSpacing:'0.02em'});
}


// photoboxのwidth設定
$(".campus.facilities .photobox").each(function(){
	var phtboxwidth = $("img.photo",this).width()+"px";
	$(this).css("width",phtboxwidth);
});


// プルダウン汎用
$(".pulldown").each(function(){
	$(this).hover(function(){
		$(".sub-nav:not(:animated)",this).slideDown("fast");
	},
	function(){
		$(".sub-nav",this).slideUp("fast");
	});
});


// first-childをIE6で有効にする
// if($.browser.msie && $.browser.version<7){
// 	$("body.campus.facilities .photobox-wrapper:first-child").css("margin","0");
// }


// リンクの点線を消す
$("a").focus(function(){
	this.blur();
});


// ロールオーバー　information
$(".information #navblock #year a.rollover").mouseover(function(){
	$(this).css("background","#ff0");
	$("span.marker",this).css("color","#ff0");
}).mouseout(function(){
	$(this).css("background","none");
	$("span.marker",this).css("color","#e6e6e6");
}).mousedown(function(){
	$(this).css("background","#ff0");
	$("span.marker",this).css("color","#ff0");
}).mouseup(function(){
	$(this).css("background","none");
	$("span.marker",this).css("color","#e6e6e6");
});

// ロールオーバー　オーバー時の画像名に_ovを付ける
$("img.rollover").mouseover(function(){
	$(this).attr("src",$(this).attr("src").replace(/^(.+)(\.[a-z]+)$/, "$1_ov$2"));
}).mouseout(function(){
	$(this).attr("src",$(this).attr("src").replace(/^(.+)_ov(\.[a-z]+)$/, "$1$2"));
}).mousedown(function(){
	$(this).attr("src",$(this).attr("src").replace(/^(.+)_ov(\.[a-z]+)$/, "$1_ov$2"));
}).mouseup(function(){
	$(this).attr("src",$(this).attr("src").replace(/^(.+)_ov(\.[a-z]+)$/, "$1$2"));
}).each(function(){
	$("<img>").attr("src",$(this).attr("src").replace(/^(.+)(\.[a-z]+)$/, "$1_ov$2"));
});


var basesrc = $("html script[src*='common']").attr("src");
var path = basesrc.substr(0, basesrc.lastIndexOf('common'));
var spacegif = path+"common/img/space.gif";

// pngロールオーバー　オーバー時の画像名に_ovを付ける
$("img.pngrollover").each(function(){
	$("<img>").attr("src",$(this).attr("src").replace(/^(.+)(\.[a-z]+)$/, "$1_ov$2"));
});

if($.browser.msie && $.browser.version<7){
	$("img.pngrollover").each(function(){
		$(this)
			.data("src",$(this).attr("src"))
			.attr("src",spacegif)
			.css("filter","progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+$(this).data("src")+"',sizingMethod='scale')");
	}).mouseover(function(){
		$(this).css("filter","progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+$(this).data("src").replace(/^(.+)(\.[a-z]+)$/, "$1_ov$2")+"',sizingMethod='scale')");
	}).mouseout(function(){
		$(this).css("filter","progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+$(this).data("src")+"',sizingMethod='scale')");
	}).mousedown(function(){
		$(this).css("filter","progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+$(this).data("src").replace(/^(.+)(\.[a-z]+)$/, "$1_ov$2")+"',sizingMethod='scale')");
	}).mouseup(function(){
		$(this).css("filter","progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+$(this).data("src")+"',sizingMethod='scale')");
	});
	
}else{
	$("img.pngrollover").mouseover(function(){
		$(this).attr("src",$(this).attr("src").replace(/^(.+)(\.[a-z]+)$/, "$1_ov$2"));
	}).mouseout(function(){
		$(this).attr("src",$(this).attr("src").replace(/^(.+)_ov(\.[a-z]+)$/, "$1$2"));
	}).mousedown(function(){
		$(this).attr("src",$(this).attr("src").replace(/^(.+)_ov(\.[a-z]+)$/, "$1_ov$2"));
	}).mouseup(function(){
		$(this).attr("src",$(this).attr("src").replace(/^(.+)_ov(\.[a-z]+)$/, "$1$2"));
	});
}


// pngロールオーバーなし　imgクラス名png
if($.browser.msie && $.browser.version<7){
	$(".png").each(function(){
		$(this)
			.data("src",$(this).attr("src"))
			.attr("src",spacegif)
			.css("filter","progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+$(this).data("src")+"',sizingMethod='scale')");
	});
}


// ページトップへほかアンカーリンクのスムーズスクロール
$("a[href^='#'],area[href^='#']").click(function(){
if($.browser.msie && $.browser.version<7){
	$('html,body').animate({ scrollTop: $($(this).attr("href")).offset().top-15},"slow","swing");
	return false;
}else{
	$('html,body').animate({ scrollTop: $($(this).attr("href")).offset().top},"slow","swing");
	return false;
}
});

// end //
});




