var MM_contentVersion = 9;
var plugin = (navigator.mimeTypes && navigator.mimeTypes["application/x-shockwave-flash"]) ? navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin : 0;

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');
}

var movieName = '';
function setMovieName( $name )
{
	movieName = $name;
}

function printMovie ( $swffile, $width, $height, $bgcolor, $change_image, $change_url )
{
	// 初期化
	var pTmp = "";
	var pNo = "";
	// URL取得
	var pTmp = location.href;
	// pナンバー取得
	pAry = pTmp.split('mode=');
	if(pAry.length > 1)
		pNo = pAry[1];
	else
		pNo = '';
	
	var movie_name = movieName;
	if(movie_name == '')
	{
		movie_name = 'movie';
	}

	if ( MM_FlashCanPlay )
	{
		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="bgcolor" value="'+$bgcolor+'" \/>' +
			(pNo != ''?'<param name="flashvars" value="mode=' + pNo + '" \/>' : '') +
			'<embed 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="mode=' + pNo + '"' : '') +
			'\/>' +
			'<\/object>'
		);
	}
	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="text-align:center;background:url(img/top/noscript.jpg) no-repeat bottom center;"><a href="http://get.adobe.com/jp/flashplayer/" target="_blank"><img src="img/top/noscript.jpg" alt="AIMANT JEWELRY エマンジュエリー：このサイトではJavaScriptを使用しています。ブラウザの設定で有効にしてください。" width="900" height="600" /></a></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();
}

