window.onload=autoPOP;

function autoPOP()
{
var x = document.getElementsByTagName('a');
for (var i=0;i<x.length;i++)
{
if (x[i].getAttribute('className') == 'popup' || x[i].getAttribute('class') == 'popup')
{
x[i].onclick = function () {
return winOpen(this.href)
}
x[i].title += '別窓で開きます';
}
}
};

function winOpen(url) {
window.open(
url,
'popup',
'width=500,height=810,scrollbars=1,resizable=1'
);

return false;
};


$(function(){
	$('a[@href~="web_book/"]').click(function(){
	var winname, opt;
	
	winname = "web_book";
	
	w = Math.round(window.screen.availWidth * 0.9);
	h = Math.round(window.screen.availHeight * 0.9);

	if (w > 1400) w = 1400;
	if (h >  900) h =  900;

	opt = new Array();
	opt.push("width=" + w);
	opt.push("height=" + h);
	opt.push("left=" + Math.round((window.screen.availWidth - w) * 0.5));
	opt.push("top=" + Math.round((window.screen.availHeight - h) * 0.3));
	opt.push("resizable=yes");
	opt = opt.join(",");
	
	window.open(this.href, winname,opt);
	return false;
	});
});