﻿/////////////////////////////////////////////////////////////////////////////
// Class : brother_section_navigation_white
// Comments : 
/////////////////////////////////////////////////////////////////////////////

function brother_section_navigation_white( imageRoot )
{
	this.m_imageRoot  = imageRoot;
	this.m_NavPath    = g_navNode_Path;
	
	this.m_act_image = new Array();
	this.m_act_image["top"]                  = "/img/product_menu01_on.gif";
	this.m_act_image["基本機能"]             = "/img/product_menu02_on.gif";
	this.m_act_image["スペック"]             = "/img/product_menu03_on.gif";
	this.m_act_image["写真・寸法"]           = "/img/product_menu04_on.gif";
	this.m_act_image["消耗品・オプション"]   = "/img/product_menu05_on.gif";
//	this.m_act_image["スペック・対応機種"]   = "/img/secNaviPspeMwP_act.gif";
//	this.m_act_image["消耗品・アクセサリー"] = "/img/secNaviPacc_act.gif";
//	this.m_act_image["ダウンロード販売"]     = "/img/secNaviPdown_act.gif";
//	this.m_act_image["体験版ダウンロード"]   = "/img/secNaviPtri_act.gif";
//	this.m_act_image["サービス内容"]         = "/img/secNaviPser_act.gif";
//	this.m_act_image["加工例"]               = "/img/secNaviPexaL_act.gif";
//	this.m_act_image["加工例一覧"]           = "/img/secNaviPexa_act.gif";
//	this.m_act_image["加工実績"]             = "/img/secNaviPper_act.gif";
//	this.m_act_image["CNCタッピングセンターとは"] = "/img/secNaviPwcn_act.gif";
//	this.m_act_image["アクセサリー"]         = "/img/secNaviPacc2_act.gif";
	
	this.m_of_image = new Array();
	this.m_of_image["top"]                   = "/img/product_menu01_off.gif";
	this.m_of_image["基本機能"]              = "/img/product_menu02_off.gif";
	this.m_of_image["スペック"]              = "/img/product_menu03_off.gif";
	this.m_of_image["写真・寸法"]            = "/img/product_menu04_off.gif";
	this.m_of_image["消耗品・オプション"]    = "/img/product_menu05_off.gif";
//	this.m_of_image["スペック・対応機種"]    = "/img/secNaviPspeMwP_of.gif";
//	this.m_of_image["消耗品・アクセサリー"]  = "/img/secNaviPacc_of.gif";
//	this.m_of_image["ダウンロード販売"]      = "/img/secNaviPdown_of.gif";
//	this.m_of_image["体験版ダウンロード"]    = "/img/secNaviPtri_of.gif";
//	this.m_of_image["サービス内容"]          = "/img/secNaviPser_of.gif";
//	this.m_of_image["加工例"]                = "/img/secNaviPexaL_of.gif";
//	this.m_of_image["加工例一覧"]            = "/img/secNaviPexa_of.gif";
//	this.m_of_image["加工実績"]              = "/img/secNaviPper_of.gif";
//	this.m_of_image["CNCタッピングセンターとは"] = "/img/secNaviPwcn_of.gif";
//	this.m_of_image["アクセサリー"]          = "/img/secNaviPacc2_of.gif";
	
	this.m_lv_top = 4;
	
	brother_section_navigation_white.prototype.Display = brother_section_navigation_white_Display;
	brother_section_navigation_white.prototype.DisplayNode = brother_section_navigation_white_DisplayNode;
	
}

function isChildOf( node, parentId ){
	
	while( node.m_parent != null ){
		
		if( node.m_id == parentId ){
			return true;
		}
		
		node = node.m_parent;
		
	}
	
	return false;
	
}


function findNodeById( node, id ){
	
	var result = null;
	
	if( node.m_id == id ){
		return node;
	}
	else{
		
		for( var i = 0; i < node.m_subNodes.length; i++ )
		{
			result = this.findNodeById(node.m_subNodes[i], id );
			
			if( result != null ){
				return result;
			}
			
		}
		return null;
	}
	
}


