// Browser Check
function browserCheck(){ 
this.ver=navigator.appVersion
this.agent=navigator.userAgent
this.dom=document.getElementById?1:0
this.opera6=((this.agent.indexOf("Opera 6")>-1) && this.dom)?1:0;
this.ie5=((this.ver.indexOf("MSIE 5")>-1) && this.dom && !this.opera6)?1:0; 
this.ie6r=((this.ver.indexOf("MSIE 6")>-1) && this.dom && (document.compatMode == "BackCompat"))?1:0;
this.ie6s=((this.ver.indexOf("MSIE 6")>-1) && this.dom && (document.compatMode == "CSS1Compat"))?1:0;
this.ie4=(document.all && !this.dom)?1:0;
this.ie=(this.ie4||this.ie5||this.ie6r||this.ie6s)?1:0;
this.mac=(this.agent.indexOf("Mac")>-1)?1:0;
this.ns6=(this.dom && (parseInt(this.ver) >= 5)) ?1:0; 
this.ns4=(document.layers && !this.dom)?1:0;
this.ns=(this.ns4||this.ns6)?1:0;
this.bw5=(this.ie5||this.ie6r)?1:0;
this.bw6=(this.ie6s||this.ns6||this.opera6)?1:0;
this.bw=(this.ie6r||this.ie6s||this.ie5||this.ns6||this.opera6)?1:0;
return this;
}

// Navigation
var KNMarginTop, KENMarginBottom, KNTop;
var KNDivName, KNObject, KNCurrentY;

function leftnavi(id, mt, mb, tp){
bw=new browserCheck;
if (bw.bw) {
KNDivName = bw.bw5 ? document.all(id) : bw.bw6 ? document.getElementById(id) : 0;
KNObject = KNDivName.style;
KNObject.position = 'absolute';
KNMarginTop = mt ? mt : 0; 
KNMarginBottom = mb ? mb : 0; 
KNCurrentY = KNTop = tp ? tp : ENDivName.offsetTop; 
smnavi();
} 
}

function smnavi(){
var winh = bw.ie6s ? document.documentElement.clientHeight : (bw.ns6||bw.opera6) ? innerHeight : bw.bw5 ? document.body.clientHeight : 0 ;
var yt = bw.ie6s ? document.documentElement.scrollTop : bw.bw5 ? document.body.scrollTop : (bw.ns6||bw.opera6) ? window.pageYOffset : 0;
var divh = KNDivName.offsetHeight;

if (winh >= KNMarginTop + divh + KNMarginBottom) {
yt = Math.max(yt + KNMarginTop, KNTop);
} else {
var yt1 = Math.max(yt + KNMarginTop, KNTop);
var f1 = (yt1 > KNCurrentY) ? 1 : 0;
var yt2 = yt - (divh + KNMarginBottom - winh);
yt2 = Math.max(yt2, KNTop);
var f2 = (yt2 < KNCurrentY) ? 1 : 0;

if (f1 && f2) yt = KNCurrentY;
else yt = f2 ? Math.max(yt1, yt2) : Math.min(yt1, yt2);
}

if (yt != KNCurrentY) {
var vy = (yt - KNCurrentY) * 0.25;
if (Math.abs(vy) < 1) vy = (vy > 0) ? 1 : (vy < 0) ? -1 : 0;
KNCurrentY += Math.round(vy);
KNObject.top = KNCurrentY + 'px';
}
setTimeout('smnavi()', 20);
}

// tree menu
function tree(myId){
myMenu=document.getElementById(myId).style;
if(myMenu.display=="none"){
myMenu.display="block";
}else{
myMenu.display="none";
}
}

//copy right
function copy()
	{
		mydate=new Date();
		Ye=mydate.getFullYear();
		document.write("Copy right (C) 2006-"+Ye+" Kyoto Convention Bureau, All Rights Reserved. ");
	}
