// Flashのバージョン reqVersion
// Flash Player のチェック
reqVersion=8;
if(!validFlash()){
	var v=confirm("このページをご覧いただくためには最新のFLASH PLAYERが必要です。\n「OK」ボタンを押すとAdobe Flash Player ダウンロードセンター へ移動します。 ");

	if(navigator.userAgent.indexOf("Mac")!=-1){
		var flashurl = "http://www.adobe.com/shockwave/download/static/MacOSX/ShockwaveFlash/Japanese.html";
	}else{
		var flashurl = "http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash"
	}
	//var flashurl="http://www.macromedia.com/go/getflashplayer";

	if(v){location.href=flashurl;}
}

function validFlash_bu(){
if(navigator.mimeTypes && navigator.mimeTypes["application/x-shockwave-flash"]){
var plugin = navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin;
if (plugin && parseInt(plugin.description.substring(plugin.description.indexOf(".")-1))>=reqVersion)
return true;
}else if(navigator.appName && navigator.appName.indexOf("Microsoft")!=-1 && navigator.userAgent.indexOf("Windows")!=-1 && navigator.userAgent.indexOf("Windows 3.1")==-1){
return true;
}else{
return false;
}
}
function validFlash(){
	var v = get_flash_version();
	v =parseInt(v.substring(v.indexOf(".")-1))
	//v = v.indexOf(".")-1)
	//alert(v+":"+reqVersion);
	if(v>=reqVersion || v == "0"  || v == "1"  || v == "2" || v == "3" || v == "4" || v == "5"){
		return true;
	}else{
		return false;
	}
/*
	if(navigator.mimeTypes && navigator.mimeTypes["application/x-shockwave-flash"]){
	var plugin = navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin;
		if (plugin && parseInt(plugin.description.substring(plugin.description.indexOf(".")-1))>=reqVersion){
			return true;
		}else if(navigator.appName && navigator.appName.indexOf("Microsoft")!=-1 && navigator.userAgent.indexOf("Windows")!=-1 && navigator.userAgent.indexOf("Windows 3.1")==-1){
			return true;
		}else{
			return false;
		}	
	}else{
		return true;
	alert(navigator.mimeTypes["application/x-shockwave-flash"]);
	}
*/
}

function get_flash_version() {
 var version='0.0.0';
 if(navigator.plugins && navigator.mimeTypes['application/x-shockwave-flash']){
  var plugin=navigator.mimeTypes['application/x-shockwave-flash'].enabledPlugin;
  // the code below is used in SWFObject
  //var plugin=navigator.plugins['Shockwave Flash'];
  if (plugin && plugin.description) {
   // convert the description like 'Shockwave Flash 9.0 r28' into version string like '9.0.8';
   // regex is provided by SWFObject
   version=plugin.description.replace(/^[A-Za-z\s]+/, '').replace(/(\s+r|\s+b[0-9]+)/, ".");
  }
  
 } else { // in the case of Win IE
  var x='';
  try {
   // for ver.7 and later
   var axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.7");
   x=axo.GetVariable("$version");
  } catch(e) {
   try {
    // for ver.6
    axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.6");
    x="WIN 6,0,21,0";
    /*
     * GetVariable() crashes player version 6.0.22-29, and
     * players which have those versions throws when access 
     * to AllowScriptAccess
     */
    axo.AllowScriptAccess="always";
    x=axo.GetVariable("$version");
   } catch(e) {
    if (!x.match(/^WIN/)) {
     try {
      // for 4.x,5.x
      axo=null;
      axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.3");
      // version 3 player throws when you call GetVariale().
      x=axo.GetVariable("$version");
     } catch(e) {
      if (axo) {
       // for 3.x
       x="WIN 3,0,18,0";
      } else {
       try {
        // for 2.x
        axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash");
        x="WIN 2,0,0,11";
       } catch(e) {
        x="WIN 0,0,0,0";
       }
      }
     }
    }
   }
  }
  // convert ActiveX version string to our version string like '9.0.28'
  version=x.replace(/^WIN /,'').replace(/,[0-9]+$/,'').replace(/,/g,'.');
 }
 // check version string format
 // Quicktime enabled Safari returns a description in natural language
 if (version.match(/^[0-9]+\.[0-9]+\.[0-9]+$/)) {
  return version;
 } else {
  return '0.0.0';
 }
}



