
var Setleft = 21;

if ( window.floater==null){
	window.floater = function(){
		if(floater.install ==null){
			floater.idIndex =Date.parse(new Date());
			floater.floaters = new Array();
		}
		function floater_install(){  
			for(i=0;i<floater.floaters.length;i++)
			{
				var M = floater.floaters[i];
				// 移動速度
				M.step = M.step || 0;
				M.interval = M.interval || 100;
				if(M.link !=null)
				{
					M.HL.setAttribute("href",M.link);
					M.HL.setAttribute("target","_blank");
					M.HL.onclick = function(){ return true; }
				}
				M.div.style.display="none";
				M.onload = function(){
					this.div.style.display="block";
				}
				if(M.textlink !=null && M.text !=null) {
					M.HL2 = document.createElement("a");
					M.div.appendChild(M.HL2);
					M.div.M = M;
					M.HL2.style.cssText = "padding-top:3px;;display:block;font-size:13px;";
					M.HL2.setAttribute("target","_blank");
					M.HL2.setAttribute("href","#");
					M.HL2.innerHTML = M.text;
					M.HL2.setAttribute("href",M.textlink);
					M.HL2.onmouseover = function(){M.play = function(){return false;};};
					M.HL2.onmouseout = function(){M.play = floater_play;M.play();};
				}
				if(M.src1 !=null){
					M.timer = setTimeout("void(0)",1000);
					M.src = M.src1;
					M.Image1 = new Image();
					M.Image1.src =M.src ;
					if(M.width1 !=null){  M.style.width = M.width1 +"px" ;  };
					if(M.height1 !=null){ M.style.height = M.height1 +"px" ;  };
					//起點高度
					M.top = 260 ;
					M.left = Setleft ;
					
					var scrollTop = document.body.scrollTop + document.documentElement.scrollTop;
					M.style.top = (M.top + scrollTop) + "px";
					
					M.style.left = (M.left) + "px";
					
					document.body.appendChild(M.div);
					M.div.style.visibility= "hidden";
					if(  M.defer !=true){ 					
						M.timer = setTimeout("document.getElementById('"+M.id+"').play()", Math.max(0, (floater.floaters.length-1)) * 1000);
					}
				}
				if(M.src2 !=null){
					M.Image2 = new Image();
					M.Image2.src = M.src2;
					if(M.width2 !=null){M.Image2.width = M.width2 ; };
					if(M.height2 !=null){M.Image2.height = M.height2 ; };
				}
				function FloaterMouseOver(ev){ 
					clearTimeout(this.M.timer);
					clearTimeout(window[this.id ]);
					this.M.play = function(){return false;};
					if(this.M.Image2 !=null){
						if(this.M.width2 !=null){  this.M.style.width = this.M.width2 +"px" ;};
						if(this.M.height2 !=null){ this.M.style.height = this.M.height2 +"px" ;  };
						this.M.div.style.width = this.M.width + 3 +"px";
						this.M.src = this.M.Image2.src;}				 
					this.onmouseout  = function(){
						window[this.id ] = setTimeout("document.getElementById('"+this.id +"').Hide()",300);
					}
				}
				M.div.onmouseover = FloaterMouseOver;
				function  FloaterMouseOut(ev){ 
					this.M.timer = setTimeout("void(0)",1000);
					this.M.src = this.M.Image1.src;				  
					if(this.M.Image2 !=null){
						if(this.M.width1 !=null){  this.M.style.width = this.M.width1 +"px" ;  };
						if(this.M.height1 !=null){ this.M.style.height = this.M.height1 +"px" ;  };
						this.M.div.style.width = this.M.width + 3 +"px";
					}
					this.M.play = floater_play;
					this.M.play();
				}
				M.div.id = "_x_" + Date.parse(new Date()) + Math.ceil(100000*Math.random());
				window[M.div.id] = setTimeout("void(0)",0);
				M.div.Hide  = FloaterMouseOut;
			}
		}

		function floater_play(){  
			if(this.div.style.visibility =="hidden"){
				this.div.style.visibility ="visible";
			}
			var scrollTop = Math.max( document.body.scrollTop , document.documentElement.scrollTop);

			var windowHeight = ( document.documentElement.clientHeight == 0)?document.body.clientHeight:document.documentElement.clientHeight;

			var oldTop = this.top ; 
			clearTimeout(this.timer)
			this.top +=( this.step );
			if(this.top > windowHeight)
			{
				this.top = -this.offsetHeight;			   
			}
			if(document.body.clientWidth < 820 || (window.innerWidth!=null && window.innerWidth < 820))
			{
				this.style.filter = "alpha(opacity=70);";
				this.style.MozOpacity=0.7
			}
			else{	this.style.filter = "none";
			this.style.MozOpacity=1;
			}
			this.div.style.top = (  Math.floor(this.top) +  scrollTop) + "px";	
			
			this.div.style.left = Setleft+"px";	
			
				
			this.timer = setTimeout("document.getElementById('"+this.id+"').play()",this.interval);
		}
		var compatible = false;
		var wnp = window.navigator.appVersion;
		if(wnp!=null){
			if( wnp.toUpperCase().indexOf("MACINTOSH") >=0) {return;}
		}     
		if(document.body){ 
			if(document.body.cloneNode ==null){return false;}
			floater.idIndex++;
			var FM = new Image();
			FM.div= document.createElement("div");
			FM.HL = document.createElement("a");
			FM.HL.setAttribute("href","#");
			FM.HL.onclick = function(){return false;}
			FM.src1 = null;
			FM.src2 = null;
			FM.HL.appendChild(FM);
			FM.div.appendChild(FM.HL);
			FM.style.border="none";
			FM.div.style.cssText = "text-align:center;display:block;position:absolute;top:0px;left:0px;z-index:99999999;margin:0px;cursor:hand;";
			FM.play = floater_play;
			FM.id = "floater" + floater.idIndex;
			floater.floaters[floater.floaters.length] = FM;
			if(window.attachEvent){
				if(floater.install ==null){ window.attachEvent("onload",floater_install); }
				floater.install = true;
				return  FM;
			}
			else if(window.addEventListener){
				if(floater.install ==null){window.addEventListener("load",floater_install,false);}
				floater.install = true;
				return  FM;
			}	 
		}
		return false;
	}

}
