function selectBox(num) {
    var path=window.location.href;
    var fileName=path.substring(path.lastIndexOf('/',path.length)+1,path.length);
    var splitter = new Array('_', '-');
    var thissplit = '';
    for(i = 0;i < splitter.length;i++){
	if (fileName.indexOf(splitter[i]) > 0){
	    thissplit = splitter[i];
	    break;
	}
    }
    if (thissplit != ''){
	var temp = fileName.split(thissplit);
	var before = temp[0];
	var after = temp[1];
    } else {
	var before = '';
	var after = fileName;
    }
    after = after.replace('.html', '');
    var num2 = after.match(/[0-9]+/);
    var alpha = after.match(/[A-Za-z]+/);
    after = num2[0];
    // fileName = before + thissplit + after + alpha + '.html';

    var opt = '';
    for ( i = 1 ; i <= num ; i++ ) {
	if (i < 10) {
	    ico = '0' + i;
	    add = '0';
	}else if (i < 100){
	    ico = '' + i;
	    add = '0';
	}else{
	    ico = i;
	    add = '';
	}
	if (add + ico == after) {
	    opt += '<option value="' + before + thissplit + add + ico + alpha + '.html' + '" selected="selected">' + ico + '</option>';
	}else{
	    opt += '<option value="' + before + thissplit + add + ico + alpha + '.html' + '">' + ico + '</option>';
	}
    }
    document.write(
	'<form action="#"><select name="jump">' + opt + '</select>' + '<span class="deno">/' + num +
	'</span><input type="button" value="&nbsp;Go&nbsp;" onclick="location.href = this.form.jump.options[jump.selectedIndex].value;" /></form>'
	);
}


window.onload = function() {
    if(document.getElementById('large')){
		imgWidth = document.getElementById('imgArea').getElementsByTagName('img')[0].width;
		if(document.body.clientWidth < imgWidth){
			areaWidth = imgWidth + 20;
			document.getElementById('wrap').style.width = areaWidth + 'px';
			document.getElementsByTagName('address')[0].style.width = areaWidth + 'px';
		}
	} else if(document.getElementById('what')){
		imgWidth = document.getElementById('whatImg').getElementsByTagName('img')[0].width;
		document.getElementsByTagName('address')[0].style.width = imgWidth + 'px';
	}
}


function widthResizeA(){
    parentWidth=document.body.clientWidth;
    if (parentWidth < 770) {
	document.getElementById('wrap').style.width = '767px';
    } else {
	document.getElementById('wrap').style.width = 'auto';
    }
}

function widthResizeB(){
    parentWidth=document.body.clientWidth;
    if (parentWidth < 770) {
	document.getElementById('imgArea').style.width = '767px';
    } else {
	document.getElementById('imgArea').style.width = 'auto';
    }
}

function widthResizeC(){
    parentWidth=document.body.clientWidth;
    if (parentWidth < 770) {
	document.getElementsByTagName('address')[0].style.width = '767px';
    } else {
	document.getElementsByTagName('address')[0].style.width = 'auto';
    }
}

function resize(){
    imgLayout=setTimeout("widthResizeA()",400);
    imgLayout=setTimeout("widthResizeB()",400);
    imgLayout=setTimeout("widthResizeC()",400);
}

function imgResize(){
    bodyId = document.getElementsByTagName('body')[0].getAttribute('id');
    if(bodyId == 'regular' || bodyId == 'text'){
	resize();
    }
}

window.onresize = imgResize;



function closeWin(){
    document.write('<a href=\"#\" onclick=\"window.close()\;return false\;\">Close<\/a>');
	lists = document.getElementsByTagName('li');
	try{
		for( i = 1 ; i <= lists.length ; i++ ){
			list = lists[i];
			if(list.className == 'btClose'){
				list.style.background = 'url(../../common/img/imagenavi_close.gif) no-repeat left center';
			}
		}
	}catch (e){
	}
}

function disp(url){
    try{
	if(!window.opener || window.opener.closed){
	    var newMainWin = window.open(url, "main", "location=1, toolbar=1, menubar=1, status=1, scrollbars=1, resizable=1, titlebar=1, directories=1");
	    newMainWin.focus();
	}
	else{
	    opener.window.focus();
	    opener.window.location = url;
	    opener.window.focus();
	}
    }
    catch (e){
	try{
	    opener.window.focus();
	    opener.window.location = url;
	    opener.window.focus();
	} catch(err) {
	    var theWin = window.open(url, "opener", "location=1, toolbar=1, menubar=1, status=1, scrollbars=1, resizable=1, titlebar=1, directories=1");
	    theWin.window.focus();
	}
    }
}
