
str0 = 'The National DietLibrary\'s online exhibition \"Birth of the Constitution of Japan\" presents the major events and important documents involved in the framing and enactment of Japan\'s Constitution.The exhibition was updated on May 3, 2004 with the addition of 81 new documents and a new section of main issues.';
str1 = 'The five-part Outline consists of brief descriptions of activities from the end of the war to the promulgation and enactment of the Constitution.You can expand your knouledge of the circumstances leading up to the enactment of the Consutitution and understand the significance of each document in the process.';
str2 = 'In the Cocuments with Commentaries section,there are now 180 documents accompanied by explanations of the roles they played in the enactment of the Constitution.Looking at these documents will provide insight into the dedication of the people involved in establishing the Constitution of Japan.';
str3 = 'The Main Issues section introduces the series of events and various arguments surrounding the enactment of Japan\'s Constitution including such major issuees as the renunciation of war and the bicameral system.Links have been embedded in the documents so you can quickly refer to the actual documents or commentaries being discussed.';

function disc(btName) {
	var writePlace = document.getElementById('writeArea');
	if(btName == 'bt01'){
		writePlace.innerHTML = str1;
	} else if(btName == 'bt02') {
		writePlace.innerHTML = str2;
	} else {
		writePlace.innerHTML = str3;
	}
}

function remove() {
	var writePlace = document.getElementById('writeArea');
	writePlace.innerHTML = str0;
}

function preload(){
	var body=document.getElementsByTagName('body')[0];
	var url1=document.getElementById('ndl');
	url1.setAttribute("title","Open new window");
	var pth1=url1.getAttribute("href");
	var cmd1='javascript:openWin("'+pth1+'")';
	url1.setAttribute("href",cmd1);
	var url2=document.getElementById('gallery');
	url2.setAttribute("title","Open new window");
	var pth2=url2.getAttribute("href");
	var cmd2='javascript:openWin("'+pth2+'")';
	url2.setAttribute("href",cmd2);

	var anchers = document.getElementsByTagName('a');
	for (var i = 0; i < anchers.length; i++) {
		var e = anchers[i];

		var newWinfunc = "openNewWin('" + e.href + "');";
		if (e.className == "openNewWin") {
			e.setAttribute("title","Open new window");
			if(body.getAttribute("style") == body.style) {
				e.setAttribute("onclick",new Function(newWinfunc + "return false;"));
			} else {
				e.setAttribute("onclick",newWinfunc + "return false;");
			}
		}
	}
}

// New window script

function openWin(url){
	theWin=window.open(url,"other","toolbar=yes,scrollbars=yes,menubar=yes,location=yes,status=yes,directories=yes,resizable=yes");
	theWin.focus();
}

function openNewWin(url){
	var theWin=window.open(url,"other","toolbar=yes,scrollbars=yes,menubar=yes,location=yes,status=yes,directories=yes,resizable=yes");
	theWin.focus();
	targetWin=theWin;
	focusWin=setTimeout("activeWin()",1000);
	othrWin=theWin;
}

function activeWin(){
	clearTimeout(focusWin);
	targetWin.focus();
}


//  Layout script

var imgLayout="";

function widthResizeH(){
	var parentWidth=document.body.clientWidth;
	if (parentWidth > 1000){
		document.getElementById('headNavi').style.width = "960px";
	}else{
		document.getElementById('headNavi').style.width = "96%";
	}
}

function widthResizeC(){
	var parentWidth=document.body.clientWidth;
	if (parentWidth > 1000){
		document.getElementById('contents').style.width = "960px";
	}else{
		document.getElementById('contents').style.width = "96%";
	}
}


function resizeEv(){
	imgLayout=setTimeout("widthResizeH()",400);
	imgLayout=setTimeout("widthResizeC()",400);
}

function wResize(){
	resizeEv();
}

window.onresize = wResize;
