
var allLoaded = false ;

var entry = new Array( ) ;

function lmInit( )
{
	if ( versionCheck( ) )
	{
		SubMenu.DELAY = 0.2 ; //ロールアウトから消えるまでの時間（秒）
		SubMenu.timer = null ;

		// new DropDownMenu( レイヤー名, X座標, Y座標, 'イメージ名' ) ;
		entry[ 0  ] = new SubMenu( "layermenu01", 0,   91, 'mnews' ) ;
		entry[ 1  ] = new SubMenu( "layermenu02", 147, 91, 'msemi' ) ;
		entry[ 2  ] = new SubMenu( "layermenu03", 297, 91, 'mserv' ) ;
		entry[ 3  ] = new SubMenu( "layermenu04", 444, 91, 'mcomp' ) ;
		entry[ 4  ] = new SubMenu( "layermenu05", 591, 91, 'minq' ) ;

		allLoaded = true ;

		for ( var i=0; i<entry.length; i++ )
		{
			entry[ i ].id.onmouseover = new Function("entry[" +i+ "].setMouseOver( true  )") ;
			entry[ i ].id.onmouseout  = new Function("entry[" +i+ "].setMouseOver( false )") ;

			// メニューのRollOut時のパスを記憶しておく
			entry[ i ].setImgSrc( entry[ i ].getOffImg( ) ) ;
		}

		setInterval( 'process( )', 40 ) ;
	}
}

// -----------------------------------------------------------------

function versionCheck( )
{
	var flag = ( ( NN4 && getBrowserVersion( ).substr( 0, 3 ).toString( ) != '4.0' ) || NN6 || IE4 || IE5 ) ? true : false ;

	return flag ;
}

// -----------------------------------------------------------------

function process( )
{
	var mode      = null ;
	var makeTimer = false ;

	for ( var i in entry )
	{
		mode = entry[ i ].getMode( ) ;

		if ( mode == 'show' )
		{
			if ( !makeTimer )
			{
				makeTimer     = !makeTimer ;
				SubMenu.timer = getTimer( ) ;
			}

			entry[ i ].motion( ) ;
		}
	}
}

function getTimer( )
{
	var timer = new Date( ) ;

	return timer.getTime( ) ;
}

// -----------------------------------------------------------------

function Position( x, y )
{
	this.x = ( !x ) ? 0 : x ;
	this.y = ( !y ) ? 0 : y ;
}

function SubMenu( layerName, posiX, posiY, imgName )
{
	this.name    = layerName ;
	this.id      = refLayer( layerName ) ;
	this.imgName = imgName ;
	this.imgSrc  = null ;

	this.position = new Position( posiX, posiY ) ;

	this.mouseOverFlag = false ;
	this.mode = 'hide' ;

	shiftLayerTo( this.id, this.getX( ), this.getY( ) ) ;
}

SubMenu.prototype.motion = function( )
{
	var myTimer = this.getTimer( ) ;

	if ( !this.isMouseOver( ) && ( myTimer < SubMenu.timer ) )
	{
		this.hide( ) ;
	}
}

SubMenu.prototype.hideHandler = function( )
{
	this.setMouseOver( false ) ;

	// 時間差でイベントを発動
	this.setTimer( SubMenu.timer + ( 1000 * SubMenu.DELAY ) ) ;
}

SubMenu.prototype.show = function( )
{
	this.setMouseOver( true ) ;
	this.setMode( 'show' ) ;

	clearAll( this ) ;

	showLayer( this.id ) ;
}

SubMenu.prototype.hide = function( )
{
	this.setMode( 'hide' ) ;
	this.swapImgRestore( ) ;

	hideLayer( this.id ) ;
}

SubMenu.prototype.getName = function( )
{
	return this.name ;
}

SubMenu.prototype.setMode = function( mode )
{
	this.mode = mode ;
}

SubMenu.prototype.getMode = function( )
{
	return this.mode ;
}

SubMenu.prototype.getX = function( )
{
	return this.position.x ;
}

SubMenu.prototype.getY = function( )
{
	return this.position.y ;
}

SubMenu.prototype.setImgSrc = function( imgOrder )
{
	this.imgSrc = imgOrder ;
}

