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 + "');";
		var newWinInnerfunc = "openNewWinInner('" + e.href + "');";

		if (e.className == "openNewWinO") {
			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;");
			}
		} else if (e.className == "openNewWin") {
			e.setAttribute("title","Open new window");
			if(body.getAttribute("style") == body.style) {
				e.setAttribute("onclick",new Function(newWinInnerfunc + "return false;"));
			} else {
				e.setAttribute("onclick",newWinInnerfunc + "return false;");
			}
		}
	}
}

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 openNewWinInner(url){
	var theWinInner=window.open(url,"Inner","toolbar=yes,scrollbars=yes,menubar=yes,location=yes,status=yes,directories=yes,resizable=yes");
	theWinInner.focus();
	targetWin=theWinInner;
	focusWin=setTimeout("activeWin()",1000);
	othrWin=theWinInner;
}

function activeWin(){
	clearTimeout(focusWin);
	targetWin.focus();
}


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 = "730px";
	}else{
//		contWidth = 0.96 * parentWidth - 230;
//		document.getElementById('contents').style.width = contWidth + "px";
		document.getElementById('contents').style.width = "auto";
	}
}


function resizeEv(){
	imgLayout=setTimeout("widthResizeH()",400);
	imgLayout=setTimeout("widthResizeC()",400);
}

function wResize(){
	resizeEv();
}

window.onresize = wResize;


