var puma_dir = "http://www.puma.jp/africa/download/";
var puma_parts = "blog_parts.swf";
var puma_floating = "floating.swf";
var __width = 160;
var __height = 240;
//
var html = '<div id="PUMA_AFRICA_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="'+puma_dir+puma_parts+'" /><param name="allowScriptAccess" value="always" /><param name="wmode" value="transparent" /><param name="flashvars" value="dir='+puma_dir+'" /><embed name="PUMA_AFRICA_bp" src="'+puma_dir+puma_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='+puma_dir+'"></embed></object></div>';
document.write('<script language="javascript" src="'+puma_dir+'jquery.js"></script>');
document.write(html);

function setPumaAfricaFloating()
{
	var trap = new TrapFloating_run();
	//trap.pageScroll(0, 15);
	 trap.setFloatingParts();
}
function removePumaAfricaFloating()
{
    location.href = location.href;
}
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="PUMA_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="'+puma_dir+puma_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='+puma_dir+'" /><embed name="_float" src="'+puma_dir+puma_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='+puma_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();
		$("#PUMA_FLOATING").css({top:scrollTop+"px", left:"0px"});
	}
}