// MAIN部の書き出し
function writeFlashMAIN(){
	if(!validFlash()){
		document.open();  
		document.write(altContent);
		document.close();
	} else {

		if(!swfQuality){var swfQuality="high";}
		if(!swfLiveConnect){var swfLiveConnect="false";}
		if(!swfMenu){var swfMenu="false";}

// .swf ファイルの定義
		document.write('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"');
		document.write(' codebase="https://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0"');
		document.write(' id="' + swfId + '" width="' + swfWidth + '" height="' + swfHeight + '">');
		
		if(!swfBgcolor){
			document.write('<param name="wmode" value="transparent">');
			var bg='" wmode="transparent';
			
		}else{
			document.write('<param name="bgcolor" value="' + swfBgcolor + '">');
			var bg='" bgcolor="' + swfBgcolor ;
		}

		document.write('<param name="movie" value="' + swfFile + '">');
		document.write('<param name="quality" value="' + swfQuality + '">');
		document.write('<param name="menu" value="' + swfMenu + '">');
		document.write('<embed src="' + swfFile + '" width="' + swfWidth + '" height="' + swfHeight + '" menu="' + swfMenu + '" quality="' + swfQuality + '" swLiveConnect="' + swfLiveConnect +  bg + '" name="' + swfId + '" type="application/x-shockwave-flash" pluginspage="https://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash"></embed>');
		document.write('</object>');
	}
}


function SB(SoutIMG,SoverIMG,Sw,Sh,SgoURL,Starget,SonFunc,SonFuncP,SoffFunc,SoffFuncP){
	//alert("SB");
	reqVersion=8;
	swfId="swfbtn";
	swfFile ="btn.swf";
	onImgName=SoverIMG;
	offImgName=SoutIMG;
	goURL=SgoURL;
	targetWin = Starget;
	swfWidth = Sw;
	swfHeight = Sh;
	if(SonFunc){onFunc = SonFunc;}else{onFunc = "on_fade";}
	if(SonFuncP){onFuncP = SonFuncP;}else{onFuncP = 10;}
	if(SoffFunc){offFunc = SoffFunc;}else{offFunc = "off_fade";}
	if(SoffFuncP){offFuncP = SoffFuncP;}else{offFuncP = 1;}
	swfBtn();
}
function SB_sec(SoutIMG,SoverIMG,Sw,Sh,SgoURL,Starget,SonFunc,SonFuncP,SoffFunc,SoffFuncP){
	//alert("SB");
	reqVersion=8;
	swfId="swfbtn";
	swfFile ="../btn.swf";
	onImgName=SoverIMG;
	offImgName=SoutIMG;
	goURL=SgoURL;
	targetWin = Starget;
	swfWidth = Sw;
	swfHeight = Sh;
	if(SonFunc){onFunc = SonFunc;}else{onFunc = "on_fade";}
	if(SonFuncP){onFuncP = SonFuncP;}else{onFuncP = 10;}
	if(SoffFunc){offFunc = SoffFunc;}else{offFunc = "off_fade";}
	if(SoffFuncP){offFuncP = SoffFuncP;}else{offFuncP = 1;}
	swfBtn();
}
function FB(SWFDIR,IMGDIR,SoutIMG,SoverIMG,Sw,Sh,SgoURL,Starget,SonFunc,SonFuncP,SoffFunc,SoffFuncP){
	reqVersion=8;
	swfId="swfbtn";
	swfFile =SWFDIR+"btn.swf";
	onImgName=SWFDIR+IMGDIR+SoverIMG;
	offImgName=SWFDIR+IMGDIR+SoutIMG;
	goURL=SgoURL;
	targetWin = Starget;
	swfWidth = Sw;
	swfHeight = Sh;
	if(SonFunc){onFunc = SonFunc;}else{onFunc = "on_fade";}
	if(SonFuncP){onFuncP = SonFuncP;}else{onFuncP = 10;}
	if(SoffFunc){offFunc = SoffFunc;}else{offFunc = "off_fade";}
	if(SoffFuncP){offFuncP = SoffFuncP;}else{offFuncP = 1;}
	swfBtn();
}

