function check_plugin(version){
	plugin = (navigator.mimeTypes && navigator.mimeTypes["application/x-shockwave-flash"]) ? navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin : 0;
	if ( plugin ) {
		plugin = parseInt(plugin.description.match(/\d+\.\d+/)) >= version;
	}
	else if (navigator.userAgent && navigator.userAgent.indexOf("MSIE")>=0 && (navigator.appVersion.indexOf("Win") != -1)) {
		check_activex(version);
	}
	return plugin;
}
function set_flash(ver,file,altimg,id,width,height,menu,bgcolor,quality,scale,wmode,align){
	flg = check_plugin(ver);
	if(flg) {
		if(quality==null){
			quality='high';
		}
		document.write('<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"');
		document.write('  codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0" ');
		document.write(' id="'+id+'" width="'+width+'" height="'+height+'">');
		document.write('<param name="movie" value="'+file+'">');
		document.write('<param name="menu" value="'+menu+'">');
		document.write('<param name="quality" value="'+quality+'">');
		if(scale!=null){
			document.write('<param name=""scale" value="'+scale+'">');
		}
		if(align!=null){
			document.write('<param name="salign" value="'+align+'">');
		}
		if(wmode!=null){
			document.write('<param name="wmode" value="'+wmode+'">');
		}
		document.write('<param name="bgcolor" value="#'+bgcolor+'">'); 
		document.write('<embed src="'+file+'" menu="'+menu+'" quality="'+quality+'" bgcolor="#'+bgcolor+'"');
		if(scale!=null){
			document.write(' scale="'+scale+'"');
		}
		if(align!=null){
			document.write(' salign="'+align+'"');
		}
		if(wmode!=null){
			document.write(' wmode="'+wmode+'"');
		}
		document.write(' width="'+width+'" height="'+height+'" name="'+id+'"');
		document.write(' type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?p1_prod_version=shockwaveflash">');
		document.write('</embed>');
		document.write('</OBJECT>');
	} else {
		//document.write('<a href="http://www.macromedia.com/shockwave/download/download.cgi?P5_Language=Japanese&Lang=Japanese&P1_Prod_Version=ShockwaveFlash&Lang=Japanese" target="_blank"><img src="'+altimg+'" border="0" id="'+id+'" name="'+id+'"></a>');
		document.write('<img src="'+altimg+'" border="0" id="'+id+'" name="'+id+'" usemap="#'+id+'"></a>');
		document.write('<map name="main_menu">');
		document.write('<area shape="rect" coords="-1,0,90,90" href="JavaScript:jump_menu(1);">');
		document.write('<area shape="rect" coords="95,0,185,90" href="JavaScript:jump_menu(2);">');
		document.write('<area shape="rect" coords="190,0,280,90" href="JavaScript:jump_menu(3);">');
		document.write('<area shape="rect" coords="285,0,375,90" href="JavaScript:jump_menu(4);">');
		document.write('<area shape="rect" coords="380,0,470,90" href="JavaScript:jump_menu(5);">');
		document.write('<area shape="rect" coords="475,0,565,90" href="JavaScript:jump_menu(6);">');
		document.write('<area shape="rect" coords="570,0,660,90" href="JavaScript:jump_menu(7);">');
		document.write('</map>');
	}
}
function jump_menu(n){
	var ary=["","info/index.html","character/index.html","story/index.html","goods/index.html","download/index.html","mobile/index.html","staff/index.html"];
	var url=dir+ary[n];
	if(url!=dir){
		if(self=="tvasahi_contents"){
		parent.tvasahi_contents.location.href=url;
		}else{
			parent.parent.tvasahi_contents.location.href=url;
		}
	}
}
function set_SplashFlash(ver,file,altimg,id,width,height,menu,bgcolor,quality,scale,wmode,align){
	flg = check_plugin(ver);
	if(flg) {
		if(quality==null){
			quality='high';
		}
		document.write('<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"');
		document.write('  codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" ');
		document.write(' id="'+id+'" width="'+width+'" height="'+height+'">');
		document.write('<param name="movie" value="'+file+'">');
		document.write('<param name="menu" value="'+menu+'">');
		document.write('<param name="quality" value="'+quality+'">');
		if(scale!=null){
			document.write('<param name=""scale" value="'+scale+'">');
		}
		if(align!=null){
			document.write('<param name="salign" value="'+align+'">');
		}
		if(wmode!=null){
			document.write('<param name="wmode" value="'+wmode+'">');
		}
		document.write('<param name="bgcolor" value="#'+bgcolor+'">'); 
		document.write('<embed src="'+file+'" menu="'+menu+'" quality="'+quality+'" bgcolor="#'+bgcolor+'"');
		if(scale!=null){
			document.write(' scale="'+scale+'"');
		}
		if(align!=null){
			document.write(' salign="'+align+'"');
		}
		if(wmode!=null){
			document.write(' wmode="'+wmode+'"');
		}
		document.write(' width="'+width+'" height="'+height+'" name="'+id+'"');
		document.write(' type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?p1_prod_version=shockwaveflash">');
		document.write('</embed>');
		document.write('</object>');
	} else {
		//document.write('<a href="http://www.macromedia.com/shockwave/download/download.cgi?P5_Language=Japanese&Lang=Japanese&P1_Prod_Version=ShockwaveFlash&Lang=Japanese" target="_blank"><img src="'+altimg+'" border="0" id="'+id+'" name="'+id+'"></a>');
		document.writeln('<img src="'+altimg+'" border="0" id="'+id+'" name="'+id+'" usemap="#'+id+'"></a>');
		document.writeln('<map name="top_menu">');
		document.writeln('<area shape="circle" coords="688,325,82" href="JavaScript:jump_btn(0);">');
		document.writeln('<area shape="circle" coords="688,144,82" href="JavaScript:jump_btn(1);">');
		document.writeln('<area shape="rect" coords="288,510,565,570" href="JavaScript:jump_btn(0);">');
		document.writeln('<area shape="rect" coords="575,510,850,570" href="JavaScript:jump_btn(1);">');
		document.writeln('<area shape="rect" coords="340,575,415,590" href="http://www.tv-asahi.co.jp/rights/">');
		document.writeln('</map>');
	}
}
function jump_btn(n){
	var ary=["y/5th/index.html","index_top.html"];
	var url=dir+ary[n];
	if(url!=dir){
		if(self=="tvasahi_contents"){
		parent.tvasahi_contents.location.href=url;
		}else{
			parent.parent.tvasahi_contents.location.href=url;
		}
	}
}
function set_CalFlash(ver,file,altimg,id,width,height,menu,bgcolor,quality,scale,wmode,align){
	flg = check_plugin(ver);
	if(flg) {
		if(quality==null){
			quality='high';
		}
		document.write('<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"');
		document.write('  codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" ');
		document.write(' id="'+id+'" width="'+width+'" height="'+height+'">');
		document.write('<param name="movie" value="'+file+'">');
		document.write('<param name="menu" value="'+menu+'">');
		document.write('<param name="quality" value="'+quality+'">');
		if(scale!=null){
			document.write('<param name=""scale" value="'+scale+'">');
		}
		if(align!=null){
			document.write('<param name="salign" value="'+align+'">');
		}
		if(wmode!=null){
			document.write('<param name="wmode" value="'+wmode+'">');
		}
		document.write('<param name="bgcolor" value="#'+bgcolor+'">'); 
		document.write('<embed src="'+file+'" menu="'+menu+'" quality="'+quality+'" bgcolor="#'+bgcolor+'"');
		if(scale!=null){
			document.write(' scale="'+scale+'"');
		}
		if(align!=null){
			document.write(' salign="'+align+'"');
		}
		if(wmode!=null){
			document.write(' wmode="'+wmode+'"');
		}
		document.write(' width="'+width+'" height="'+height+'" name="'+id+'"');
		document.write(' type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?p1_prod_version=shockwaveflash">');
		document.write('</embed>');
		document.write('</OBJECT>');
		document.write('<p class="m" style="padding:0px;">');
		document.write('※カレンダーの中のお母さんのシルエットをクリックしても,記事が見られます！');
		document.write('</p>');
	}
}
function set_CountFlash(ver,file,altimg,id,width,height,menu,bgcolor,quality,scale,wmode,align){
	flg = check_plugin(ver);
	if(flg) {
		if(quality==null){
			quality='high';
		}
		document.write('<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"');
		document.write('  codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" ');
		document.write(' id="'+id+'" width="'+width+'" height="'+height+'">');
		document.write('<param name="movie" value="'+file+'">');
		document.write('<param name="menu" value="'+menu+'">');
		document.write('<param name="quality" value="'+quality+'">');
		if(scale!=null){
			document.write('<param name=""scale" value="'+scale+'">');
		}
		if(align!=null){
			document.write('<param name="salign" value="'+align+'">');
		}
		if(wmode!=null){
			document.write('<param name="wmode" value="'+wmode+'">');
		}
		document.write('<param name="bgcolor" value="#'+bgcolor+'">'); 
		document.write('<embed src="'+file+'" menu="'+menu+'" quality="'+quality+'" bgcolor="#'+bgcolor+'"');
		if(scale!=null){
			document.write(' scale="'+scale+'"');
		}
		if(align!=null){
			document.write(' salign="'+align+'"');
		}
		if(wmode!=null){
			document.write(' wmode="'+wmode+'"');
		}
		document.write(' width="'+width+'" height="'+height+'" name="'+id+'"');
		document.write(' type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?p1_prod_version=shockwaveflash">');
		document.write('</embed>');
		document.write('</OBJECT>');
	}
}

