﻿/*
 * BlogParts with FBP_float
 * by Hidemaro Mukai (maro@mother.co.jp)
 * Copyright (c) 2009 Mother inc.
 */
var BP = function () {
	//=========================================================================
	// 設定
	//--------------------------------------------
	// 基本設定
	//--------------------------------------------
	//-- Flashプラグイン無しorバージョン不足の際の代替
	var altText = '<a href="http://get.adobe.com/jp/flashplayer/" target="_blank"><img src="http://mai.mao-channel.jp/download/parts/sp/images0/noscript.gif" border="0" /></a>';
	
	//--------------------------------------------
	// swf定義
	//--------------------------------------------
	//-- ページに貼るswfのパス
	var launcher_swf = 'http://mai.mao-channel.jp/download/parts/sp/swf/blogparts.swf';
	//-- Flashバージョン指定
	var launcher_ver = 8;
	//-- ページに貼るswfの横幅
	var launcher_w = 202;
	//-- ページに貼るswfの高さ
	var launcher_h = 304;
	//-- swfパラメータ(flashParams)
	var launcher_params = {
		wmode: "transparent",
		menu: "false",
		allowScriptAccess: "always"
	}
	//-- swfパラメータ(flashVars)
	var launcher_vars = {};
	
	//-- フローティングswfのパス
	var float_swf = 'http://mai.mao-channel.jp/download/parts/sp/swf/index.swf';
	
	//-- Flashバージョン指定
	var float_ver = 8;
	//-- フローティングswfの横幅
	var float_w = 0;
	//-- フローティングswfの高さ
	var float_h = 0;
	//-- swfパラメータ(flashParams)
	var float_params = {
		wmode: "transparent",
		menu: "false",
		allowScriptAccess: "always"
	}
	//-- swfパラメータ(flashVars)
	var float_vars = {};
	
	//--------------------------------------------
	// フローティング定義
	//--------------------------------------------
	var FBP_options = {
		//-- 余白に背景を表示する(true/false)
		background: true,
		//-- 余白のスタイル
		backgroundStyle: {
			top: "0px",
			left: "0px",
			width: "100%",
			background: "#000",
			filter: "alpha(opacity=30)",
			"-moz-opacity": 0.3,
			opacity: 0.3
		},
		//-- 余白部分をクリックしたら閉じる(true/false)
		backgroundClose: false
	}
	// 設定ここまで
	//=========================================================================
	
	function init(){
		document.write('<div id="BP_launcher" style="width:'+launcher_w+'px;height:'+launcher_h+'px">'+altText+'</div>');
		var so = new FBP_SWFObject(launcher_swf, 'BP_launcher_swf', launcher_w, launcher_h, launcher_ver);
		for(i in launcher_params){
			so.addParam(i, launcher_params[i]);
		}
		for(i in launcher_vars){
			so.addVariable(i, launcher_vars[i]);
		}
		so.write('BP_launcher');
		FBP_float.init(FBP_options, float_params, float_vars);
	}
	return {
		init: function (){
			init();
		},
		open: function (){
			FBP_float.show(float_swf, 'BP_float', float_w, float_h, float_ver);
			return true;
	    },
	    close: function (){
	    	FBP_float.close('BP_float');
			return true;
	    }
	}
}();