function swfBtn(){

	if(targetWin){
		targetSTR = '&targetWin=' + targetWin ;
	}else{
		targetSTR ="";
	}
	
	swfFile = swfFile + "?onFunc="+onFunc+"&onFuncP="+onFuncP+"&offFunc="+offFunc+"&offFuncP="+offFuncP+"&onImgName="+onImgName+"&offImgName="+offImgName+"&goURL="+goURL+targetSTR;
	//alert(swfFile);
	swfBgcolor="#FFFFFF";
	swfQuality="high";
	swfLiveConnect="false";
	swfMenu="false";


	if(!validFlash()){
		document.open();  
		document.write(altContent);
		document.close();
	} else {
// .swf ファイルの定義
		document.write('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"');
		document.write(' codebase="https://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0"');
		document.write(' id="' + swfId + '" width="' + swfWidth + '" height="' + swfHeight + '">');
		document.write('<param name="wmode" value="transparent">');
		document.write('<param name="movie" value="' + swfFile + '">');
		document.write('<param name="quality" value="' + swfQuality + '">');
		document.write('<param name="bgcolor" value="' + swfBgcolor + '">');
		document.write('<param name="menu" value="' + swfMenu + '">');
		document.write('<embed src="' + swfFile + '" width="' + swfWidth + '" height="' + swfHeight + '" menu="' + swfMenu + '" quality="' + swfQuality + '" swLiveConnect="' + swfLiveConnect + '" bgcolor="' + swfBgcolor + '"name="' + swfId + '" wmode="transparent" type="application/x-shockwave-flash" pluginspage="https://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash"></embed>');
		document.write('</object>');
	}
}


//---------------------------------------------------------------------------
// 変数
//---------------------------------------------------------------------------

    var Name = new Array();
    var Value = new Array();
    var Keys = 0;

//---------------------------------------------------------------------------
// 変数を追加する(内部用)
//---------------------------------------------------------------------------
function AddString(name, value)
{
    Name[Keys]  = name;
    Value[Keys] = value;
    Keys++;
}

//---------------------------------------------------------------------------
// 指定された変数の登録番号を返す(内部用)
//---------------------------------------------------------------------------
function SearchString(name)
{
    var num = -1;

    for(ct = 0; ct <= Keys; ct++){
        if(name == Name[ct]){
            num = ct;
            break;
        }
    }
    return num;
}

//---------------------------------------------------------------------------
// 指定された変数の値を返す
//---------------------------------------------------------------------------
function GetString(name)
{
    var value = '';

    if((num = SearchString(name)) >= 0){
        value = Value[num];
    }
    return value;
}

//---------------------------------------------------------------------------
// 変数を追加・修正する
//---------------------------------------------------------------------------
function SetString(name, value)
{
    if(name.length == 0){
        return 0;
    }

    if((num = SearchString(name)) >= 0){
        Value[num] = value;
    }
    else{
        AddString(name, value);
    }
    return 0;
}

//---------------------------------------------------------------------------
// 変数を削除する
//---------------------------------------------------------------------------
function DeleteString(name)
{
    if((num = SearchString(name)) >= 0){
        Name[num]  = '';
        Value[num] = '';
    }
    return 0;
}

