// JavaScript

$(function(){
	
	$('#pastpictures').hide();
	$('#nowpictures').hide();
	$('#futurepictures').hide();
	
	$('#pastpicturebutton').click(function(){
		$('#pastpictures').slideDown();
		$('#nowpictures').slideUp();
		$('#futurepictures').slideUp();
	});
	
	$('#nowpicturebutton').click(function(){
		$('#pastpictures').slideUp();
		$('#nowpictures').slideDown();
		$('#futurepictures').slideUp();
	});
	
	
	$('#futurepicturebutton').click(function(){
		$('#pastpictures').slideUp();
		$('#nowpictures').slideUp();
		$('#futurepictures').slideDown();
	});
	
	
	// ポップアップウィンドウ
	var anchors = document.getElementsByTagName('a');
	for (var i=0; i<anchors.length; i++) {
		var classValue = null;
		if (anchors[i].getAttribute('className'))
			classValue = anchors[i].getAttribute('className');
		else if (anchors[i].getAttribute('class'))
			classValue = anchors[i].getAttribute('class');
		if (classValue && classValue == 'popup') {
			anchors[i].onclick = function() {
				openpopup(this.href);
				return false;
			};
		}
	}
	
});


// Open Popup Window
var popupwindow;
function openpopup(url) {

	var width = 560;
	var height = 530;

	var left = (screen.width - width) / 2;
	var top =  (screen.height - height) / 2;
	
	if (popupwindow) {
		if(!popupwindow.closed) popupwindow.close();
	}
	
	var option = 'scrollbars=yes,resizable=yes,copyhistory=yes,width='+width+',height='+height+',left='+left+',top='+top+',screenX='+left+',screenY='+top+'';
	popupwindow = window.open(url, 'popupwindow', option);
	
	return false;
}


