//machNavi

MM_preloadImages('imgs/mn1_b.gif','imgs/mn2_b.gif','imgs/mn3_b.gif','imgs/mn4_b.gif','imgs/mn5_b.gif','imgs/mn6_b.gif','imgs/mn7_b.gif');

if(window.location.href.indexOf('http:')>=0){
	pth = 'http://www.kudanacademy.com/'
}
else{
	pth = 'file:///c:/web/kla/'
}

document.write('<link rel="stylesheet" href="'+pth+'_navi/_basic.css" type="text/css">');

//define menu items
	menuItem = new Array; menuItemAmount = 8;
	menuItem[1] =	'HOME[dir]top[id]menu1';
	menuItem[2] =	'ABOUT[dir]about[id]menu2';
	menuItem[3] =	'LESSON[dir]lesson[id]menu3';
	menuItem[4] =	'講師紹介[dir]tutors[id]menu4';
	menuItem[5] =	'スケジュール[dir]schedule[id]menu5';
	menuItem[6] =	'入会案内[dir]information[id]menu6';
	menuItem[7] = 'FAQ[dir]faq[id]menu7'
	menuItem[8] =	'お問い合せ[dir]contact[id]menu8';

//define sitemap array
	sitemap = new Array; sitemapAmount = 17;
	sitemap[1] =	'0[name]HOME[dir]top[file]index';
	sitemap[2] =	'0[name]ABOUT[dir]about[file]index';
	sitemap[3] =	'1[name]KLAについて[dir]about[file]klais';
	sitemap[4] =	'1[name]KLAのすすめ[dir]about[file]introduce';
	sitemap[5] =	'1[name]場所/連絡先[dir]about[file]location';
	sitemap[6] =	'0[name]LESSON[dir]lesson[file]index';
	sitemap[7] =	'1[name]KLAの特色[dir]lesson[file]chara';
	sitemap[8] =	'1[name]英語[dir]lesson[file]english';
	sitemap[9] =	'1[name]フランス語[dir]lesson[file]french';
	sitemap[10] =	'1[name]イタリア語[dir]lesson[file]italian';
	sitemap[11] =	'0[name]講師紹介[dir]tutors[file]index';
	sitemap[12] =	'0[name]スケジュール[dir]schedule[file]index';
	sitemap[13] =	'0[name]入会案内[dir]information[file]index';
	sitemap[14] =	'1[name]料金設定[dir]information[file]charge';
//	sitemap[15] =	'1[name]入会にあたって[dir]information[file]question';
	sitemap[15] =	'1[name]資料請求フォーム[dir]information[file]regform';
	sitemap[16] =	'0[name]FAQ[dir]faq[file]index';
	sitemap[17] =	'0[name]お問い合せ[dir]contact[file]index';


//expand menuitem array
function expandMenuItem(nm){
	row = menuItem[nm];
	theName = row.slice(0,row.indexOf('[dir]'));
	if(nm!=1){
		theDir = row.slice(row.indexOf('[dir]')+5,row.indexOf('[id]'));
	}
	else{
		theDir = "";
	}
	theId = row.slice(row.indexOf('[id]')+4,row.length);
}
//expand sitemap array
function expandSitemap(nm){
	sm = sitemap[nm];
	smLv = sm.charAt(0);
	smName = sm.slice(sm.indexOf('[name]')+6,sm.indexOf('[dir]'));
	smDir = (nm!=1) ? sm.slice(sm.indexOf('[dir]')+5,sm.indexOf('[file]')) : "";
	smFile = sm.slice(sm.indexOf('[file]')+6,sm.length);
	smUrl = pth + smDir + '/' + smFile + '.htm';
}


//mach navi header
function showHeader(){
	with(document){
		write('<table width="100%" border="0" cellspacing="0" cellpadding="0" style="margin-bottom:30px">')
		write('<tr><td align="center" background="',pth,'imgs/bg_f90_pc80.gif">')
		for(i=1;i<=menuItemAmount;i++){
			expandMenuItem(i);
			write('<a href="',pth,theDir,'/index.htm"')
			write(' onmouseout="MM_swapImgRestore()"')
			write(' onmouseover="MM_swapImage(\'',theId,'\',\'\',\'',pth,'imgs/mn',i,'_b.gif\',1)">')
			write('<img src="',pth,'imgs/mn',i,'_a.gif" width="80" height="16" name="menu',i,'" border="0">')
			write('</a>')
		}
		write('</td></tr></table>')
		write('<div align="center">')
		if(document.title!="SITEMAP"){
			write('<table width="650px" border="0" cellspacing="0" cellpadding="0">')
			write('<tr><td colspan="2" height="30px" align="left" valign="top" style="font-size:10px; color:#999999">■&nbsp;',document.title,'</td></tr>')
			write('<tr><td width="150px" style="border:1px solid #ffcc00; background-color:#ffffee" valign="top">')
//navigation start
			write('<p style="margin:0px; color:#ffffcc; background-color:#ffcc00; font-size:10px">SITEMAP</p>')
			write('<p style="margin: 10px 0px 10px 10px; ">')
			for(i=1; i<=sitemapAmount; i++){
				expandSitemap(i);
				thisDir = '/' + smDir + '/'
				if(window.location.href.indexOf(thisDir)>=0||smLv=='0'){
					if(window.location.href==smUrl){ tColor = 'color:#ff9900;' }
					else if(window.location.href!=smUrl){ tColor = (smLv==0) ? 'color:#666699;' : 'color:#9999ff;'	}
					tAlign = (smLv==0) ? 'margin-left:0px;' : 'margin-left:20px;';
	
					if(smLv==0){write('<img src="',pth,'imgs/folder.gif" height="12" width="12">&nbsp;')}
	
					tagopen = (window.location.href!=smUrl) ? '<a href="'+smUrl+'" style="'+tColor+tAlign+'">' : '<span style="'+tColor+tAlign+'">';
					tagclose = (window.location.href!=smUrl) ? '</a>' : '</span>' ;
	
					write(tagopen);
					write(smName);
					write(tagclose);
					write('<br>');
				}
			}
			write('</p>')
//navigation end
			write('</td><td width="500px" style="padding-left:30px" valign="top">')
		}
	}
}

//mach navi footer
function showFooter(){
	with(document){
		write('</td><tr>')
		write('</table></div>')
		write('<table width="100%" border="0" cellspacing="0" cellpadding="0" style="margin-top:30px">')
		write('<tr><td style="border-top:1px solid #ffcc00" align="center"><br>')
		for(i=1;i<=menuItemAmount;i++){
			expandMenuItem(i);
			write('<a href="'+pth+theDir+'/index.htm">')
			write('&nbsp;&nbsp;',theName,'&nbsp;&nbsp;')
			write('</a>')
			if(i!=menuItemAmount){
				write('<span style="color:#ccccff">|</span>')
			}
		}
		write('<hr style="height:1px; color:#dddddd"><span style="color:#cccccc">Kudan Language Academy</span><br><br>')
		write('</td></tr>')
		write('</table>')
	}
}

//macromedia javascript
function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}
function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}
function MM_findObj(n, d) { //v4.0
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && document.getElementById) x=document.getElementById(n); return x;
}
function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