SubMenu.prototype.getImgSrc = function( )
{
	return this.imgSrc ;
}

SubMenu.prototype.getImgName = function( )
{
	return this.imgName ;
}

SubMenu.prototype.getOffImg = function( )
{
	var imgName = this.getImgName( ) ;
	var imgSrc  = document.images[ imgName ].src ;

	return imgSrc ;
}

SubMenu.prototype.swapImage = function( imgOrder )
{
	var imgName = this.getImgName( ) ;

	document.images[ imgName ].src = imgOrder ;
}

SubMenu.prototype.swapImgRestore = function( )
{
	var imgSrc = this.getImgSrc( ) ;

	this.swapImage( imgSrc ) ;
}

SubMenu.prototype.setTimer = function( value  )
{
	this.timer = value ;
}

SubMenu.prototype.getTimer = function( )
{
	return this.timer ;
}

SubMenu.prototype.isMouseOver = function( )
{
	return this.mouseOverFlag ;
}

SubMenu.prototype.setMouseOver = function( value )
{
	if ( this.mouseOverFlag == value )
	{
		this.prevEvent = value ;

		this.counter = 1 ;
		return ;
	}
	else
	{
		if ( !!this.prevEvent )
		{
			value = this.prevEvent ;
			this.prevEvent = null ;
		}

		this.mouseOverFlag = value ;
	}
}

// -----------------------------------------------------------------

function funcBuffer( )
{
	var jsCode = funcBuffer.arguments ;

	if ( allLoaded && versionCheck( ) )
	{
		for ( var i=0; i<jsCode.length; i++ )
		{
			eval( jsCode[ i ] ) ;
		}
	}
}

// -----------------------------------------------------------------

function clearAll( obj )
{
	if ( allLoaded && versionCheck( ) )
	{
		for ( var i in entry )
		{
			if ( entry[ i ] != obj )
			{
				entry[ i ].hide( ) ;
			}
		}
	}
}

// -----------------------------------------------------------------

function resizeHandler( )
{
	if ( allLoaded && versionCheck( ) )
	{
		location.reload( ) ;
		return false ;
	}
}

function setNSEventCapture( )
{
	document.captureEvents( Event.MOUSEUP ) ;

	if ( allLoaded && versionCheck( ) )
	{
		document.captureEvents( Event.RESIZE ) ;
	}
}

if( NN4 || NN6 )
{
	setNSEventCapture( ) ;
}