//---------------------------------------------------------------------------
// クエリ文字列を解析する
//---------------------------------------------------------------------------
function CreateQuetyStringList()
{
    var name  = '';
    var value = '';
    var flag  = false;

    for(ct = 1; ct <= location.search.length - 1; ct++){
        ch = location.search.charAt(ct);
        if(ch == '?'){
            flag = false;
            continue;
        }
        if(ch == '='){
            flag = true;
            if(value.length > 0){
                name = value;
            }
            value = '';
            continue;
        }
        if((ch == '&') || (ch == '#')){
            flag = false;
            if((name.length > 0) && (value.length > 0)){
                AddString(name, value);
            }
            name  = '';
            value = '';
            continue;
        }
        value += ch;
    }
    if(value.length > 0){
        if(flag == true){
            AddString(name, value);
        }
    }
    return 0;
}


    /* /_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
    charset = shift_jis

    +++ UTF8/16 ライブラリ +++


    LastModified : 2006-11/08
    
    Powered by kerry
    https://202.248.69.143/~goma/
    
    動作ブラウザ :: IE4+ , NN4.06+ , Gecko , Opera6+



    * [RFC 2279] UTF-8, a transformation format of ISO 10646
    ftp://ftp.isi.edu/in-notes/rfc2279.txt
    
    * [RFC 1738] Uniform Resource Locators (URL)
    ftp://ftp.isi.edu/in-notes/rfc1738.txt

    /_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
    
    Usage:
    
    // 文字列を UTF16 (文字コード) へ
    utf16code_array = utf.unpackUTF16( my_string );

    // 文字列を UTF8 (文字コード) へ
    utf8code_array = utf.unpackUTF8( my_string );
    
    // UTF8 (文字コード) から文字列へ。 utf.unpackUTF8() したものを元に戻す
    my_string = utf.packUTF8( utf8code_array );

    // UTF8/16 (文字コード) を文字列へ
    my_string = utf.packChar( utfCode_array );
    
    // UTF16 (文字コード) から UTF8 (文字コード) へ
    utf8code_array = utf.toUTF8( utf16code_array );
    
    // UTF8 (文字コード) から UTF16 (文字コード) へ
    utf16code_array = utf.toUTF16( utf8code_array );



    // URL 文字列へエンコード
    url_string = utf.URLencode( my_string );

    // URL 文字列からデコード
    my_string = utf.URLdecode( url_string );

    /_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/ */



