﻿// JScript 檔

    <!--
    function scrollerObj(name,div1H,div1W,div2H,div2W,content,div1Bg,div2Bg,speed,div1Float) {
    
      
    
	    //**data**//
	    this.name=name;
	    this.div1H=div1H;
	    this.div1W=div1W;
	    this.div2H=div2H;
	    this.div2W=div2W;
	    this.content=content;
	    this.div1Bg=div1Bg;
	    this.div2Bg=div2Bg;
	    this.iniFl=div1Float;
	    this.speed=parseInt(speed);
	    this.timer = "Mar" + name + "Timer";
	    this.elem;
		this.distance=0;
		
		
		//alert("methods");
		  
	    //**methods**//
	    this.getElement = getElement;
	    this.StartScroll = StartScroll;
	    this.scrollLayer = scrollLayer; 
	    this.scrollLoop = scrollLoop;
	    this.Reset = Reset;
	
	    //alert("initiate");
	
	    //**initiate methods**//
	    //alert("createLayer");
	    //this.createLayer();	    
	   
	    //alert("getElement");
	    this.getElement();	    
	    
	    //alert("scrollLayer");
	    this.scrollLayer();	    
    }

    //**call this method to stop scrolling**//
    function scrollLoop(s) {
	    this.speed = s;
    }

	function scrollLayer() {
	    
		if(parseInt(this.elem.style.top)>(this.elem.offsetHeight*(-1))) {
		    this.elem.style.top = parseInt(this.elem.style.top)-this.speed;
			this.elemBack.style.top = this.elem.offsetTop+this.elem.offsetHeight+this.distance;
			//this.elem.style.left = parseInt(this.elem.style.left)-this.speed;
			//this.elemBack.style.left = this.elem.offsetLeft+this.elem.offsetWidth+this.distance;
		}else {
			// 交換角色
			this.elem.style.top = this.elemBack.offsetTop+this.elemBack.offsetHeight+this.distance; 
			//this.elem.style.left = this.elemBack.offsetLeft+this.elemBack.offsetWidth+this.distance; 

			tempElem = this.elem;
			this.elem = this.elemBack;
			this.elemBack = tempElem;
		}
    }
 
	function getElement() {
	
		if(document.getElementById) {
			this.elem = document.getElementById("Mar" + this.name);
		}else if (document.all) {
			this.elem = document.all["Mar" + this.name];
		}else if (document.layers) {
			this.elem = document.layers["Mar" + this.name];
		}
		
		this.elemBack = document.getElementById("Mar" + this.name + "Back");
		
		if(this.elemBack == null){
		    this.elemBack = this.elem.cloneNode(true);
		    this.elemBack.id = "Mar" + this.name + "Back";
		    this.elem.parentNode.appendChild(this.elemBack);
		}	
			
    }
    
    
    function Reset(){
        window.clearInterval(this.timer);
        this.elem.style.left = 0;
		this.elemBack.style.left = 0;
    }
    
    function StartScroll() {		
	    if(this.scrollLayer) {	
			this.timer = setInterval('Marquee[' + this.name + '].scrollLayer()','180');
    	}
    }
    //-->