
$(function(){
	
	// scroll top
	$('.pagetop a').click(function() {
			$(this).blur();
			$('html ,body').animate({ scrollTop: 0 }, 'fast');
			return false;
	});

	// chart menu
	$('#chart p').hide();
	$('#chart p#all').show();
	$('#chart ul li.all a, #chart ul li.men a, #chart ul li.women a').click(function(){
		var btnNm = $(this).parent().attr('class');
		if(btnNm != 'download'){
		$('#chart p').hide();
		$('#chart p#' +btnNm).fadeIn(500);
		}else{
		}
		return false;
	});
	
	// research_examples
	$('#research_examples li img.answer').hide();
	$('#research_examples li a').click(function(){
		$('img.question',$(this).parent()).hide();
		$('img.answer',$(this).parent()).show();
		return false;
	});
		
		// コンテンツ高さ調整
		changeContheight();

	
});

// content height +1
function changeContheight(){
	var contHeight = $('#content_bt').height();
	var bheight = contHeight % 2;

	if(bheight == 0){
		
		//エージェントがIEかどうか判別
		var browser = typeof(document.body.style.maxHeight);
		
		if(browser != 'undefined'){ //IE6以外だったら
			$('#content_bt').css('min-height',contHeight + 1);
		}else{ //IE6だったら
			//#content_btの高さが偶数だった場合に、1px追加する
			$('#content_bt').css('height', contHeight+1);
		};

	};
}


// popup

function openWindow(theURL, width, height, features, winName) { //v2.0
	if(typeof(width) == "undefined" || width == 0){
		width = 500;
	}
	
	if(typeof(height) == "undefined" || height == 0){
		height = 500;
	}
	
	if(typeof(features) == "undefined" || features == ""){
		features = "status=yes,menubar=no,scrollbars=yes,resizable=yes";
	}
	
	features = features + ', width = ' + width + ', height = ' + height;
	
  window.open(theURL,winName,features);
}
