    var expandState = 0;
	ads = new Array();
	var q=0;
	/**
	* aTargetLeft 和 aTargetRight 只中必須有一個是-1， 有一個大於-1
	* 
	* aObj - 要作為浮動廣告的對象
	* aTargetTop - 浮動廣告離頁面頂部的距離
	* aTargetLeft - 如果要讓浮動廣告靠左，設置此值為廣告離頁面最左側的距離，否則設置-1
	* aTargetRight - 如果要讓浮動廣告靠右，設置此值為廣告離頁面最右側的距離，否則設置-1
	*/
	function FlowAD(aObj, aTargetTop, aTargetLeft, aTargetRight){
		this.obj = aObj;
		this.targetTop = aTargetTop;
		this.targetLeft = aTargetLeft;
		this.targetRight = aTargetRight;
		this.move();
	}
	FlowAD.prototype.move = function(){
		//set the top
		var newTop = document.documentElement.scrollTop + this.targetTop;
		var maxTop = document.body.scrollHeight - this.obj.style.height.substr(0,this.obj.style.height.length-2);
		if(newTop > maxTop){
			newTop = maxTop;
		}
		this.obj.style.top = newTop;
		
		//set the left
		if(this.targetLeft > -1){
			this.obj.style.left = this.targetLeft + document.body.scrollLeft; 
		}
		if(this.targetRight > -1){
			//var newLeft = document.body.clientWidth - this.targetRight - this.obj.style.width.substr(0,this.obj.style.height.length-2);
			var newLeft = document.body.scrollWidth - this.targetRight -105;
			this.obj.style.left = newLeft + document.body.scrollLeft; 
		}
	}
	function addAD(aAD){
		ads.push(aAD);
	}
	function moveADs(){
		for(var i=0; i<ads.length; i++){
			ads[i].move();
		}	
	}
	
	function initADs(){    
		//靠左：addAD(new FlowAD(divName, 離上方高, 離左邊距離, -1))
		//靠右：addAD(new FlowAD(divName, 離上方高, -1, 離右邊距離))
		//addAD(new FlowAD(window.ad1, 200, 2, -1));		
		if (expandState == 0)
		{
			addAD(new FlowAD(window.adLeft, 170,  -1, 2 ));
			document.getElementById('adLeft').style.overflow = "";
			document.menutop.src = "images/serviceMenu_1.gif"
			expandState = 1;
		}
		else if (expandState == 1)
		{
			var top = Math.min(document.documentElement.clientHeight-22,document.body.clientHeight-document.documentElement.scrollTop);
			addAD(new FlowAD(window.adLeft, top , -1, 2));	
			document.getElementById('adLeft').style.overflow = "hidden";
			document.getElementById('adLeft').style.height = "27";
			document.menutop.src = "images/serviceMenu_1b.gif"
			expandState = 0;
		}
	}

	window.onload = initADs;
	window.onresize = moveADs;
	window.onscroll = moveADs;

	