// JavaScript Document

/**
 * リンクオブジェクト（メイン、サブ）
 */
function linkObj (name, url, children, alt_css) {
	this.name = name;
	this.url = url;
	this.children = children;
	this.alt_css = alt_css;
	
	this.linktext = function (css) {
		style = '';
		if (css) style = ' class="' + css + '"'
		if (this.alt_css) style = ' class="' + this.alt_css + '"'
		return ('<li' + style + '><a href="' + this.url + '">' + this.name + '</a></li>');
	}

	this.spantext = function (css) {
		style = '';
		if (css) style = ' class="' + css + '"'
		if (this.alt_css) style = ' class="' + this.alt_css + '"'
		return ('<li' + style + '><span>' + this.name + '</span></li>');
	}
}

/**
 * メインナビのHTMLをアウトプット
 */
function write_mainNavigation (links, cate) {
	
	for (i = 0; i < links.length; i++) {
		if (links[i].url.indexOf(cate) == 0) {
		    document.write(links[i].spantext());
		} else {
		    document.write(links[i].linktext());
		}
	}
}

/**
 * メインナビのリンク設定：名前、URL
 */
var mainLinks = new Array(
	new linkObj ('トップ',       '../index.htm'),
	new linkObj ('製品トップ',       'index.html'),
	new linkObj ('新装備',           'new_equipment.html'),
	new linkObj ('製品ラインナップ', 'lineup_index.html'),
	new linkObj ('装備',             'equipment_index.html'),
	new linkObj ('定期検査情報',     'checkups_index.html'),
	new linkObj ('カタログ請求<br/>お問い合わせ',     'contact.html', null, 'twoLine')
);


/**
 * サブナビのHTMLをアウトプット
 * here == none ならメニュー出力しない
 */
function write_subNavigation (subLinks, cate, subc, here) {
	
	if (here != "none") {
		links = subLinks[cate];
		for (i = 0; i < links.length; i++) {
			if (links[i].url.indexOf(subc) == 0) {
				document.write(links[i].spantext());
				if (links[i].children) {
					children = links[i].children
					for (j = 0; j < children.length; j++) {
						if (children[j].url.indexOf(here) == 0) {
							document.write(children[j].spantext("sub"));
						} else {
							document.write(children[j].linktext("sub"));
						}
					}
				}
			} else {
				document.write(links[i].linktext());
			}
		}
	}
	
}


/**
 * サブナビのリンク設定：名前、URL
 */
var subLinks = new Array();

subLinks['equipment'] = new Array(
	new linkObj ('新装備', 'new_equipment.html'),
	new linkObj ('標準装備', 'equipment_standard_safety.html', new Array(
			new linkObj ('安全性', 'equipment_standard_safety.html'),
			new linkObj ('信頼性', 'equipment_standard_credibility.html'),
			new linkObj ('利便性', 'equipment_standard_convenience.html'),
			new linkObj ('環境適合性', 'equipment_standard_ecology.html')
		)
	),
	new linkObj ('オプション装備', 'equipment_option_convenience.html', new Array(
			new linkObj ('利便性', 'equipment_option_convenience.html'),
			new linkObj ('清潔性', 'equipment_option_clean.html'),
			new linkObj ('安全性', 'equipment_option_safety.html')
		)
	)
); 
subLinks['lineup'] = new Array(
	new linkObj ('テーブルタイプ', 'lineup_RT.html'),
	new linkObj ('フロアタイプ', 'lineup_RL.html'),
	new linkObj ('ユニットタイプ', 'lineup_RU.html'),
	new linkObj ('関連製品', 'lineup_related_auto.html', new Array(
			new linkObj ('オートリフト', 'lineup_related_auto.html'),
			new linkObj ('クリーンリフト', 'lineup_related_clean.html')
		)
	)
); 
subLinks['util'] = new Array(
	new linkObj ('サイトについて', 'util_about.html', new Array(
			new linkObj ('サイトについて', 'util_about.html'),
			new linkObj ('サイトマップ', 'util_sitemap.html')
		)
	)	
); 