// <![CDATA[

BackButtonImage = new Image();
BackButtonImage.src = "./image/back_over.gif";
var ScrH;
var ScrW;
var KumamotoAccount = "&#x69;&#x6e;&#x66;&#x6f;";
var TokyoAccount = "&#x69;&#x74;&#x6f;&#x68;";
var Domain = "&#x39;&#x64;&#x65;&#x73;&#x69;&#x67;&#x6e;&#x2e;&#x6a;&#x70;";
var KumamotoMail = '<a href="mailto:'+KumamotoAccount+'&#64;'+Domain+'" class="txt">'+KumamotoAccount+'&#64;'+Domain+'</a>';
var TokyoMail = '<a href="mailto:'+TokyoAccount+'&#64;'+Domain+'" class="txt">'+TokyoAccount+'&#64;'+Domain+'</a>';
window.onresize = pageMove;
var carentHash;
var IEflagCheck = 1;
var pageFlag = false;

if(window.addEventListener){
	window.addEventListener("load",jsLink, false);
}else if(window.attachEvent){
	window.attachEvent("onload",appendIframe);
	window.attachEvent("onload",jsLink);
}else{
	window.onload = jsLink;
}

function jsLink(){
	a=document.getElementsByTagName("a");
	for(i=0;i<a.length;i++){
		a[i].onfocus=function(){this.blur();}
	}
	input=document.getElementsByTagName("input");
	for(i=0;i<input.length;i++){
		input[i].onfocus=function(){this.blur();}
		input[i].onmouseover=function(){this.setAttribute('src', '/image/next_on.gif');}
		input[i].onmouseout=function(){this.setAttribute('src', '/image/next.gif');}
	}
	var KeyName = 'over';
	var AddOn = '_on';
	var ChangeSrc;
	var overImages = document.getElementsByTagName('img');
	var imgPreLoad = new Array();
	for (i=0;i< overImages.length;i++){
		if(overImages[i].className == KeyName){
			var temp = overImages[i];
			var src = temp.src;
			var FileType = src.substring(src.lastIndexOf('.'));
			var name = src.substring(0,src.length - FileType.length);
			var overSrc = name + AddOn + FileType;
			overImages[i].setAttribute('overSrc', overSrc);
			imgPreLoad[i] = new Image();
			imgPreLoad[i].src = overSrc;
			overImages[i].onmouseover = function(){
				ChangeSrc = this.getAttribute('src');
				this.setAttribute('src', this.getAttribute('overSrc'));
			}
			overImages[i].onmouseout = function(){
				if (!ChangeSrc) ChangeSrc = this.getAttribute('src').replace('_on'+FileType, FileType);
				this.setAttribute('src', ChangeSrc);
			}
		}
	}
}

function pageMove(){
	if(window.innerHeight){
		ScrH = window.innerHeight;
		ScrW = window.innerWidth;
	}else if(document.documentElement && document.documentElement.clientHeight){
		ScrH = document.documentElement.clientHeight;
		ScrW = document.documentElement.clientWidth;
	}else if(document.body && document.body.clientHeight){
		ScrH = document.body.clientHeight;
		ScrW = document.body.clientWidth;
	}
	ScrH = ScrH - 268;
	ScrW = ScrW / 2 -262;
	if(document.all && ScrH > 30){
		if(pageFlag){
			document.all("ContetnsArea").style.height = ""+ ScrH +"px";
			document.all("BackButton").style.padding = "0px 0px 0px "+ ScrW +"px";
			if(window.XMLHttpRequest){
				setTimeout("$('#pane1').jScrollPane()",200);
			}else{
				$('#pane1').jScrollPane();
			}
		}
	}else if(navigator.userAgent.indexOf("Gecko")!=-1){
		if(pageFlag){
			document.getElementById("ContetnsArea").style.height = ""+ ScrH +"px";
			document.getElementById("BackButton").style.padding = "0px 0px 0px "+ ScrW +"px";
			$('#pane1').jScrollPane();
		}
	}
}

function BackAreaOpen(){
	if(document.all){
		document.all("BackButtonImage").src = "/image/back_over.gif";
		document.all("ButtonArea").style.backgroundColor = "#111111";
		document.all("ButtonArea").style.zIndex = 500;
	}else if(navigator.userAgent.indexOf("Gecko")!=-1){
		document.getElementById("BackButtonImage").src = "/image/back_over.gif";
		document.getElementById("ButtonArea").style.backgroundColor = "#111111";
		document.getElementById("ButtonArea").style.zIndex = 500;
	}
}

function BackAreaClose(){
	if(document.all){
		document.all("BackButtonImage").src = "/image/back.gif";
		document.all("ButtonArea").style.backgroundColor = "transparent";
		document.all("ButtonArea").style.zIndex = 150;
	}else if(navigator.userAgent.indexOf("Gecko")!=-1){
		document.getElementById("BackButtonImage").src = "/image/back.gif";
		document.getElementById("ButtonArea").style.backgroundColor = "transparent";
		document.getElementById("ButtonArea").style.zIndex = 150;
	}
}

