//イベントリスナーの拡張セット
var event = new Object();

event.addEventListener = function(element, type, func, useCapture) {
	if(! element) { return false; }
	if(! useCapture) {
		useCapture = false;
	}
	if(element.addEventListener) {
		element.addEventListener(type, func, false);
	} else if(element.attachEvent) {
		element.attachEvent("on"+type, func);
	} else {
		return false;
	}
	return true;
};

//イベントの実行
event.addEventListener(window,"load",initDocument);

function initDocument() {
	
	var openWin = document.getElementById('openWin');
	var newsWin = document.getElementById('newsWin');
	var infoWin = document.getElementById('info');
	
	openWin.onclick = newsWin.onclick = function() {
		popUp('limitation.html','540','480','limit');
	}
	
	var notationWin = document.getElementById('notation');
	
	notationWin.onclick = function() {
		popUpapp('apology.html','640','480','limit');
	}

}

function popUp(url, width, height, name) {
	var centerWidth = screen.availWidth/2;
	var centerHeight = screen.availHeight/2;
	var wOption = "scrollbars=no,resizable=no,width="+width+",height="+height+",left="+(centerWidth-(width/2))+",top="+(centerHeight-(height/2));
	
	var newWindow = window.open(url, name, wOption);
	newWindow.focus();
}

function popUpapp(url, width, height, name) {
	var centerWidth = screen.availWidth/2;
	var centerHeight = screen.availHeight/2;
	var wOption = "scrollbars=yes,resizable=no,width="+width+",height="+height+",left="+(centerWidth-(width/2))+",top="+(centerHeight-(height/2));
	
	var newWindow = window.open(url, name, wOption);
	newWindow.focus();
}


function closeWindow() {
	newWindow = window.close();
}
