function openwin(url) {
	new_win = window.open(url,"new_win","toolbar=1,location=1,directories=1,status=1,menubar=1,scrollbars=1,resizable=1");
	new_win.focus();
}

function openpop(url) {
	new_pop = window.open(url,"new_pop","width=760,height=630,toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=0");
	new_pop.focus();
}

var scrj = 1;
function ScrollBackTop() {
	if(navigator.appName == "Microsoft Internet Explorer" && document.compatMode == "CSS1Compat") {
		var scdist = document.body.parentNode.scrollTop;
	} else {
		var scdist = document.body.scrollTop;
	}
	if(scrj<50 && scdist) {
		scdist = (scdist>2) ? Math.ceil(scdist*.2) : 1;
		scrj++;
		scrollBy(0,-scdist);
		setTimeout("ScrollBackTop()",20);
	} else {
		scrollTo(0,0);
		scrj = 1;
	}
}






$(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) +']');
	//		
	//		var targetOffset = 0;
	//		if ($target.length) {
	//			if(this.hash.slice(1).length != 0){
	//				targetOffset = $target.offset().top;
	//			}
	//		}
	//		$('html,body').animate({scrollTop: targetOffset}, 400, 'easeOutSine');
	//		return false;
	//	}
	//});

	//ホバー
	var postfix = '_a';
	$('#nav a img').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.hover(function() {
			img.attr('src', src_on);
		}, function() {
			img.attr('src', src);
		});
	});
});


$(window).scroll(function(){
		  var offset = $('body').height() - $('.info').height() -500;

	 if ($(window).scrollTop() < 370) {
		  $('.info').css({
				top: '0',
				position: 'relative'
		  });
	 }else if($(window).scrollTop() > offset) {
		  $('.info').css({
				top: (offset - 370),
				position: 'relative'
		  });
	 }else {
		  $('.info').css({
				top: '10px',
				position: 'fixed'
		  });
	 }
});

$(function(){
	 $("#home_news > article > h2").click(function () {
		  $("+ div",this).slideToggle(350);
	 });  
});