function createLayer( )
{
	document.open( ) ;
	document.write( '<div id="layermenu01" class="layerMenu"><table border="0" cellspacing="0" cellpadding="0"><tr><td><a href="/news/news.html" onMouseOver="dhn1.src=\'/image/dh_m_news1a.gif\'; return true" onMouseOut="dhn1.src=\'/image/dh_m_news1.gif\'; return true" onFocus="this.blur( )"><img src="/image/dh_m_news1.gif" width="145" height="18" border="0" name="dhn1" alt="ニュース一覧"></a><br><a href="/news/newsp.html" onMouseOver="dhn2.src=\'/image/dh_m_news2a.gif\'; return true" onMouseOut="dhn2.src=\'/image/dh_m_news2.gif\'; return true" onFocus="this.blur( )"><img src="/image/dh_m_news2.gif" width="145" height="18" name="dhn2" border="0" alt="新聞報道一覧"></a><br><a href="/news/maga.html" onMouseOver="dhn3.src=\'/image/dh_m_news3a.gif\'; return true" onMouseOut="dhn3.src=\'/image/dh_m_news3.gif\'; return true" onFocus="this.blur( )"><img src="/image/dh_m_news3.gif" width="145" height="18" name="dhn3" border="0" alt="雑誌掲載一覧"></a></td></tr></table></div>' ) ;
	document.write( '<div id="layermenu02" class="layerMenu"><table border="0" cellspacing="0" cellpadding="0"><tr><td><a href="/event/event.html" onMouseOver="dhs1.src=\'/image/dh_m_semi1a.gif\'; return true" onMouseOut="dhs1.src=\'/image/dh_m_semi1.gif\'; return true" onFocus="this.blur( )"><img src="/image/dh_m_semi1.gif" width="148" height="18" name="dhs1" border="0" alt="開催スケジュール"></a><br><a href="/event/event_en.html" onMouseOver="dhs2.src=\'/image/dh_m_semi2a.gif\'; return true" onMouseOut="dhs2.src=\'/image/dh_m_semi2.gif\'; return true" onFocus="this.blur( )"><img src="/image/dh_m_semi2.gif" width="148" height="18" name="dhs2" border="0" alt="終了したセミナー・イベント"></a></td></tr></table></div>' ) ;
	document.write( '<div id="layermenu03" class="layerMenu"><table border="0" cellspacing="0" cellpadding="0"><tr><td><a href="/service/category.html" onMouseOver="dhse3.src=\'/image/dh_m_serv3a.gif\'; return true" onMouseOut="dhse3.src=\'/image/dh_m_serv3.gif\'; return true" onFocus="this.blur( )"><img src="/image/dh_m_serv3.gif" width="145" height="18" name="dhse3" border="0" alt="カテゴリで選ぶ"></a><br><a href="/service/purpose.html" onMouseOver="dhse1.src=\'/image/dh_m_serv1a.gif\'; return true" onMouseOut="dhse1.src=\'/image/dh_m_serv1.gif\'; return true" onFocus="this.blur( )"><img src="/image/dh_m_serv1.gif" width="145" height="18" name="dhse1" border="0" alt="目的で選ぶ"></a><br><a href="/service/service.html" onMouseOver="dhse2.src=\'/image/dh_m_serv2a.gif\'; return true" onMouseOut="dhse2.src=\'/image/dh_m_serv2.gif\'; return true" onFocus="this.blur( )"><img src="/image/dh_m_serv2.gif" width="145" height="18" name="dhse2" border="0" alt="サービス名で選ぶ"></a></td></tr></table></div>' ) ;
	document.write( '<div id="layermenu04" class="layerMenu"><table border="0" cellspacing="0" cellpadding="0"><tr><td><a href="/company/outline.html" onMouseOver="dhc1.src=\'/image/dh_m_comp1a.gif\'; return true" onMouseOut="dhc1.src=\'/image/dh_m_comp1.gif\'; return true" onFocus="this.blur( )"><img src="/image/dh_m_comp1.gif" width="145" height="18" name="dhc1" border="0" alt="会社概要"></a><br><a href="/company/recruit.html" onMouseOver="dhc3.src=\'/image/dh_m_comp3a.gif\'; return true" onMouseOut="dhc3.src=\'/image/dh_m_comp3.gif\'; return true" onFocus="this.blur( )"><img src="/image/dh_m_comp3.gif" width="145" height="18" name="dhc3" border="0" alt="採用情報"></a><br><a href="/company/partner.html" onMouseOver="dhc4.src=\'/image/dh_m_comp4a.gif\'; return true" onMouseOut="dhc4.src=\'/image/dh_m_comp4.gif\'; return true" onFocus="this.blur( )"><img src="/image/dh_m_comp4.gif" width="145" height="18" name="dhc4" border="0" alt="パートナー"></a></td></tr></table></div>' ) ;
	document.write( '<div id="layermenu05" class="layerMenu"><table border="0" cellspacing="0" cellpadding="0"><tr><td><a href="https://www.secomtrust.net/contact/form.html" onMouseOver="dhi1.src=\'/image/dh_m_inq1a.gif\'; return true" onMouseOut="dhi1.src=\'/image/dh_m_inq1.gif\'; return true" onFocus="this.blur( )"><img src="/image/dh_m_inq1.gif" width="147" height="18" name="dhi1" border="0" alt="入力フォーム"></a><br><a href="/contact/contact.html" onMouseOver="dhi2.src=\'/image/dh_m_inq2a.gif\'; return true" onMouseOut="dhi2.src=\'/image/dh_m_inq2.gif\'; return true" onFocus="this.blur( )"><img src="/image/dh_m_inq2.gif" width="147" height="18" name="dhi2" border="0" alt="連絡先"></a></td></tr></table></div>' ) ;
	document.close( ) ;
}

//document.onmouseup = clearAll ;

//window.onresize = resizeHandler ;
