
function xInit( )
{
	setTimeout( "xInitEvent( )", 500 ) ;
}

//------------------------------------------------------------------------------


//--------------------------------------
//  イベントを初期化
//--------------------------------------
function xInitEvent( )
{
	Event.observe( $("myflash"), 'focus', xFlaFocus, false ) ;
	Event.observe( $("myflash"), 'blur',  xFlaBlur,  false ) ;
	Event.observe( window, 'focus', xWinFocus, false ) ;
	Event.observe( window, 'blur',  xWinBlur,  false ) ;
	$("myflash").focus( ) ;
}


//------------------------------------------------------------------------------


//--------------------------------------
//  FLASHへアクセス
//--------------------------------------
function xGetFlaById( str )
{
	// all except Explorer
	if ( self.innerWidth )
	{
		return document[ str ] ;
	}
	// Explorer 6 Strict Mode
	else if ( document.documentElement && document.documentElement.clientWidth )
	{
		return window[ str ] ;
	
	}
	// other Explorers
	else if ( document.body )
	{
		return window[ str ] ;
	}
}


//------------------------------------------------------------------------------


//--------------------------------------
//  WINDOW
//--------------------------------------
function xWinFocus( e )
{
	xGetFlaById( "myflash" ).callJsToFlashSetMute( false ) ;
}

function xWinBlur( e )
{
	xGetFlaById( "myflash" ).callJsToFlashSetMute( true ) ;
}


//--------------------------------------
//  FLASH
//--------------------------------------
function xFlaFocus( e )
{
	xGetFlaById( "myflash" ).callJsToFlashSetMute( false ) ;
}

function xFlaBlur( e )
{
	xGetFlaById( "myflash" ).callJsToFlashSetMute( true ) ;
}


//------------------------------------------------------------------------------


window.onload = xInit ;
