/*スパム対策*/
<!--
function vspam(im,domain) {
  maddress = "mailto:" + im + "@" + domain;
  window.location.href = maddress;
}
// -->

$(document).ready(function(){
	$('a[href*=#]').click(function() {
		if (location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'') && location.hostname == this.hostname) {
   			var $target = $(this.hash);
			$target = $target.length && $target || $('[name=' + this.hash.slice(1) +']');
   			if ($target.length) {
  				var targetOffset = $target.offset().top;
  				$('html,body')
  				.animate({scrollTop: targetOffset}, 1000);
    			return false;
			}
		}
 	});
	
	$("#breadList li:last").addClass("last");
	//$("#leftArea li:last").addClass("last");
	$("#fNav li:last").addClass("last");
	
	/*ナビゲーションライブ用　クソース*/
	var bodyIdName = $("body").attr('id');
	if(bodyIdName == "index"){
		$("#g01 img").attr("src","common/imgs/shared/gnav_nav01_on.jpg");
	}else if(bodyIdName == "course"){
		$("#g02 img").attr("src","common/imgs/shared/gnav_nav02_on.jpg");
	}else if(bodyIdName == "teacher"){
		$("#g03 img").attr("src","common/imgs/shared/gnav_nav03_on.jpg");
	}else if(bodyIdName == "facility"){
		$("#g04 img").attr("src","common/imgs/shared/gnav_nav04_on.jpg");
	}else if(bodyIdName == "abroad"){
		$("#g05 img").attr("src","common/imgs/shared/gnav_nav05_on.jpg");
	}else if(bodyIdName == "oc"){
		$("#g06 img").attr("src","common/imgs/shared/gnav_nav06_on.jpg");
	}else if(bodyIdName == "recruit"){
		$("#g07 img").attr("src","common/imgs/shared/gnav_nav07_on.jpg");
	}else if(bodyIdName == "faq"){
		$("#g08 img").attr("src","../common/imgs/shared/gnav_nav08_on.jpg");
	}

	var postfix = '_on';
	$('#gNav img, .over').not('[src*="'+ postfix +'."]').each(function() {
		var img = $(this);
		var src = img.attr('src');
		var src_on = src.substr(0, src.lastIndexOf('.'))
		           + postfix
		           + src.substring(src.lastIndexOf('.'));
		$('<img>').attr('src', src_on);
		img.hover(
			function() {
				img.attr('src', src_on);
			},
			function() {
				img.attr('src', src);
			}
		);
	});

//$("#courseNav dt img").rollover("#courseNav dt#"+bodyClassName+"LNav img");

	//読み込み画像
	preload([
    	'imgs/shared/pagetop_on.gif'
	]);
	
});


//画像preload
function preload(arrayOfImages) {
    $(arrayOfImages).each(function(){
        $('<img/>')[0].src = this;
        // Alternatively you could use:
        // (new Image()).src = this;
    });
}

function popupWin(url,wx,wy,wName){
	st = "scrollbars=yes,resizable=no,toolbar=no,directories=no,location=no,menubar=no,status=no";
	if(wy == ''){
		wy = screen.height - (screen.height*0.15);
	}
	x = (screen.width  - wx) / 2;
	y = ((screen.height - wy) / 2) - 30;
	newwin = window.open(url,wName,"left="+x+",top="+y+",width="+wx+",height="+wy+","+st);
	newwin.focus();
}