/**
 * FBP_float v1.0
 * by Hidemaro Mukai(maro@mother.co.jp)
 * Copyright (c) 2009 Mother inc.
 */
 var FBP_float = function () {
	var flashParams = {
		wmode: "transparent",
		menu: "false",
		allowScriptAccess: "always"
	}
	var flashVars = {};
	var flashAttributes = {};
	var elements = [];
	var options = {
		background: false,
		backgroundStyle: {},
		backgroundClose: false}
	var GM={};
	if(window.innerWidth){
		GM.viewW=function(){return window.innerWidth;};
		GM.viewH=function(){return window.innerHeight;};
		GM.scrH=function(){return window.pageXOffset;};
		GM.scrV=function(){return window.pageYOffset;};
	}else if(document.documentElement && document.documentElement.clientWidth){
		GM.viewW=function(){return document.documentElement.clientWidth;};
		GM.viewH=function(){return document.documentElement.clientHeight;};
		GM.scrH=function(){return document.documentElement.scrollLeft;};
		GM.scrV=function(){return document.documentElement.scrollTop};
	}else if(document.body.clientWidth){
		GM.viewW = function(){return document.body.clientWidth;};
		GM.viewH=function(){return document.body.clientHeight;};
		GM.scrH=function(){return document.body.scrollLeft;};
		GM.scrV=function(){return document.body.scrollTop};
	}
	function showFloat(swf, elementId, width, height, pluginVer){
		if (isIE6()) {
			var ie6H = (document.body.scrollHeight > document.body.offsetHeight ? document.body.scrollHeight : document.body.offsetHeight);
			options.backgroundStyle.height = ie6H;
			if (document.getElementById("FBP_HideSelect") === null) {
				addElement("FBP_HideSelect", "iframe", 0, ie6H, 9998, {
					top: "0px",
					left: "0px",
					"background-color": "#fff",
					border: "none",
					filter: "alpha(opacity=0)",
					"-moz-opacity": 0,
					opacity: 0
				}, false);
			}
		}
		if (options.background){
			addElement(elementId+'_bg', "DIV", 0, 0, 9999, options.backgroundStyle, false);
			if (options.backgroundClose){
				document.getElementById(elementId+'_bg').onclick = function(){
					closeFroat(elementId);
				}
			}
		}
		addElement(elementId, "DIV", width, height, 10000);
		if (width == 0){
			width = "100%";
		}
		if (height == 0){
			height = "100%";
		}
		var so = new FBP_SWFObject(swf, elementId+'_swf', width, height, pluginVer);
		var i;
		for(i in flashParams){
			so.addParam(i, flashParams[i]);
		}
		for(i in flashVars){
			so.addVariable(i, flashVars[i]);
		}
		so.write(elementId);
		elements.push(elementId);
	}
	function closeFroat(elementId){
		removeElement(elementId);
		var elemAry = [];
		for(var i=0;i<elements.length;i++){
			if (elements[i] != elementId){
				elemAry.push(elements[i]);
			}
			elements = elemAry;
		}
		if (elements.length > 0){
			return true;
		}
		if (options.background){
			removeElement(elementId+'_bg');
		}
		if (isIE6()) {
			removeElement("FBP_HideSelect");
		}
		
	}
	function addElement(elementId, type, width, height, zindex, styles, centering){
		if(document.getElementById(elementId) !== null){
			return false;
		}
		var elem = document.createElement(type);
		elem.id = elementId;
		if (isIE6()){
			elem.style.position = "absolute";
		}else{
			elem.style.position = "fixed";
		}
		elem.style.display = "block";
		if (zindex){
			elem.style.zIndex = zindex;
		}else{
			elem.style.zIndex = 2500;
		}
		if (width){
			elem.style.width = width+'px';
		}else if(isIE6()){
			elem.style.width = GM.viewW()+'px';
		}else{
			elem.style.width = "100%";
		}
		if (height){
			elem.style.height = height+'px';
		}else if(isIE6()){
			elem.style.height = GM.viewH()+'px';
		}else{
			elem.style.height = "100%";
		}
		for(var i in styles){
			elem.style[i] = styles[i];
		}
		document.getElementsByTagName('body')[0].appendChild(elem);
		if (centering !== false){
			if (isIE6()){
				setInterval(function(){setCenterElem(elementId, width, height);}, 100);
			}else{
				if (height == 0){
					elem.style.top = 0;
				}else{
					elem.style.top = '50%';
					elem.style.marginTop = '-'+parseInt(elem.style.height, 10)/2+'px';
				}
				if (width == 0){
					elem.style.left = 0;
				}else{
					elem.style.left = '50%';
					elem.style.marginLeft = '-'+parseInt(elem.style.width, 10)/2+'px';
				}
			}
		}
	}
	function removeElement(elementId){
		elem = document.getElementById(elementId);
		if (!elem){
			return false;
		}
		document.getElementsByTagName('body')[0].removeChild(elem);
	}
	function setCenterElem(elementId, w, h){
		var elem = document.getElementById(elementId);
		if(!elem){
			return false;
		}
		if (w==0){
			elem.style.width = GM.viewW()+'px';
		}
		if (h==0){
			elem.style.height = GM.viewH()+'px';
		}
		elem.style.top=(GM.viewH()-parseInt(elem.style.height, 10))/2+GM.scrV()+'px';
		elem.style.left=(GM.viewW()-parseInt(elem.style.width, 10))/2+GM.scrH()+'px';
	}
	function isIE6(){
		if (typeof document.body.style.maxHeight != "undefined") {
			return false;
		} else {
			return true;
		} 
	}
	return {
		init: function(o, p, v, a){
			var i;
			for(i in o){
				if (i == "backgroundStyle"){
					for(var s in o[i]){
						options[i][s] = o[i][s];
					}
				}else{
					options[i] = o[i];
				}
			}
			for(i in p){
				flashParams[i] = p[i];
			}
			for(i in v){
				flashVars[i] = v[i];
			}
			for(i in a){
				flashAttributes[i] = a[i];
			}
		},
		show: function(swf, elementId, width, height, pluginVer){
			showFloat(swf, elementId, width, height, pluginVer);
		},
		close: function(elementId){
			removeElement(elementId)
			if (options.background){
				removeElement(elementId+'_bg');
			}
			if (isIE6()){
				removeElement('FBP_HideSelect');
			}
		}
	}
}();
/**
 * SWFObject v1.5: Flash Pelem detection and embed - http://blog.deconcept.com/swfobject/
 *
 * SWFObject is (c) 2007 Geoff Stearns and is released under the MIT License:
 * http://www.opensource.org/licenses/mit-license.php
 *
 */