function jump_page(n){
	var ary=["y/5th/news/index.html"];
	var url=dir+ary[n];
	if(url!=dir){
		if(self=="tvasahi_contents"){
		parent.tvasahi_contents.location.href=url;
		}else{
			parent.parent.tvasahi_contents.location.href=url;
		}
	}
}
function style(pp){
	if(navigator.appVersion.indexOf("Mac",0) != -1) { var os= "mac"; }
	else {var os= "win"; }
	cssfile1= pp + "css/" + os + ".css";
	cssfile2= pp + "css/main.css";
	document.writeln("<link rel='stylesheet' type='text/css' href='",cssfile1,"'>");
	document.writeln("<link rel='stylesheet' type='text/css' href='",cssfile2,"'>");
}
style(dir);
if(!document.layer){
	document.write('<script language="VBScript" src="'+dir+'js/plugin_detect.vb"></script>');
}
function preloadImages() {
	var d=document; if(d.images){ if(!d.p) d.p=new Array();
		var i,j=d.p.length,a=preloadImages.arguments; for(i=0; i<a.length; i++)
		if (a[i].indexOf("#")!=0){ d.p[j]=new Image; d.p[j++].src=a[i];}}
}

function swapImgRestore() {
	var i,x,a=document.sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function findObj(n, d) {
	var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
		d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
	if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
	for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=findObj(n,d.layers[i].document);
	if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function swapImage() {
	var i,j=0,x,a=swapImage.arguments; document.sr=new Array; for(i=0;i<(a.length-2);i+=3)
		if ((x=findObj(a[i]))!=null){document.sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
//070120
function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
//070219ポップ
function openPop(popUrl,windowId,myWidth, myHeight){
	var Wleft=(screen.width-myWidth)/2;
	var Wtop=(screen.height-myHeight)/2;
	var win1=window.open(popUrl,windowId,'scrollbars=no,width='+myWidth+',height='+myHeight+',left='+Wleft+',top='+Wtop);
	win1.window.focus();
}
function close_win(){
	var nvua = navigator.userAgent;
	if(nvua.indexOf('MSIE') >= 0){
	if(nvua.indexOf('MSIE 5.0') == -1) {
	top.opener = '';
	}
	}
	else if(nvua.indexOf('Gecko') >= 0){
	top.name = 'CLOSE_WINDOW';
	wid = window.open('','CLOSE_WINDOW');
	}
	top.close();
}

function imgChg(imgObj, imgSts){
  var is = imgObj.src; var il = is.length;var ip = is.lastIndexOf('.');
  if(isNaN(imgSts)){var imgURL = imgSts;}
  else if(imgSts){var imgURL = onImgName(is, true);}
  else if(is.substr(ip - 3, 3) == '_on'){var imgURL = onImgName(is, false);}
  else {var imgURL = is;}
  imgObj.src = imgURL;
}
function onImgName(imgSrc, imgSts){
	if(imgSts){
		var ip = imgSrc.lastIndexOf('.');
		return imgSrc.substr(0, ip) + '_on' + imgSrc.substring(ip);
	} else{
		return imgSrc.replace('_on\.', '.');
	}
}
function imgOver(imgObj){
	imgChg(imgObj, true);
}
function imgOut(imgObj){
	imgChg(imgObj, false);
}


//080423 オープニングムービー
function set_opm(ver,file,altimg,id,width,height,bgcolor,quality){
	flg = check_plugin(ver);
	if(flg) {
		if(quality==null){
			quality='high';
		}
		document.write('<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"');
		document.write('  codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" ');
		document.write(' id="'+id+'" width="'+width+'" height="'+height+'">');
		document.write('<param name="allowScriptAccess" value="sameDomain" />');
		document.write('<param name="allowFullScreen" value="false" />');
		document.write('<param name="movie" value="'+file+'">');
		document.write('<param name="loop" value="false" />');
		document.write('<param name="quality" value="'+quality+'">');
		document.write('<param name="bgcolor" value="#'+bgcolor+'">'); 
		document.write('<embed src="'+file+'" quality="'+quality+'" bgcolor="#'+bgcolor+'"  loop="false"');
		document.write(' width="'+width+'" height="'+height+'" name="'+id+'"  id="'+id+'"');
		document.write(' allowScriptAccess="sameDomain" allowFullScreen="false" swLiveConnect=true type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer">');
		document.write('</object>');		
	} else {
		//document.write('<a href="http://www.macromedia.com/shockwave/download/download.cgi?P5_Language=Japanese&Lang=Japanese&P1_Prod_Version=ShockwaveFlash&Lang=Japanese" target="_blank"><img src="'+altimg+'" border="0" id="'+id+'" name="'+id+'"></a>');
		document.writeln('<img src="'+altimg+'" border="0" id="'+id+'" name="'+id+'" usemap="#'+id+'"></a>');
		document.writeln('<map name="'+id+'">');
		document.writeln('<area shape="rect" coords="575,509,850,569" href="index_top.html">');
		document.writeln('</map>');
	}
}
