var dir = "http://hashiruotoko2.jp/BP/";
//var dir = "";
var parts = "runner_parts.swf?c=090629";
var floating = "runner_float.swf?c=090629";
var nextURL = "";
//
var __width = 160;
var __height = 340;
//
var html = '<div id="_PARTS"><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="'+__width+'" height="'+__height+'" ALIGN=""><param name="movie" value="'+dir+parts+'" /><param name="allowScriptAccess" value="always" /><param name="wmode" value="transparent" /><param name="flashvars" value="dir='+dir+'" /><embed name="Oze_blogParts" src="'+dir+parts+'" quality="high" bgcolor="#ffffff" width="'+__width+'" height="'+__height+'" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" allowScriptAccess="always"  wmode="transparent" flashvars="dir='+dir+'"></embed></object></div>';
document.write('<script language="javascript" src="'+dir+'js/jquery.js"></script>');
document.write(html);
//
function setFloatingParts_run(){
	var trap = new TrapFloating_run();
	//trap.pageScroll(0, 15);
	 trap.setFloatingParts();
}
function removeFloat_run(){
	location.href = nextURL;
}
function getSelfURL_run(){
	return location.href;
}
function moveToURL_run(_url){
	nextURL = _url;
	var trap = new TrapFloating_run();
	var scrollTop = trap.getScrollTop();
	//$("body").append('<div id="_COVER" style="position:absolute; height:100%; width:100%; z-index:100;　background-color:#000000"/>');
	$("#_FLOATING").before('<iframe id="_FRAME" src="'+nextURL+'" style="position:absolute; height:100%; width:100%; z-index:100;" frameborder="0" scrolling="no"></iframe>');
	//$("#_COVER").css({top:scrollTop+"px", left:"0px"});
	$("#_FRAME").css({top:scrollTop+"px", left:"0px"});
    //
    //$("body").remove();
}
function onCompleteLoad(){
	//thisMovie("_float").completeNext();
}
function thisMovie(movieName) {
    if (navigator.appName.indexOf("Microsoft") != -1) {
        return window[movieName]
    }
    else {
        return document[movieName]
    }
}
function TrapFloating_run(){
	//
	TrapFloating_run.prototype.getScrollTop=function() {
		if (window.pageYOffset) {
			return window.pageYOffset;
		} else {
			return document.body.scrollTop || document.documentElement.scrollTop;
		}
	}

	TrapFloating_run.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();
		}
	}
	TrapFloating_run.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;
	}
	TrapFloating_run.prototype.setFloatingParts=function(){
		$('body').append('<div id="_FLOATING" style="position:absolute; height:100%; width:100%; z-index:100;"><object id="_float" 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="'+dir+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="dir='+dir+'" /><embed name="_float" src="'+dir+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="dir='+dir+'" salign="lt"></embed></object></div>');
		this.TB_Position();
	}
	TrapFloating_run.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();
		$("#_FLOATING").css({top:scrollTop+"px", left:"0px"});
	}
}