if(typeof deconcept=="undefined"){var deconcept=new Object();}if(typeof deconcept.util=="undefined"){deconcept.util=new Object();}if(typeof deconcept.SWFObjectUtil=="undefined"){deconcept.SWFObjectUtil=new Object();}deconcept.SWFObject=function(_1,id,w,h,_5,c,_7,_8,_9,_a){if(!document.getElementById){return;}this.DETECT_KEY=_a?_a:"detectflash";this.skipDetect=deconcept.util.getRequestParameter(this.DETECT_KEY);this.params=new Object();this.variables=new Object();this.attributes=new Array();if(_1){this.setAttribute("swf",_1);}if(id){this.setAttribute("id",id);}if(w){this.setAttribute("width",w);}if(h){this.setAttribute("height",h);}if(_5){this.setAttribute("version",new deconcept.PelemVersion(_5.toString().split(".")));}this.installedVer=deconcept.SWFObjectUtil.getPelemVersion();if(!window.opera&&document.all&&this.installedVer.major>7){deconcept.SWFObject.doPrepUnload=true;}if(c){this.addParam("bgcolor",c);}var q=_7?_7:"high";this.addParam("quality",q);this.setAttribute("useExpressInstall",false);this.setAttribute("doExpressInstall",false);var _c=(_8)?_8:window.location;this.setAttribute("xiRedirectUrl",_c);this.setAttribute("redirectUrl","");if(_9){this.setAttribute("redirectUrl",_9);}};deconcept.SWFObject.prototype={useExpressInstall:function(_d){this.xiSWFPath=!_d?"expressinstall.swf":_d;this.setAttribute("useExpressInstall",true);},setAttribute:function(_e,_f){this.attributes[_e]=_f;},getAttribute:function(_10){return this.attributes[_10];},addParam:function(_11,_12){this.params[_11]=_12;},getParams:function(){return this.params;},addVariable:function(_13,_14){this.variables[_13]=_14;},getVariable:function(_15){return this.variables[_15];},getVariables:function(){return this.variables;},getVariablePairs:function(){var _16=new Array();var key;var _18=this.getVariables();for(key in _18){_16[_16.length]=key+"="+_18[key];}return _16;},getSWFHTML:function(){var _19="";if(navigator.plugins&&navigator.mimeTypes&&navigator.mimeTypes.length){if(this.getAttribute("doExpressInstall")){this.addVariable("MMpelemType","PlugIn");this.setAttribute("swf",this.xiSWFPath);}_19="<embed type=\"application/x-shockwave-flash\" src=\""+this.getAttribute("swf")+"\" width=\""+this.getAttribute("width")+"\" height=\""+this.getAttribute("height")+"\" style=\""+this.getAttribute("style")+"\"";_19+=" id=\""+this.getAttribute("id")+"\" name=\""+this.getAttribute("id")+"\" ";var _1a=this.getParams();for(var key in _1a){_19+=[key]+"=\""+_1a[key]+"\" ";}var _1c=this.getVariablePairs().join("&");if(_1c.length>0){_19+="flashvars=\""+_1c+"\"";}_19+="/>";}else{if(this.getAttribute("doExpressInstall")){this.addVariable("MMpelemType","ActiveX");this.setAttribute("swf",this.xiSWFPath);}_19="<object id=\""+this.getAttribute("id")+"\" classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" width=\""+this.getAttribute("width")+"\" height=\""+this.getAttribute("height")+"\" style=\""+this.getAttribute("style")+"\">";_19+="<param name=\"movie\" value=\""+this.getAttribute("swf")+"\" />";var _1d=this.getParams();for(var key in _1d){_19+="<param name=\""+key+"\" value=\""+_1d[key]+"\" />";}var _1f=this.getVariablePairs().join("&");if(_1f.length>0){_19+="<param name=\"flashvars\" value=\""+_1f+"\" />";}_19+="</object>";}return _19;},write:function(_20){if(this.getAttribute("useExpressInstall")){var _21=new deconcept.PelemVersion([6,0,65]);if(this.installedVer.versionIsValid(_21)&&!this.installedVer.versionIsValid(this.getAttribute("version"))){this.setAttribute("doExpressInstall",true);this.addVariable("MMredirectURL",escape(this.getAttribute("xiRedirectUrl")));document.title=document.title.slice(0,47)+" - Flash Pelem Installation";this.addVariable("MMdoctitle",document.title);}}if(this.skipDetect||this.getAttribute("doExpressInstall")||this.installedVer.versionIsValid(this.getAttribute("version"))){var n=(typeof _20=="string")?document.getElementById(_20):_20;n.innerHTML=this.getSWFHTML();return true;}else{if(this.getAttribute("redirectUrl")!=""){document.location.replace(this.getAttribute("redirectUrl"));}}return false;}};deconcept.SWFObjectUtil.getPelemVersion=function(){var _23=new deconcept.PelemVersion([0,0,0]);if(navigator.plugins&&navigator.mimeTypes.length){var x=navigator.plugins["Shockwave Flash"];if(x&&x.description){_23=new deconcept.PelemVersion(x.description.replace(/([a-zA-Z]|\s)+/,"").replace(/(\s+r|\s+b[0-9]+)/,".").split("."));}}else{if(navigator.userAgent&&navigator.userAgent.indexOf("Windows CE")>=0){var axo=1;var _26=3;while(axo){try{_26++;axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash."+_26);_23=new deconcept.PelemVersion([_26,0,0]);}catch(e){axo=null;}}}else{try{var axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.7");}catch(e){try{var axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.6");_23=new deconcept.PelemVersion([6,0,21]);axo.AllowScriptAccess="always";}catch(e){if(_23.major==6){return _23;}}try{axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash");}catch(e){}}if(axo!=null){_23=new deconcept.PelemVersion(axo.GetVariable("$version").split(" ")[1].split(","));}}}return _23;};deconcept.PelemVersion=function(_29){this.major=_29[0]!=null?parseInt(_29[0]):0;this.minor=_29[1]!=null?parseInt(_29[1]):0;this.rev=_29[2]!=null?parseInt(_29[2]):0;};deconcept.PelemVersion.prototype.versionIsValid=function(fv){if(this.major<fv.major){return false;}if(this.major>fv.major){return true;}if(this.minor<fv.minor){return false;}if(this.minor>fv.minor){return true;}if(this.rev<fv.rev){return false;}return true;};deconcept.util={getRequestParameter:function(_2b){var q=document.location.search||document.location.hash;if(_2b==null){return q;}if(q){var _2d=q.substring(1).split("&");for(var i=0;i<_2d.length;i++){if(_2d[i].substring(0,_2d[i].indexOf("="))==_2b){return _2d[i].substring((_2d[i].indexOf("=")+1));}}}return "";}};deconcept.SWFObjectUtil.cleanupSWFs=function(){var _2f=document.getElementsByTagName("OBJECT");for(var i=_2f.length-1;i>=0;i--){_2f[i].style.display="none";for(var x in _2f[i]){if(typeof _2f[i][x]=="function"){_2f[i][x]=function(){};}}}};if(deconcept.SWFObject.doPrepUnload){if(!deconcept.unloadSet){deconcept.SWFObjectUtil.prepUnload=function(){__flash_unloadHandler=function(){};__flash_savedUnloadHandler=function(){};window.attachEvent("onunload",deconcept.SWFObjectUtil.cleanupSWFs);};window.attachEvent("onbeforeunload",deconcept.SWFObjectUtil.prepUnload);deconcept.unloadSet=true;}}if(!document.getElementById&&document.all){document.getElementById=function(id){return document.all[id];};}var getQueryParamValue=deconcept.util.getRequestParameter;var FlashObject=deconcept.SWFObject;var FBP_SWFObject=deconcept.SWFObject;

BP.init();