function PageLink(uri){
	pageFlag = true;
	if(document.all){
		document.all("PageArea").style.display = "block";
		document.all("ButtonArea").style.display = "block";
		document.all("CloseButton").style.display = "block";
		document.all("BackArea").style.display = "block";
		contentTitle = document.all(uri+"Title").innerHTML;
		contentTxt = document.all(uri+"Txt").innerHTML;
		contentTxt = contentTxt.replace('<SPAN id=kumamotoMail>JavaScriptを有効にしてください。</SPAN>', KumamotoMail);
		contentTxt = contentTxt.replace('<SPAN id=tokyoMail>JavaScriptを有効にしてください。</SPAN>', TokyoMail);
		document.all("PageArea").innerHTML = "<h2>"+contentTitle+"</h2><address>http://itoh.9design.jp/#"+uri+"</address><div id='ContetnsArea'><div id='pane1' class='scroll-pane'>"+contentTxt+"</div></div></div>";
	}else if(navigator.userAgent.indexOf("Gecko")!=-1){
		document.getElementById("PageArea").style.display = "block";
		document.getElementById("ButtonArea").style.display = "block";
		document.getElementById("CloseButton").style.display = "block";
		document.getElementById("BackArea").style.display = "block";
		contentTitle = document.getElementById(uri+"Title").innerHTML;
		contentTxt = document.getElementById(uri+"Txt").innerHTML;
		contentTxt = contentTxt.replace('<span id="kumamotoMail">JavaScriptを有効にしてください。</span>', KumamotoMail);
		contentTxt = contentTxt.replace('<span id="tokyoMail">JavaScriptを有効にしてください。</span>', TokyoMail);
		document.getElementById("PageArea").innerHTML = "<h2>"+contentTitle+"</h2><address>http://itoh.9design.jp/#"+uri+"</address><div id='ContetnsArea'><div id='pane1' class='scroll-pane'>"+contentTxt+"</div></div></div>";
	}
	$('#pane1').jScrollPane();
	pageMove();
}

function PageClose(){
	if(document.all){
		document.all("PageArea").style.display = "none";
		document.all("ButtonArea").style.display = "none";
		document.all("CloseButton").style.display = "none";
		document.all("BackArea").style.display = "none";
	}else if(navigator.userAgent.indexOf("Gecko")!=-1){
		document.getElementById("PageArea").style.display = "none";
		document.getElementById("ButtonArea").style.display = "none";
		document.getElementById("CloseButton").style.display = "none";
		document.getElementById("BackArea").style.display = "none";
	}
	if(navigator.userAgent.indexOf("IE")!=-1){
		var iframe =document.getElementById('historyFrame').contentWindow.document;
		iframe.open();
		iframe.close();
		iframe.location.hash = "#top";
	}else{
		//location.hash = "";
	}
}

function HashChange(){
	this.hashValue = "";
	this.listen = function(){
		uriT = location.hash.replace('#', '');
		if(navigator.userAgent.indexOf("IE")!=-1){
			var iframe =document.getElementById('historyFrame').contentWindow.document;
			var Nowhash = iframe.location.hash;
			if(carentHash != Nowhash){
				if(Nowhash != "#"){
					location.hash = Nowhash;
				}else{
					location.hash = "";
				}
				this.flag(Nowhash);
				carentHash = Nowhash;
			}
		}else{
			if(location.hash != this.hashValue){
				this.hashValue = location.hash;
				this.flag(this.hashValue);
			}
		}
	}
}
HashChange.prototype.flag = function(uri){
	uri = uri.replace('#', '');
	if(uri == "" || uri == "top"){
		PageClose();
	}else{
		if(document.getElementById(uri+"Title").innerHTML){
			PageLink(uri);
		}else{
			PageClose();
		}
	}
}
function Cc(id) {
	if(navigator.userAgent.indexOf("IE")!=-1){
		var iframe =document.getElementById('historyFrame').contentWindow.document;
		iframe.open();
		iframe.close();
		iframe.location.hash = id;
	}
}

function appendIframe(){
	var ifr = document.createElement('iframe');
	ifr.id = 'historyFrame';
	ifr.style.display = 'none';
	document.body.appendChild(ifr);
	var iframe =document.getElementById('historyFrame').contentWindow.document;
	iframe.open();
	iframe.close();
	iframe.location.hash = "top";
	Timer = new HashChange();
	window.setInterval('Timer.listen()', 200);
	carentHash = "";
}

if(navigator.userAgent.indexOf("IE")==-1){
	Timer = new HashChange();
	window.setInterval('Timer.listen()', 200);
}







// ]]>