// JavaScript Document

function FirstScreen(){
	var box = "box_0";
	divObj = document.getElementsByTagName('div');
	matchDivObj= new RegExp(box);
	for(i=0; i < divObj.length; i++){
		if(divObj[i].id.match(matchDivObj)){
			divObj[i].style.display = 'none';
		}
	}
	
	var box00 = "box_00";
	bElements00 = document.getElementById(box00);
	if(bElements00 != null){
		bElements00.style.display = 'block';
	}
}

//クリック
function ClickBox(id,cid){
	SelectReSet();
	ShowObj(id,cid);
}

//全てリセット
function SelectReSet(){
	var box = "box_0";
	divObj = document.getElementsByTagName('div');
	matchDivObj= new RegExp(box);
	for(i=0; i < divObj.length; i++){
		if(divObj[i].id.match(matchDivObj)){
			divObj[i].style.display = 'none';
		}
	}
	
	var change = "change0";
	liObj = document.getElementsByTagName('li');
	matchLiObj = new RegExp(change)
	for(j=0; j < liObj.length; j++){
		if(liObj[j].id.match(matchLiObj)){
			liObj[j].className = '';
		}
	}
	
}

//タブ選択、任意のボックス表示
function ShowObj(id,cid){
	bElements = document.getElementById(id);
	cElements = document.getElementById(cid);
	if(bElements != null){
		bElements.style.display = 'block';
		cElements.className = 'news_tabli';
	}
}

function ClickBox02(id){
	SelectReSet02();
	ShowObj02(id);
}

function SelectReSet02(){
	hideObj02('box_00');
	hideObj02('box_01');
	hideObj02('box_02');
	hideObj02('box_03');
	hideObj02('box_04');
}

function ShowObj02(id){
	bElements = document.getElementById(id);
	if(bElements != null){
		bElements.style.display = 'block';
	}
}

function hideObj02(id){
	bElements = document.getElementById(id);
	if(bElements != null){
		bElements.style.display = 'none';
	}
}



var SelectImg;
var defaultImg = "news_menu01_out";

function smartRollover2() {
	if(document.getElementsByTagName) {
        var images = document.getElementsByTagName("img");
        for(var i=0; i < images.length; i++) {
            //デフォルト
			if(images[i].getAttribute("src").match("news_menu01_out.jpg")){
				SelectImg = images[i];
			}
			
			if(images[i].getAttribute("src").match("_out.")){
                images[i].onmouseover = function() {
					//オーバー時
					this.setAttribute("src", this.getAttribute("src").replace("_out.", "_over."));
                }
				images[i].onclick = function() {
					if(SelectImg != null){
						SelectImg.setAttribute("src", SelectImg.getAttribute("src").replace("_over.", "_out."));
					}
					SelectImg = this;
					hideObj02('box_00');
					hideObj02('box_01');
					hideObj02('box_02');
					hideObj02('box_03');
					hideObj02('box_04');
					ShowObj02(this.id.replace("switch_btn_", "box_"))
				}
                images[i].onmouseout = function() {
                    if(this != SelectImg){
						this.setAttribute("src", this.getAttribute("src").replace("_over.", "_out."));
					}
                }
				images[i].onUnload = function() {
                    if(this != SelectImg){
						this.setAttribute("src", this.getAttribute("src").replace("_over.", "_out."));
					}
                }
            }
        }
		SelectImg.setAttribute("src", SelectImg.getAttribute("src").replace("_out.", "_over."));
    }
	
}

if(window.addEventListener) {
    window.addEventListener("load", smartRollover2, false);
}else if(window.attachEvent) {
    window.attachEvent("onload", smartRollover2);
}




