
//設置するswfのURL
var blogURL= "http://www.honda.co.jp/ODYSSEY/new/download/blogtool/publish/";
var foatSWF = "cardisplay.swf";
var blogSWF = "blogparts.swf";
var swfURL = blogURL + foatSWF;
var rootNode;
var body = document['CSS1Compat' == document.compatMode ? 'documentElement' : 'body'];


function display() {
	
	var MSIE;
	if(checkBrowser() == "MSIE"){
		MSIE = "true";
	}else{
		MSIE = "false";
	}
	
	var html = "";
	html += "<div id='floatFlash' style='position:absolute; left:50px; top:50px;'>";
	html += "<object classid='clsid:d27cdb6e-ae6d-11cf-96b8-444553540000' codebase='http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0' width='570' height='460' id='Flash' align='middle'>";
	html += "<param name='allowScriptAccess' value='always' />";
	html += "<param name='movie' value='" + swfURL + "' />";
	html += "<param name='scale' value='noscale' />";
	html += "<param name='salign' value='lt' />";
	html += "<param name='quality' value='high' />";
	html += "<param name='wmode' value='transparent' />";
	html += "<embed src='" + swfURL + "' quality='high' scale='noscale' salign='lt' wmode='transparent' width='570' height='460' name='Flash' id='Flash' swLiveConnect=true align='middle' allowScriptAccess='always' type='application/x-shockwave-flash' pluginspage='http://www.macromedia.com/go/getflashplayer' />";
	html += "</object>";
	html += "</div>";
	
	rootNode = document.createElement('div');
	rootNode.setAttribute('id','flash_layer');
	rootNode.style.display = 'block';
	rootNode.style.top = '0';
	rootNode.style.left = '0';
	rootNode.style.zIndex = '200';
	rootNode.style.width = getWidth()+'px';
	rootNode.style.height = getHeight()+'px';
	rootNode.innerHTML = html;
	rootNode.style.position = 'absolute';
	document.body.appendChild(rootNode);
	
	var macIE = checkMacIe();
	if( macIE ){
		window.scrollBy(0, 1);
	}
	
	//showFullWindowSize();
}

//ブラウザチェック
function checkBrowser(){
	var uName = navigator.userAgent;
	//if (uName.indexOf("Safari") > -1) return "Safari";
	if (uName.indexOf("MSIE") > -1) return "MSIE";
	return "Netscape";
}

//Mac IE ブラウザチェック
function checkMacIe(){
	var sOs = getOsName();
	var sNavigator = getNavigatorName();
	
	if((sOs == "MacOSX" || sOs == "MacOS") && sNavigator == "Explorer"){
		return true;
	} else {
		return false;
	}
}
//OS情報を取得
function getOsName()
{
	var uAgent  = navigator.userAgent.toUpperCase();
	if (uAgent.indexOf("MAC OS X") >= 0) return "MacOSX";
	if (uAgent.indexOf("MAC") >= 0) return "MacOS";
	if (uAgent.indexOf("WIN") >= 0) return "Windows";
	if (uAgent.indexOf("X11") >= 0) return "UNIX";
	return "";
}
//ブラウザ情報取得
function getNavigatorName(){
	if(navigator.IBM_HPR) return "HomepageReader";
	
	aName  = navigator.userAgent.toUpperCase();
	if (aName.indexOf("SAFARI") >= 0) return "Safari";
	if (aName.indexOf("CHIMERA") >= 0) return "Camino";
	if (aName.indexOf("OPERA") >= 0) return "Opera";
	
	aName = navigator.appName.toUpperCase();
	if (aName.indexOf("NETSCAPE") >= 0)  return "Netscape";
	if (aName.indexOf("MICROSOFT") >= 0) return "Explorer";
	return "";
}
//レイヤーをフルサイズで表示
function showFullWindowSize(){
	//alert("showFullWindowSize");
	setValignTop();
	setAlignLeft();
	setFullWindow();
	window.onresize = function(){
		setValignTop();
		setAlignLeft();
		setFullWindow();
	}
	window.onscroll = window.onresize;
}

//レイヤーをフルサイズで表示
function showFullWindowSize2(){
	//alert("showFullWindowSize2");
	setValignTop();
	setAlignLeft();
	setFullWindow();
	window.onresize = function(){
		setValignTop();
		setAlignLeft();
		setFullWindow();
	}
	window.onscroll = window.onresize;
}


//レイヤーを任意の大きさで表示(WW:レイヤー幅,HH:レイヤー高さ)
function showCustomSize(WW,HH){
	//alert("showCustomSize:"+WW+":"+HH);
	setValignTop();
	setAlignRight(WW);
	setLayerWidth(WW);
	setLayerHeight(HH);
	window.onresize = function(){
		setValignTop();
		setAlignRight(WW);
		setLayerWidth(WW);
		setLayerHeight(HH);
	}
	window.onscroll = window.onresize;
}

//レイヤーをwindowサイズと同じ大きさに変更
function setFullWindow(){
	var browser =checkBrowser();
	var WW;
	var HH;
	if(browser == "MSIE"){
		HH = body.clientHeight;
		WW = body.clientWidth;
	}else {
		HH = window.innerHeight;
		WW = window.innerWidth;
	}
	setLayerHeight(HH);
	setLayerWidth(WW);
}