function brother_section_navigation_white_Display( node )
{
	
	var navRoot = null;
	
	if( this.m_NavPath.length >= this.m_lv_top ){
		navRoot = findNodeById( node, this.m_NavPath[this.m_lv_top] );
	}
	
	if( navRoot != null ){
		
		var ds;
		var di;
		
		ds = new Array();
		di = 0;
		// 20080108 Update
//		ds[di++] = '<table border="0" cellspacing="0" cellpadding="0" bgcolor="#636563">';
//		ds[di++] = '<table border="0" cellspacing="0" cellpadding="0" background="' + this.m_imageRoot + '/img/menu_bg.gif">';
		ds[di++] = '<table border="0" cellspacing="0" cellpadding="0" background="' + this.m_imageRoot + '/img/navibgimg.jpg">';
		ds[di++] = '<tr>';
		ds[di++] = '<td>';
		ds[di++] = '<img src="' + this.m_imageRoot + '/img/menu_l.gif" width="24" height="46">';
//		ds[di++] = '<img src="' + this.m_imageRoot + '/img/secNavi00_of.gif" width="24" height="46">';
		ds[di++] = '</td>';
		document.write(ds.join(''));
		
		this.DisplayNode( navRoot );
		
		ds = new Array();
		di = 0;
		ds[di++] = '<td>';
		// 20080111 Delete
//		ds[di++] = '<img src="' + this.m_imageRoot + '/img/menu_r.gif" width="24" height="46">';
//		ds[di++] = '<img src="' + this.m_imageRoot + '/img/secNavi06.gif" width="22" height="46">';
		ds[di++] = '</td>';
		ds[di++] = '</tr>';
		ds[di++] = '</table>';
		document.write(ds.join(''));
		
	}
	else{
		
		document.write( "Error: Can't find navigation root" );
		
	}
}


function brother_section_navigation_white_DisplayNode( node )
{
	
	var bSelected = false;
	
	if (this.m_NavPath.length > 0 )
	{
		if( this.m_NavPath.length <= ( this.m_lv_top + 1 ) ){
			bSelected = this.m_NavPath[this.m_NavPath.length - 1] == node.m_id;
		}
		else{
			bSelected = isChildOf( node, this.m_NavPath[ this.m_lv_top + 1 ] );
		}
	}
	
	
	var ds = new Array();
	var di = 0;
	
	if( bSelected ){
		
		ds[di++] = '<td>';
		ds[di++] = '<table border="0" cellspacing="0" cellpadding="0">';
		ds[di++] = '<tr id="IMENU1_BACK_AC">';
		ds[di++] = '<td height="46"><font id="IMENU1_FONT_AC"><IMG src="' + this.m_imageRoot + this.m_act_image[ node.m_level == this.m_lv_top ? "top" : node.m_label ] + '" border="0" name="bwsmnACT0" alt="' + node.m_label + '" width="112" height="46"></font></td>';
		ds[di++] = '</tr>';
		ds[di++] = '</table>';
		ds[di++] = '</td>';
		
	} else {
		
		ds[di++] = '<td>';
		ds[di++] = '<table border="0" cellspacing="0" cellpadding="0">';
		ds[di++] = '<tr id="IMENU10_BACK_OF" onMouseOver="styleChange(this,\'IMENU1_BACK_ON\')" onMouseOut="styleChange(this,\'IMENU1_BACK_OF\')">';
		ds[di++] = '<td height="46"><a href="' + node.m_href + '" onMouseOut="return secNaviMouseOut(bwsmn' + node.m_id + ')" onMouseOver="return secNaviMouseOver(bwsmn' + node.m_id + ')" target="_top" class="IMENU1_LINK"><IMG src="' + this.m_imageRoot + this.m_of_image[ node.m_level == this.m_lv_top ? "top" : node.m_label ] + '" border="0" name="bwsmn' + node.m_id + '" alt="' + node.m_label + '" width="112" height="46"></a></td>';
		ds[di++] = '</tr>';
		ds[di++] = '</table>';
		ds[di++] = '</td>';
		
	}
	
	document.write(ds.join(''));
	
	for (var i = 0; i < node.m_subNodes.length; i++)
	{
		this.DisplayNode(node.m_subNodes[i]);
	}
	
}





//---- image swap(over) ----
function secNaviMouseOver(o){
    o.src = o.src.replace(/_off/i,'_over')
    return true;
}

//---- image swap(out) ----
function secNaviMouseOut(o){
    o.src = o.src.replace(/_over/i,'_off')
    return true;
}

//---- STYLE ID Chenge ----
function styleChange(o,id){
    o.id=id;
        return true;
}