utf = new function()
{
    this.unpackUTF16 = function(_str)
    {
        var i, utf16=[];
        for (i=0; i<_str.length; i++) utf16[i] = _str.charCodeAt(i);
        return utf16;
    }
    
    this.unpackChar = function(_str) 
    {
    	var utf16 = this.unpackUTF16(_str);
    	var i,n, tmp = [];
    	for (n=i=0; i<utf16.length; i++) {
    		if (utf16[i]<=0xff) tmp[n++] = utf16[i];
    		else {
    			tmp[n++] = utf16[i] >> 8;
    			tmp[n++] = utf16[i] &  0xff;
    		}	
    	}
    	return tmp;
    }
    
    this.packChar  =
    this.packUTF16 = function(_utf16)
    {
        var i, str = "";
        for (i in _utf16) str += String.fromCharCode(_utf16[i]);
        return str;
    }

    this.unpackUTF8 = function(_str)
    {
       return this.toUTF8( this.unpackUTF16(_str) );
    }

    this.packUTF8 = function(_utf8)
    {
        return this.packUTF16( this.toUTF16(_utf8) );
    }
    
    this.toUTF8 = function(_utf16)
    {
        var utf8 = [];
        var idx = 0;
        var i, j, c;
        for (i=0; i<_utf16.length; i++)
        {
            c = _utf16[i];
            if (c <= 0x7f) utf8[idx++] = c;
            else if (c <= 0x7ff)
            {
                utf8[idx++] = 0xc0 | (c >>> 6 );
                utf8[idx++] = 0x80 | (c & 0x3f);
            }
            else if (c <= 0xffff)
            {
                utf8[idx++] = 0xe0 | (c >>> 12 );
                utf8[idx++] = 0x80 | ((c >>> 6 ) & 0x3f);
                utf8[idx++] = 0x80 | (c & 0x3f);
            }
            else
            {
                j = 4;
                while (c >> (6*j)) j++;
                utf8[idx++] = ((0xff00 >>> j) & 0xff) | (c >>> (6*--j) );
                while (j--) 
                utf8[idx++] = 0x80 | ((c >>> (6*j)) & 0x3f);
            }
        }
        return utf8;
    }
    
    this.toUTF16 = function(_utf8)
    {
        var utf16 = [];
        var idx = 0;
        var i,s;
        for (i=0; i<_utf8.length; i++, idx++)
        {
            if (_utf8[i] <= 0x7f) utf16[idx] = _utf8[i];
            else 
            {
                if ( (_utf8[i]>>5) == 0x6)
                {
                    utf16[idx] = ( (_utf8[i] & 0x1f) << 6 )
                                 | ( _utf8[++i] & 0x3f );
                }
                else if ( (_utf8[i]>>4) == 0xe)
                {
                    utf16[idx] = ( (_utf8[i] & 0xf) << 12 )
                                 | ( (_utf8[++i] & 0x3f) << 6 )
                                 | ( _utf8[++i] & 0x3f );
                }
                else
                {
                    s = 1;
                    while (_utf8[i] & (0x20 >>> s) ) s++;
                    utf16[idx] = _utf8[i] & (0x1f >>> s);
                    while (s-->=0) utf16[idx] = (utf16[idx] << 6) ^ (_utf8[++i] & 0x3f);
                }
            }
        }
        return utf16;
    }
    
    this.URLencode = function(_str)
    {
        return _str.replace(/([^a-zA-Z0-9_\-\.])/g, function(_tmp, _c)
            { 
                if (_c == "\x20") return "+";
                var tmp = utf.toUTF8( [_c.charCodeAt(0)] );
                var c = "";
                for (var i in tmp)
                {
                    i = tmp[i].toString(16);
                    if (i.length == 1) i = "0"+ i;
                    c += "%"+ i;
                }
                return c;
            } );
    }

    this.URLdecode = function(_dat)
    {
        _dat = _dat.replace(/\+/g, "\x20");
        _dat = _dat.replace( /%([a-fA-F0-9][a-fA-F0-9])/g, 
                function(_tmp, _hex){ return String.fromCharCode( parseInt(_hex, 16) ) } );
        return this.packChar( this.toUTF16( this.unpackUTF16(_dat) ) );
    }
}



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_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_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];}
}
function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

function chClursor(c){
	document.body.style.cursor = c;
}

function imgWin(url){
  url="imgwin.php?imgsrc="+url;
  window.open(url, "imgWin", "scrollbars=yes,resizable=no,width=818,height=600");
}
function jump(to){
	//alert(to);
	var toArray = new Array();
	if(to=="map1" || to=="map2" || to=="map3"){
		MM_openBrWindow('map_tokyo.html','info4','width=600,height=600');
	}else if(to=="map_osaka"){
		MM_openBrWindow('map_osaka.html','info','width=600,height=400')
	}else if(to=="map_fukuoka"){
		MM_openBrWindow('map_fukuoka.html','info','width=600,height=400')
	}else{
		toArray["toppage"]="index.html";
		toArray["pressRelease"]="press.html";
		toArray["agreement"]="agreement.html";
		toArray["privacy"]="privacy.html";
		toArray["service"]="service.html";
		toArray["results"]="results.html";
		toArray["quality"]="quality.html";
		toArray["education"]="education.html";
		toArray["support"]="support.html";
		toArray["msg"]="msg.html";
		toArray["corp"]="corp.html";
		toArray["data1"]="data.html";
		toArray["map1"]="map_tokyo.html";
		toArray["map2"]="map_tokyo.html";
		toArray["map3"]="map_tokyo.html";
		toArray["map_osaka"]="map_osaka.html";
		toArray["map_fukuoka"]="map_fukuoka.html";
		toArray["recruit"]="http://hp.rhp.jp/~mpirecruit/saiyoujyouhou.html";
		toArray["ir"]="ir/index.php";
		toArray["contact"]="contact.php";
		location.href=toArray[to];
	}
}


