// localnavi.js for *.toyoink.co.jp/*

var	domain = "toyoink.co.jp";

function	IsHere( addr ) {
	var	url0 = document.URL + ( ( document.URL.charAt( document.URL.length - 1 ) == "/" ) ? "index.html" : "" );
	var	url1 = addr + ( ( addr.charAt( addr.length - 1 ) == "/" ) ? "index.html" : "" );
	
	if ( url0.length != url1.length )	return false;
	else {
		for ( c = 0; c < url0.length; c++ ) {
			if ( url1.charAt( c ) != url0.charAt( c ) )	return false;
		}
	}
	return true;
}

function	WriteLocalNavi() {
	var	dir = document.URL.substring( 0, document.URL.indexOf( domain ) ) + domain;
	var	here = false;
	
	document.write( '<table border="0" cellpadding="0" cellspacing="0">\n' );
	document.write( '<tr><td><img src="/common/spacer_0.gif" width="12" height="1" alt=""></td><td><img src="/common/spacer_0.gif" width="12" height="1" alt=""></td><td><img src="/common/spacer_0.gif" width="12" height="1" alt=""></td><td><img src="/common/spacer_0.gif" width="12" height="1" alt=""></td><td><img src="/common/spacer_0.gif" width="12" height="1" alt=""></td><td><img src="/common/spacer_0.gif" width="104" height="1" alt=""></td></tr>\n' );
	
	for ( j = 0; j < i; j++ ) {
		here = IsHere( dir + a[j] );
		
		if ( ( l[j] < 1 ) || ( l[j] > 5 ) ) {
			document.write( '<tr><td colspan="6"><small>&nbsp;</small></td></tr>\n' );
		}
		else {
			document.write( '<tr valign="top">' );
			if (      l[j] == 2 )	document.write( '<td><small>&nbsp;</small></td>' );
			else if ( l[j] == 3 )	document.write( '<td colspan="2"><small>&nbsp;</small></td>' );
			else if ( l[j] == 4 )	document.write( '<td colspan="3"><small>&nbsp;</small></td>' );
			else if ( l[j] == 5 )	document.write( '<td colspan="4"><small>&nbsp;</small></td>' );
			if ( here )				document.write( '<td><img src="/common/ar_' + ( ( m[j].charAt( 1 ) == "0" ) ? "r0" : "r1" ) + '.gif" width="12" height="12" alr="-" title=""></td>' );
			else					document.write( '<td><img src="/common/ar_' + m[j] + '.gif" width="12" height="12" alt="-" title=""></td>' );
			if (      l[j] == 1 )	document.write( '<td colspan="5">' );
			else if ( l[j] == 2 )	document.write( '<td colspan="4">' );
			else if ( l[j] == 3 )	document.write( '<td colspan="3">' );
			else if ( l[j] == 4 )	document.write( '<td colspan="2">' );
			else if ( l[j] == 5 )	document.write( '<td>' );
			if ( here )				document.write( '<small><b>' + d[j] + '</b></small>' );
			else if ( a[j] != "" ) {
				if ( a[j].charAt(0) == '/' )	document.write( '<small><a href="' + dir + a[j] + '">' + d[j] + '</a></small>' );
				else							document.write( '<small><a href="' +       a[j] + '">' + d[j] + '</a></small>' );
			}
			else					document.write( '<small>' + d[j] + '</small>' );
			document.write( '</td>' );
			document.write( '</tr>\n' );
		}
	}
	
	document.write( '</table>\n' );
	document.close();
}