﻿<!--
var floatAds_MinMax=0;
function $ById(id) {
	return document.getElementById(id);
}

function scrollBanner(timer, moveNumber) {

	function move(o) {
		var theScrollTop = window.pageYOffset || document.documentElement.scrollTop || document.body.scrollTop || 0;
		var theScrollLeft = window.pageXOffset || document.documentElement.scrollLeft || document.body.scrollLeft || 0;
		var window_Height=o.offsetHeight;
		if(document.body.clientHeight)
		{
			window_Height=document.body.clientHeight;
		}
		else
		{
			window_Height=document.body.offsetHeight;
		}
		//计算浮动对象的新位置参数
		if(o.t>0)
		{
			theScrollTop=theScrollTop + o.t;
		}
		else
		{
			//var pageShowHeight=document.documentElement.clientHeight || document.body.clientHeight || document.body.offsetHeight || 0;
			var pageShowHeight=document.documentElement.clientHeight || 0;
			if(pageShowHeight>0)
			{
				theScrollTop=theScrollTop + pageShowHeight - o.offsetHeight;
			}
		}
		
		var window_Width=o.offsetWidth;
		if(document.body.clientWidth)
		{
			window_Width=document.body.clientWidth;
		}
		else
		{
			window_Width=document.body.offsetWidth;
		}
		var sl = theScrollLeft + (o.c == 0 ? o.a : window_Width - o.a - o.offsetWidth);
		var tc = theScrollTop - o.offsetTop, lc = sl - o.offsetLeft;
		with (o.style) {
			top = o.offsetTop + (tc != 0 ? tc / Math.abs(tc) : 0) * Math.min(Math.abs(tc), moveNumber) + "px";
			left = o.offsetLeft + (lc != 0 ? lc / Math.abs(lc) : 0) * Math.min(Math.abs(lc), moveNumber) + "px";
		}
		if (o.person) {
			with (o.person.style) {
				top = o.offsetTop + "px";
				left = o.offsetLeft + o.offsetWidth - o.person.offsetWidth + "px";
			}
		}
	}
	
	/*
	var hidden = function() {
		var o = this.parent;
		window.clearInterval(o.interval);
		o.parentNode.removeChild(o);
		this.parentNode.removeChild(this);
	}
	*/
	
	var hidden = function() {
		var o = this.parent;
		//window.clearInterval(o.interval);
		if(floatAds_MinMax==0)
		{
			o.className="minAds";
			this.src="/images/barresume.jpg";
			floatAds_MinMax=1;
		}
		else
		{
			o.className="nomralAds";
			this.src="/images/boxmin.jpg";
			floatAds_MinMax=0;
		}
	}
	
	this.add = function (to, t, a, c, lo) {
		/*
		to为object对象
		t为距离顶端距离
		当c = 0的时候，a为距离左边的距离
		当c != 0的时候，a为距离右边的距离
		lo为关闭按钮
		*/
		var div, exec = function () {
			move(to);
		};
		
		to.person = lo;
		to.t = t;
		to.a = a;
		to.c = c;
		with (to.style) {
			position = "absolute";
			display = "block";
			var windowHeight=to.offsetHeight;
			if(document.body.clientHeight)
			{
				windowHeight=document.body.clientHeight;
			}
			else
			{
				windowHeight=document.body.offsetHeight;
			}
			var theScrollTop = window.pageYOffset || document.documentElement.scrollTop || document.body.scrollTop || 0;
			var theScrollLeft = window.pageXOffset || document.documentElement.scrollLeft || document.body.scrollLeft || 0;
			if((windowHeight - to.offsetHeight)>=0)
			{
				top = windowHeight - to.offsetHeight;
				/*
				var topY = windowHeight - to.offsetHeight;
				if(t>0 && topY>t)
				{
					top=topY-t;
				}
				else
				{
					top=topY
				}
				*/
			}
			else
			{
				top= theScrollTop + t;
			}
			var windowWidth=to.offsetWidth;
			if(document.body.clientWidth)
			{
				windowWidth=document.body.clientWidth;
			}
			else
			{
				windowWidth=document.body.offsetWidth;
			}
			left = theScrollLeft + (c == 0 ? a : windowWidth - a - to.offsetWidth);
		}
		
		if (typeof lo != "undefined") {
			with (lo.style) {
				//position = "absolute";
				display = "block";
			}			
			lo.onmousedown = hidden;
			lo.parent = to;
		}
		exec();
		to.interval = window.setInterval(exec, timer);
	};
}

//-->
