var parts = "http://www.tepco.co.jp/oze/wallpaper/oze_blogparts.swf";
var floating = "http://www.tepco.co.jp/oze/wallpaper/oze_seicho.swf";
//
var html = '<div id="OZE_BANNER"><object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" width="169" height="259" ALIGN=""><param name="movie" value="'+parts+'" /><param name="allowScriptAccess" value="always" /><param name="wmode" value="transparent" /><param name="flashvars" value="" /><embed name="Oze_blogParts" src="'+parts+'" quality="high" bgcolor="#ffffff" width="169" height="259" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" allowScriptAccess="always"  wmode="transparent" flashvars=""></embed></object></div>';
document.write('<script language="javascript" src="http://www.tepco.co.jp/oze/wallpaper/jquery.js"></script>');
document.write(html);
//
//
function setFloatingParts(){
	var trap = new TrapOzeFloating();
	trap.pageScroll(0, 15);
	return 12;
}
function removeFloatingParts(){
	location.href = location.href;
}
function TrapOzeFloating(){
	//
	TrapOzeFloating.prototype.getScrollTop=function() {
		if (window.pageYOffset) {
			return window.pageYOffset;
		} else {
			return document.body.scrollTop || document.documentElement.scrollTop;
		}
	}

	TrapOzeFloating.prototype.pageScroll=function(toY, frms) {
		if (!toY || toY < 0) {
			toY = 0;
		}
		var cuY = this.getScrollTop();
		if (!frms){
			frms = 6;
		}
		cuY += (toY-cuY) > 0 ? Math.max(1, (toY - cuY) / frms) : (toY-cuY)/frms;if (cuY < 0) cuY = 0;
		var posY = Math.floor(cuY);
		//
		window.scrollTo(0, posY);
		if (posY != toY) {
			var self = this;
			pageScrollTimer = setTimeout(function(){self.pageScroll(toY, frms)}, 16);
		}else{
			this.setFloatingParts();
		}
	}
	TrapOzeFloating.prototype.getPageSize=function(){
		var de = document.documentElement;
		var w = window.innerWidth || self.innerWidth || (de&&de.clientWidth) || document.body.clientWidth;
		var h = window.innerHeight || self.innerHeight || (de&&de.clientHeight) || document.body.clientHeight;
		arrayPageSize = new Array(w,h) 
		return arrayPageSize;
	}
	TrapOzeFloating.prototype.setFloatingParts=function(){
		$('body').append('<div id="OZE_FLOATING" style="position:absolute; height:100%; width:100%; z-index:100;"><object id="Oze_blogParts" classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0," width="100%" height="100%" ALIGN="middle"><param name="movie" value="'+floating+'" /><param name="quality" value="high"><param name="salign" value="lt" /><param name="scale" value="noscale" /><param name="wmode" value="transparent" /><param name="allowScriptAccess" value="always" /><param name="flashvars" value="totalCount=0" /><embed name="star" src="'+floating+'" quality="high" bgcolor="#000000" scale="noscale" width="100%" height="100%" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" allowScriptAccess="always" wmode="transparent" flashvars="" salign="lt"></embed></object></div>');
		this.TB_Position();
	}
	TrapOzeFloating.prototype.TB_Position=function(){
		var pagesize = this.getPageSize();

		if (window.innerHeight && window.scrollMaxY) {	
			var yScroll = window.innerHeight + window.scrollMaxY;
		} else if (document.body.scrollHeight > document.body.offsetHeight){ // all but Explorer Mac
			var yScroll = document.body.scrollHeight;
		} else { // Explorer Mac...would also work in Explorer 6 Strict, Mozilla and Safari
			var yScroll = document.body.offsetHeight;
		}
		
		var scrollTop = this.getScrollTop();
		$("#OZE_FLOATING").css({top:scrollTop+"px", left:"0px"});
	}
}
