var MM_contentVersion = 9;
var plugin = (navigator.mimeTypes && navigator.mimeTypes["application/x-shockwave-flash"]) ? navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin : 0;

var page_ie_flag = false;
if ( plugin )
{
	var words = navigator.plugins["Shockwave Flash"].description.split(" ");
	for (var i = 0; i < words.length; ++i)
	{
		if (isNaN(parseInt(words[i])))
			continue;
		var MM_PluginVersion = words[i];
	}
	var MM_FlashCanPlay = MM_PluginVersion >= MM_contentVersion;
}
else if (navigator.userAgent && navigator.userAgent.indexOf("MSIE")>=0 && (navigator.appVersion.indexOf("Win") != -1))
{
	document.write('<SCR' + 'IPT LANGUAGE=VBScript\> \n'); //FS hide this from IE4.5 Mac by splitting the tag
	document.write('on error resume next \n');
	document.write('MM_FlashCanPlay = 0 \n');
	document.write('MM_FlashCanPlay = MM_FlashCanPlay or ( IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash." & MM_contentVersion)))\n');
	document.write('For vi = MM_contentVersion + 1 to MM_contentVersion + 5\n');
	document.write('MM_FlashCanPlay = MM_FlashCanPlay or ( IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash." & vi)))\n');
	document.write('Next\n');
	document.write('<\/SCR' + 'IPT\> \n');
	page_ie_flag = true;
}

var movieName = '';
function setMovieName( $name )
{
	movieName = $name;
}

function printMovie ( $swffile, $width, $height, $bgcolor, $change_image, $change_url )
{
	// Initialization
	var pTmp = "";
	var pNo = "";
	// URL Acquisition
	var pTmp = location.href;
	// p Number Acquisition
	pAry = pTmp.split('p=');
	if(pAry.length > 1)
		pNo = pAry[1];
	else
		pNo = '';
	
	var movie_name = movieName;
	if(movie_name == '')
	{
		movie_name = 'movieexternal';
	}

	if ( MM_FlashCanPlay )
	{
		if(page_ie_flag)
		{
			// for ie.
			document.write (
				'<object id="'+movie_name+'" classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version='+MM_contentVersion+',0,0,0" width="'+$width+'" height="'+$height+'" align="middle">'+
				'<param name="allowScriptAccess" value="always" \/>'+
				'<param name="movie" value="'+$swffile+'" \/>'+
				'<param name="quality" value="high" \/>'+
				'<param name="scale" value="noscale" \/>'+
				'<param name="salign" value="mc" \/>'+
				'<param name="wmode" value="window" \/>'+
				'<param name="bgcolor" value="'+$bgcolor+'" \/>' +
				(pNo != ''?'<param name="flashvars" value="p=' + pNo + '" \/>' : '') +
				'<\/object>'
			);
		}
		else
		{
			// for not ie.
			document.write (
				'<embed wmode="window" name="'+movie_name+'" src="'+$swffile+'" quality="high" scale="noscale" salign="mc" bgcolor="'+$bgcolor+'" width="'+$width+'" height="'+$height+'" align="middle" allowScriptAccess="always" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" '+
				(pNo != ''?'flashvars="p=' + pNo + '"' : '') +
				'\/>'
			);
		}
		
	}
	else
	{
		if($change_image)
			document.write('<img src="' + $change_image + '" width="' + $width + '" height="' + $height + '" border="0" />\n');
		if($change_url)
			document.location.href = $change_url;
			
		document.write ('<div style="width:760px; height:477px; background:#FFFFFF;" class="center"><img src="common/img/noflash.jpg" alt="ひとが、活きる未来へ。" width="760" height="477" border="0" usemap="#Map" /><map name="Map" id="Map"><area shape="rect" coords="454,420,727,446" href="company/ad.html" alt="広告にこめた想い" /></map></div>');
		
	}
}

var success_flag = false;
var url_temp = "";
var close_flag_temp = false;
function parentWindowLink( url, close_flag ){
	success_flag = false;
	url_temp = url;
	close_flag_temp = close_flag;
	if(typeof close_flag_temp == 'undefined')
		close_flag_temp = false;
	window.setTimeout("error_open()", 1000);

	if(!window.opener||window.opener.closed){
		success_flag = true;
		document.location.href = url;
/*
		var chw = window.open(url);
		chw.focus();
		if(close_flag_temp)
			window.close();
*/
	}else{
		success_flag = true;
		window.opener.location.href=url;
		window.opener.focus();
//		if(close_flag_temp)
			window.close();
	}
}

function error_open()
{
	if(!success_flag)
	{
		document.location.href = url_temp;
/*		var chw = window.open(url_temp);
		chw.focus();
		if(close_flag_temp)
			window.close();
*/
	}
}

function newWindow(url, winname){
	var chw = window.open(url,winname);
	chw.focus();
}


