/**
* XBRAND common javascript 
* @version 1.0.1 20081022
*/

var CFLaltHTML = 'Flashプレーヤーバージョン8以上をインストールして下さい';
var CFLfpver   = 8;
var CFLiewin   = navigator.userAgent.indexOf('Win') && (document.all);
var CFLflag    = false;
var CFLplugin = (navigator.mimeTypes && navigator.mimeTypes["application/x-shockwave-flash"]) ? navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin : 0;


/**
* FLASH代替用
*
*/
function setFlashHTML(html)
{
    CFLaltHTML = html;
}
/**
* swf埋め込み用
*
*/
function embedSwf(sSrc, iWidth, iHeight, altHTML)
{
if ( !sSrc ) return false;
if ( !iWidth )  return false;
if ( !iHeight ) return false;

var CFLswfuri = sSrc;
var CFLwidth  = iWidth;
var CFLheight = iHeight;

    if (CFLplugin) {
            //CFLflag = parseInt(CFLplugin.description.substring(CFLplugin.description.indexOf(".")-1)) >= CFLfpver;
            version = CFLplugin.description.replace(/^[A-Za-z\s]+/, '').replace(/(\s+r|\s+b[0-9]+)/, ".").split(".");
            CFLflag = version[0] >= CFLfpver;
    } else if (CFLiewin) {
    document.write('<script language="VBScript"\> \n');
    document.write('on error resume next \n');
    document.write('CFLflag = ( IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash." & CFLfpver )))\n');
    document.write('</script\> \n');
    }
    if ( CFLflag ) {
        document.write('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"');
        document.write(' codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0"');
        document.write(' id="CFL" width="'+ CFLwidth +'" height="'+ CFLheight +'">');
        document.write('<param name="movie" value="'+ CFLswfuri +'">');
        document.write('<param name="wmode" value="opaque">');
        document.write('<param name="loop" value="true">');
        document.write('<param name="quality" value="high">');
        document.write('<param name="allowScriptAccess" value="always">');
        document.write('<embed src="'+ CFLswfuri +'" loop="true" wmode="opaque"');
        document.write(' quality="high" swLiveConnect="false"');
        document.write(' width="'+ CFLwidth +'" height="'+ CFLheight +'"');
        document.write(' type="application/x-shockwave-flash"');
        document.write(' allowScriptAccess="always"');
        document.write(' pluginspage="http://www.macromedia.com/go/getflashplayer">');
        document.write('</embed>');
        document.write('</object>');
    } else {
        if ( altHTML ) {
            document.write('<p style="color:#ff0000;text-align:center;padding:5px;font-weight: bold;">');
            document.write(altHTML);
            document.write('<br>インストール方法は<a href="http://help.yahoo.co.jp/help/jp/common/sys/sys-10.html">こちら</a>。</p>');
        } else {
            document.write(CFLaltHTML);
        }
    }
}
function CFLerr() {
    return true;
}


function embedVideocast(iVideoID, iWidth, iHeight, altHTML)
{
if ( !iVideoID ) return false;
if ( !iWidth )  return false;
if ( !iHeight ) return false;


var CFLswfuri = 'http://i.yimg.jp/images/videocast/swf/vsuexy.swf?vid=' + iVideoID;
var CFLwidth  = iWidth;
var CFLheight = iHeight;

 
    if (CFLplugin) {
        //CFLflag = parseInt(CFLplugin.description.substring(CFLplugin.description.indexOf(".")-1)) >= CFLfpver;
        version = CFLplugin.description.replace(/^[A-Za-z\s]+/, '').replace(/(\s+r|\s+b[0-9]+)/, ".").split(".");
        CFLflag = version[0] >= CFLfpver;
    } else if (CFLiewin) {
        document.write('<script language="VBScript"\> \n');
        document.write('on error resume next \n');
        document.write('CFLflag = ( IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash." & CFLfpver )))\n');
        document.write('</script\> \n');
    }
    if ( CFLflag ) {
        document.write('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"');
        document.write(' codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0"');
        document.write(' id="CFL" width="'+ CFLwidth +'" height="'+ CFLheight +'">');
        document.write('<param name="movie" value="'+ CFLswfuri +'">');
        document.write('<param name="wmode" value="opaque">');
        document.write('<param name="loop" value="true">');
        document.write('<param name="quality" value="high">');
        document.write('<param name="allowScriptAccess" value="always">');
        document.write('<embed src="'+ CFLswfuri +'" loop="true" wmode="opaque"');
        document.write(' quality="high" swLiveConnect="false"');
        document.write(' width="'+ CFLwidth +'" height="'+ CFLheight +'"');
        document.write(' type="application/x-shockwave-flash"');
        document.write(' allowScriptAccess="always"');
        document.write(' pluginspage="http://www.macromedia.com/go/getflashplayer">');
        document.write('</embed>');
        document.write('</object>');
    } else {
        if ( altHTML ) {
            document.write('<p style="color:#ff0000;text-align:center;padding:5px;font-weight: bold;">');
            document.write(altHTML);
            document.write('<br>インストール方法は<a href="http://help.yahoo.co.jp/help/jp/common/sys/sys-10.html">こちら</a>。</p>');
        } else {
            document.write(CFLaltHTML);
        }
    }
}

function embedYoutube(iVideoID, iWidth, iHeight, altHTML)
{
if ( !iVideoID ) return false;
if ( !iWidth )  return false;
if ( !iHeight ) return false;

var CFLswfuri = 'http://www.youtube.com/v/' + iVideoID + '&hl=ja_JP&fs=1&rel=0';
var CFLwidth  = iWidth;
var CFLheight = iHeight;
 
    if (CFLplugin) {
        version = CFLplugin.description.replace(/^[A-Za-z\s]+/, '').replace(/(\s+r|\s+b[0-9]+)/, ".").split(".");
        CFLflag = version[0] >= CFLfpver;
    } else if (CFLiewin) {
        document.write('<script language="VBScript"\> \n');
        document.write('on error resume next \n');
        document.write('CFLflag = ( IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash." & CFLfpver )))\n');
        document.write('</script\> \n');
    }
    if ( CFLflag ) {
        document.write('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"');
        document.write(' codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0"');
        document.write(' id="CFL" width="'+ CFLwidth +'" height="'+ CFLheight +'">');
        document.write('<param name="movie" value="'+ CFLswfuri +'">');
        document.write('<param name="wmode" value="opaque">');
        document.write('<param name="loop" value="true">');
        document.write('<param name="quality" value="high">');
        document.write('<param name="allowFullScreen" value="true">');
        document.write('<param name="allowScriptAccess" value="always">');
        document.write('<embed src="'+ CFLswfuri +'" loop="true" wmode="opaque"');
        document.write(' quality="high" swLiveConnect="false"');
        document.write(' width="'+ CFLwidth +'" height="'+ CFLheight +'"');
        document.write(' type="application/x-shockwave-flash"');
        document.write(' allowfullscreen="true"');
        document.write(' allowScriptAccess="always"');
        document.write(' pluginspage="http://www.macromedia.com/go/getflashplayer">');
        document.write('</embed>');
        document.write('</object>');
    } else {
        if ( altHTML ) {
            document.write('<p style="color:#ff0000;text-align:center;padding:5px;font-weight: bold;">');
            document.write(altHTML);
            document.write('<br>インストール方法は<a href="http://help.yahoo.co.jp/help/jp/common/sys/sys-10.html">こちら</a>。</p>');
        } else {
            document.write(CFLaltHTML);
        }
    }
}