//レイヤーを上部に設置
function setValignTop(){
	var browser =checkBrowser() ;
	var YY;
	if(browser == "MSIE"){
		YY = body.scrollTop;
	}else {
		YY = pageYOffset;
	}
	document.getElementById("flash_layer").style.top = YY + 'px';
}

//レイヤーを左端に設置
function setAlignLeft(){
	var XX;
	XX = 0;
	document.getElementById("flash_layer").style.left =XX + 'px';
}

//レイヤーを右端に設置(layer_WW:レイヤーの幅)
function setAlignRight(layer_WW){
	var browser =checkBrowser() ;
	var XX;
	var WW;
	if(browser == "MSIE"){
		XX = body.scrollLeft;
		WW = body.clientWidth;
	}else {
		XX = pageXOffset;
		WW = window.innerWidth;
	}
	var dX = 0;
	if(browser == "Netscape"){
		dX = -15;
	}
	document.getElementById("flash_layer").style.left =(WW - layer_WW + XX + dX) + 'px';
}

//レイヤーの幅変更
function setLayerWidth(WW){
	document.getElementById("flash_layer").style.width = WW + 'px';
}

//レイヤーの高さ変更
function setLayerHeight(HH){
	document.getElementById("flash_layer").style.height = HH + 'px';
}
//レイヤー表示
function hideLayer(){
	document.getElementById("flash_layer").style.visibility = 'hidden';
}

//レイヤー非表示
function showLayer(){
	document.getElementById("flash_layer").style.visibility = 'visible';
}

//
function getHeight() {
	var winHeight = document.all ? document.body.clientHeight : window.innerHeight;
	return winHeight;
}
//
function getWidth() {
	var winWidth = document.all ? document.body.clientWidth : window.innerWidth;
	return winWidth;
}

//レイヤー消去
function undisplay() {
	document.body.removeChild(rootNode);
}


//===============================================================================================
//
function soFlashObject() {
	this.majorVer = 0;
	this.minorVer = 0;
	this.revision = 0;
	this.beta = 0;
	this.tgtMajorVer = 1;
	this.tgtMinorVer = 0;
	this.tgtRevision = 0;
	this.altHtml = 'Please download the latest version of the free <a href="http://www.macromedia.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash" target="_blank">Flash Player</a>';
	this.w = 200;
	this.h = 200;
	this.param = {};
	this.param.allowScriptAccess = 'always';
	this.param.quality = 'high';
	this.param.menu = 'false';
	this.verChk();
};

soFlashObject.prototype.verChk = function() {
	var np = navigator.plugins,nm = navigator.mimeTypes,mt = 'application/x-shockwave-flash',p=[0,0,0,0];
	if(nm && nm[mt] && nm[mt].enabledPlugin) {
		for(var i=0; i< np.length; i++) {
			p = np[i].description;
			if(p.indexOf('Flash') >= 0) {
				p = p.split(' ').join('').replace('ShockwaveFlash','');
				if(p.indexOf('r') >= 0) p = String(p.replace('r','.') + '.0').split('.');
				else if(p.indexOf('b') >= 0) p = p.replace('b','.0.').split('.');
				break;
			}
		}
	} else if(window.ActiveXObject) {
		try {
			var f = new ActiveXObject('ShockwaveFlash.ShockwaveFlash');
			p = f.GetVariable('$version').split(' ')[1].split(',');
		} catch(e) {};
	}
	with(this) {majorVer = Number(p[0]);minorVer = Number(p[1]);revision = Number(p[2]);beta = Number(p[3])};
};

soFlashObject.prototype.flaHtml = function() {
	if(!this.src) return false;
	if(!this.id) this.id = this.src.substring(0,this.src.indexOf('.'));
	var temp1 = '<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="'+this.w+'" height="'+this.h+'" id="'+this.id+'" align="middle">';
	var temp2 = '<embed width="'+this.w+'" height="'+this.h+'" name="'+this.id+'" align="middle" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer"';
	temp1 += this.objParam('movie',this.src);
	temp2 += this.embParam('src',this.src);
	for(var prop in this.param) {temp1 += this.objParam(prop,this.param[prop]);temp2 += this.embParam(prop,this.param[prop])};
	temp1 += temp2 + ' /></object>';
	return temp1;
};

soFlashObject.prototype.objParam=function(a,b) {return '<param name="'+a+'" value="'+b+'" />'};
soFlashObject.prototype.embParam=function(a,b) {return ' '+a+'="'+b+'"'};
soFlashObject.prototype.enable=function() {var a = this.majorVer * 10000 + this.minorVer * 1000 + this.revision;var b = this.tgtMajorVer * 10000 + this.tgtMinorVer * 1000 + this.tgtRevision;return (a >= b)};
soFlashObject.prototype.flaWrite=function() {document.write(this.flaHtml())};
soFlashObject.prototype.altWrite=function() {document.write(this.altHtml)};
soFlashObject.prototype.write=function() {if(this.enable()) {this.flaWrite()} else {this.altWrite()}};
soFlashObject.prototype.getHtml=function() {if(this.enable()) {return this.flaHtml()} else {return this.altHtml}};

//create FlashObject
bp_path = blogURL;
bp_flash = new soFlashObject();
bp_flash.w = 145;
bp_flash.h = 225;
bp_flash.src = bp_path + blogSWF;
bp_flash.tgtMajorVer = 7;
bp_flash.swLiveConnect = true ;
bp_flash.write();



