/**
 *	@name			banner_fl_156x55.js
 *	@type			check
 *	@facility		バナー表示
 *	@created date	2006/04/19
 *	@author			so
 *	@version		1.1
 *	@copyright (c) 2003 NATIONAL BASIC DESIGN inc.
 *
 **/

var nUserAgent	= navigator.userAgent;
var nAppVersion	= navigator.appVersion;
var nAppName	= navigator.appName;
var nMimeTypes	= navigator.mimeTypes;

var flashPlugin;
var flashVer;
var fRequiredVer = 7;

var fPluginspages = new Array()
{
	"http://www.macromedia.com/jp/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash",	// JPN PLUGIN'S PAGES
	"http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash"		// ENG PLUGIN'S PAGES
}

showBanner();

function getFlashPlugin()
{
	return (nMimeTypes && nMimeTypes["application/x-shockwave-flash"]) ? nMimeTypes["application/x-shockwave-flash"].enabledPlugin : 0;
}

function getFlashVer(plugin)
{
	if(plugin)
	{
		return parseInt(plugin.description.substring(plugin.description.indexOf(".")-1));
	}
	else if(nUserAgent && nUserAgent.indexOf("MSIE") != -1 && nAppVersion.indexOf("Win") != -1)
	{
		execScript('on error resume next\nflashVer = IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash." & fRequiredVer))', 'VBScript');

		if(flashVer)
		{
			return fRequiredVer;	// とりあえず fRequiredVer を返す。
		}
	}
	return -1;
}


function hasPlugin()
{
	if(flashVer < fRequiredVer)
	{
		return false;
	}

	return true;
}

function showBanner()
{

	flashPlugin			= getFlashPlugin();
	flashVer			= getFlashVer(flashPlugin);

	document.open();

	with(document)
	{
		if(hasPlugin())
		{
			write('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" ');
			write(' codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab"');
			write(' id="ozakibanner"');
			write(' width="156"');
			write(' height="55"');
			write('>');
			write('<param name="movie" value="http://ozaki.jp/banner/banner_fl_156x55.swf?url=' + document.URL +'"');
			write('<param name="quality" value="high">');
			write('<param name="menu" value="false">');
			write('<param name="wmode" value="opaque">');
			write('<param name="scale" value="noscale">');
			write('<embed src="http://ozaki.jp/banner/banner_fl_156x55.swf?url=' + document.URL +'"');
			write(' quality="high"');
			write(' width="156"');
			write(' height="55"');
			write(' menu="false"');
			write(' type="application/x-shockwave-flash"');
			write(' pluginspage="' + fPluginspages + '"');
			write('>');
			write('</embed>');
			write('</object>');
		}
		else
		{
			write('<a href="http://ozaki.jp/" target="_blank"><img src="http://ozaki.jp/banner/banner_s_156x55.gif" width="156" height="55" alt="ozaki" border="0" /></a>');
		}
	}

	document.close();
}
