/*スパム対策*/
<!--
function vspam(im,domain) {
  maddress = "mailto:" + im + "@" + domain;
  window.location.href = maddress;
}
// -->

$(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;
			}
		}
 	});
	
	
	if($("#index").length ){
		$("#plArea li:last").addClass("last");
		$("#plArea span").hide();
		$("#plArea a").click(function() {
			return false;
		})
	}

	$("#hNav li:last").addClass("last");
	$("#breadList li:last").addClass("last");
	$("#fNav li:last").addClass("last");
	$(".entryList dd:last").addClass("last");
	

	//読み込み画像
	preload([
    	'imgs/shared/pagetop_on.gif'
	]);
	
	/*ナビゲーションアクティブ用　クソース*/
	var bodyIdName = $("body").attr('id');
	if(bodyIdName == "company"){
		$("#g01 img").attr("src","common/imgs/shared/gnav_01_on.jpg");
	}else if(bodyIdName == "consulting"){
		$("#g02 img").attr("src","common/imgs/shared/gnav_02_on.jpg");
	}else if(bodyIdName == "fmsp"){
		$("#g03 img").attr("src","common/imgs/shared/gnav_03_on.jpg");
	}else if(bodyIdName == "contact"){
		$("#g04 img").attr("src","common/imgs/shared/gnav_04_on.jpg");
	}
	
	var postfix = '_on';
	$('#gNav img, #hNav 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);
			}
		);
	});

		

	
});




//画像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();
}

