var $D = YAHOO.util.Dom;
var $E = YAHOO.util.Event;
var $ = $D.get;
Array.prototype.indexOf = function(B) {
	var A = this.length;
	var C = Number(arguments[1]) || 0;
	C = (C < 0) ? Math.ceil(C) : Math.floor(C);
	if (C < 0) {
		C += A;
	}
	for (; C < A; C++) {
		if (C in this && this[C] === B) {
			return C;
		}
	}
	return - 1;
};
Array.prototype.copy = function() {
	var A = this.length;
	var C = new Array(A);
	for (var B = 0; B < A; B++) {
		C[B] = this[B];
	}
	return C;
};
function copyArray(B) {
	var A = B.length;
	var C = new Array(A);
	for (var D = 0; D < A; D++) {
		C[D] = B[D];
	}
	return C;
}

if (typeof Sale8 == 'undefined' || !Sale8) {
	var Sale8 = {};
}

Sale8.common = {
	stripTags: function(A) {
		return A.replace(/<\/?[^>]+>/gi, "")
	},
	applyIf: function(C, A) {
		if (C && A && typeof A == "object") {
			for (var B in A) {
				if (!YAHOO.lang.hasOwnProperty(C, B)) {
					C[B] = A[B];
				}
			}
		}
		return C;
	},
	apply: function(C, A) {
		if (C && A && typeof A == "object") {
			for (var B in A) {
				C[B] = A[B];
			}
		}
		return C;
	}
};

Sale8.widgets = {
	SimpleTab: function(n,a){
		var e = $(n),M;
		var t = $D.getFirstChild(e).getElementsByTagName('li');
		var et = copyArray(t);
		var ec = $D.getElementsByClassName(a.tabPanelClass,'*',e);
		function I(e){
			if(M){L();}
			switchTab(et.indexOf(this));
			if(a.stopEvent){try{$E.stopEvent(e);}catch(q){}}
			return !a.stopEvent;
		}
		function G(e){
			var P=this;
			M=setTimeout(function(){I.call(P,e);},a.delay*1000);
			if(a.stopEvent){$E.stopEvent(e);}
			return !a.stopEvent;
		}
		function L(){clearTimeout(M);}
		function switchTab(i){
			$D.setStyle(ec,'display','none');
			$D.removeClass(et,a.currentClass);
			$D.addClass(et[i],a.currentClass);
			$D.setStyle(ec[i],'display','block');
		}
		if(a.eventType=='mouse'){
			$E.on(et,'focus',I);
			$E.on(et,'mouseover',a.delay?G:I);
			$E.on(et,'mouseout',L);
		}else{
			$E.on(et,'click',I);
		}
		if(a.autoSwitchToFirst){switchTab(0);}
	},
	rankHover: function(n,a){
		var e = $(n),M;
		var es = $D.getElementsByClassName(a.rankClass,'*',e),ts=[];
		function I(e){
			if(M){L();}
			switchRank(this);
			if(a.stopEvent){try{$E.stopEvent(e);}catch(q){}}
			return !a.stopEvent;
		}
		function G(e){
			var P=this;
			M=setTimeout(function(){I.call(P,e);},a.delay*1000);
			if(a.stopEvent){$E.stopEvent(e);}
			return !a.stopEvent;
		}
		function L(){clearTimeout(M);}
		function switchRank(o){
			$D.removeClass(ts[o.indexOf],a.currentClass);
			$D.addClass(o,a.currentClass);
		}
		for (var i=0;i<es.length;i++){
			ts[i] = es[i].getElementsByTagName('li');
			for (var j=0;j<ts[i].length;j++){
				ts[i][j].indexOf = i;
				if(a.eventType=='mouse'){
					$E.on(ts[i][j],'focus',I);
					$E.on(ts[i][j],'mouseover',a.delay?G:I);
					$E.on(ts[i][j],'mouseout',L);
				}else{
					$E.on(ts[i][j],'click',I);
				}
			}
		}
	}
};
Sale8.widgets.SimpleScroll = new function() {
	var Y = YAHOO.util;
	var defConfig = {
		delay: 2,
		speed: 20,
		startDelay: 2,
		direction: "vertical",
		disableAutoPlay: false,
		distance: "auto",
		scrollItemCount: 1
	};
	this.decorate = function(container, config) {
		container = $(container);
		config = Sale8.common.applyIf(config || {}, defConfig);
		var step = 2;
		if (config.speed < 20) {
			step = 5;
		}
		if (config.lineHeight) {
			config.distance = config.lineHeight;
		}
		var scrollTimeId = null,
			startTimeId = null,
			startDelayTimeId = null;
		var isHorizontal = (config.direction.toLowerCase() == "horizontal") || (config.direction.toLowerCase() == "h");
		var handle = {};
		handle._distance = 0;
		handle.scrollable = true;
		handle.distance = config.distance;
		handle._distance = 0;
		handle.suspend = false;
		handle.paused = false;
		var _onScrollEvent = new Y.CustomEvent("_onScroll", handle, false, Y.CustomEvent.FLAT);
		_onScrollEvent.subscribe(function() {
			var curLi = container.getElementsByTagName("li")[0];
			if (!curLi) {
				this.scrollable = false;
				return;
			}
			this.distance = (config.distance == "auto") ? curLi[isHorizontal ? "offsetWidth": "offsetHeight"] : config.distance;
			with(container) {
				if (isHorizontal) {
					this.scrollable = (scrollWidth - scrollLeft - offsetWidth) >= this.distance;
				} else {
					this.scrollable = (scrollHeight - scrollTop - offsetHeight) >= this.distance;
				}
			}
		});
		var onScrollEvent = new Y.CustomEvent("onScroll", handle, false, Y.CustomEvent.FLAT);
		if (config.onScroll) {
			onScrollEvent.subscribe(config.onScroll);
		} else {
			onScrollEvent.subscribe(function() {
				for (var i = 0; i < config.scrollItemCount; i++) {
					container.appendChild(container.getElementsByTagName("li")[0]);
				}
				container[isHorizontal ? "scrollLeft": "scrollTop"] = 0;
			})
		}
		var scroll = function() {
			if (handle.suspend) {
				return;
			}
			handle._distance += step;
			var _d;
			if ((_d = handle._distance % handle.distance) < step) {
				container[isHorizontal ? "scrollLeft": "scrollTop"] += (step - _d);
				clearInterval(scrollTimeId);
				onScrollEvent.fire();
				_onScrollEvent.fire();
				startTimeId = null;
				if (handle.scrollable && !handle.paused) {
					handle.play();
				}
			} else {
				container[isHorizontal ? "scrollLeft": "scrollTop"] += step;
			}
		};
		var start = function() {
			if (handle.paused) {
				return;
			}
			handle._distance = 0;
			scrollTimeId = setInterval(scroll, config.speed);
		};
		$E.on(container, "mouseover",function(){handle.suspend = true;});
		$E.on(container, "mouseout",function(){handle.suspend = false;});
		Sale8.common.apply(handle, {
			subscribeOnScroll: function(func, override) {
				if (override === true && onScrollEvent.subscribers.length > 0) {
					onScrollEvent.unsubscribeAll();
				}
				onScrollEvent.subscribe(func);
			},
			pause: function() {
				this.paused = true;
				clearTimeout(startTimeId);
				startTimeId = null;
			},
			play: function() {
				this.paused = false;
				if (startDelayTimeId) {
					clearTimeout(startDelayTimeId);
				}
				if (!startTimeId) {
					startTimeId = setTimeout(start, config.delay * 1000);
				}
			}
		});
		handle.onScroll = handle.subscribeOnScroll;
		_onScrollEvent.fire();
		if (!config.disableAutoPlay) {
			startDelayTimeId = setTimeout(function() {
				handle.play();
			},
			config.startDelay * 1000);
		}
		return handle;
	};
};
(function() {
	var A = YAHOO.util;
	Sale8.widgets.Slide = function(B, C) {
		this.init(B, C)
	};
	Sale8.widgets.Slide.defConfig = {
		slidesClass: "Slides",
		triggersClass: "SlideTriggers",
		currentClass: "Current",
		eventType: "click",
		autoPlayTimeout: 5,
		disableAutoPlay: false
	};
	Sale8.widgets.Slide.prototype = {
		init: function(B, C) {
			this.container = $(B);
			this.config = Sale8.common.applyIf(C || {},Sale8.widgets.Slide.defConfig);
			try {
				this.slidesUL = $D.getElementsByClassName(this.config.slidesClass, "ul", this.container)[0];
				if (!this.slidesUL) {
					this.slidesUL = $D.getFirstChild(this.container,
					function(E) {
						return E.tagName.toLowerCase === "ul"
					})
				}
				this.slides = $D.getChildren(this.slidesUL);
				if (this.slides.length == 0) {
					throw new Error()
				}
			} catch(D) {
				throw new Error("can't find slides!")
			}
			this.delayTimeId = null;
			this.autoPlayTimeId = null;
			this.curSlide = -1;
			this.sliding = false;
			this.pause = false;
			this.onSlide = new A.CustomEvent("onSlide", this, false, A.CustomEvent.FLAT);
			if (YAHOO.lang.isFunction(this.config.onSlide)) {
				this.onSlide.subscribe(this.config.onSlide, this, true)
			}
			this.beforeSlide = new A.CustomEvent("beforeSlide", this, false, A.CustomEvent.FLAT);
			if (YAHOO.lang.isFunction(this.config.beforeSlide)) {
				this.beforeSlide.subscribe(this.config.beforeSlide, this, true)
			}
			$D.addClass(this.container, "tb-slide");
			$D.addClass(this.slidesUL, "tb-slide-list");
			$D.setStyle(this.slidesUL, "height", (this.config.slideHeight || this.container.offsetHeight) + "px");
			this.initSlides();
			this.initTriggers();
			if (this.slides.length > 0) {
				this.play(1)
			}
			if (!this.config.disableAutoPlay) {
				this.autoPlay()
			}
			if (YAHOO.lang.isFunction(this.config.onInit)) {
				this.config.onInit.call(this)
			}
		},
		initTriggers: function() {
			var D = document.createElement("ul");
			this.container.appendChild(D);
			for (var C = 0; C < this.slides.length; C++) {
				var B = document.createElement("li");
				B.innerHTML = C + 1;
				D.appendChild(B)
			}
			$D.addClass(D, this.config.triggersClass);
			this.triggersUL = D;
			if (this.config.eventType == "mouse") {
				$E.on(this.triggersUL, "mouseover", this.mouseHandler, this, true);
				$E.on(this.triggersUL, "mouseout",
				function(E) {
					clearTimeout(this.delayTimeId);
					this.pause = false
				},
				this, true)
			} else {
				$E.on(this.triggersUL, "click", this.clickHandler, this, true)
			}
		},
		initSlides: function() {
			$E.on(this.slides, "mouseover",
			function() {
				this.pause = true
			},
			this, true);
			$E.on(this.slides, "mouseout",
			function() {
				this.pause = false
			},
			this, true);
			$D.setStyle(this.slides, "display", "none")
		},
		clickHandler: function(D) {
			var C = $E.getTarget(D);
			var B = parseInt(Sale8.common.stripTags(C.innerHTML));
			while (C != this.container) {
				if (C.nodeName.toUpperCase() == "LI") {
					if (!this.sliding) {
						this.play(B, true)
					}
					break
				} else {
					C = C.parentNode
				}
			}
		},
		mouseHandler: function(E) {
			var D = $E.getTarget(E);
			var B = parseInt(Sale8.common.stripTags(D.innerHTML));
			while (D != this.container) {
				if (D.nodeName.toUpperCase() == "LI") {
					var C = this;
					this.delayTimeId = setTimeout(function() {
						C.play(B, true);
						C.pause = true
					},
					(C.sliding ? 0.5: 0.1) * 1000);
					break
				} else {
					D = D.parentNode
				}
			}
		},
		play: function(E, C) {
			E = E - 1;
			if (E == this.curSlide) {
				return
			}
			var B = this.curSlide >= 0 ? this.curSlide: 0;
			if (C && this.autoPlayTimeId) {
				clearInterval(this.autoPlayTimeId)
			}
			var D = this.triggersUL.getElementsByTagName("li");
			D[B].className = "";
			D[E].className = this.config.currentClass;
			this.beforeSlide.fire(E);
			this.slide(E);
			this.curSlide = E;
			if (C && !this.config.disableAutoPlay) {
				this.autoPlay()
			}
		},
		slide: function(C) {
			var B = this.curSlide >= 0 ? this.curSlide: 0;
			this.sliding = true;
			$D.setStyle(this.slides[B], "display", "none");
			$D.setStyle(this.slides[C], "display", "block");
			this.sliding = false;
			this.onSlide.fire(C)
		},
		autoPlay: function() {
			var B = this;
			var C = function() {
				if (!B.pause && !B.sliding) {
					var D = (B.curSlide + 1) % B.slides.length + 1;
					B.play(D, false)
				}
			};
			this.autoPlayTimeId = setInterval(C, this.config.autoPlayTimeout * 1000)
		}
	};
	Sale8.widgets.ScrollSlide = function(B, C) {
		this.init(B, C)
	};
	YAHOO.extend(Sale8.widgets.ScrollSlide, Sale8.widgets.Slide, {
		initSlides: function() {
			Sale8.widgets.ScrollSlide.superclass.initSlides.call(this);
			$D.setStyle(this.slides, "display", "")
		},
		slide: function(E) {
			var B = this.curSlide >= 0 ? this.curSlide: 0;
			var C = {
				scroll: {
					by: [0, this.slidesUL.offsetHeight * (E - B)]
				}
			};
			var D = new A.Scroll(this.slidesUL, C, 0.5, A.Easing.easeOutStrong);
			D.onComplete.subscribe(function() {
				this.sliding = false;
				this.onSlide.fire(E)
			},
			this, true);
			D.animate();
			this.sliding = true
		}
	});
	Sale8.widgets.FadeSlide = function(B, C) {
		this.init(B, C)
	};
	YAHOO.extend(Sale8.widgets.FadeSlide, Sale8.widgets.Slide, {
		initSlides: function() {
			Sale8.widgets.FadeSlide.superclass.initSlides.call(this);
			$D.setStyle(this.slides, "position", "absolute");
			$D.setStyle(this.slides, "top", this.config.slideOffsetY || 0);
			$D.setStyle(this.slides, "left", this.config.slideOffsetX || 0);
			$D.setStyle(this.slides, "z-index", 1)
		},
		slide: function(D) {
			if (this.curSlide == -1) {
				$D.setStyle(this.slides[D], "display", "block");
				this.onSlide.fire(D)
			} else {
				var B = this.slides[this.curSlide];
				$D.setStyle(B, "display", "block");
				$D.setStyle(B, "z-index", 10);
				var C = new A.Anim(B, {
					opacity: {
						to: 0
					}
				},
				0.5, A.Easing.easeNone);
				C.onComplete.subscribe(function() {
					$D.setStyle(B, "z-index", 1);
					$D.setStyle(B, "display", "none");
					$D.setStyle(B, "opacity", 1);
					this.sliding = false;
					this.onSlide.fire(D)
				},
				this, true);
				$D.setStyle(this.slides[D], "display", "block");
				C.animate();
				this.sliding = true
			}
		}
	})
})();
Sale8.widgets.SimpleSlide = new function() {
	this.decorate = function(A, B) {
		if (!A) {
			return
		}
		B = B || {};
		if (B.effect == "scroll") {
			if (YAHOO.env.ua.gecko) {
				if (YAHOO.util.Dom.get(A).getElementsByTagName("iframe").length > 0) {
					return new Sale8.widgets.Slide(A, B)
				}
			}
			return new Sale8.widgets.ScrollSlide(A, B)
		} else {
			if (B.effect == "fade") {
				return new Sale8.widgets.FadeSlide(A, B)
			} else {
				return new Sale8.widgets.Slide(A, B)
			}
		}
	}
};
function HeaderClass(A,B){
	var O=false,M;
	A=$(A);
	B=$(B);
	if(!A||!B){
		return;
	}
	function G(e){
		if(M){L();}
		var P=this;
		M=setTimeout(function(){I.call(P,e);},200);
	}
	function H(e){
		if(M){L();}
		var P=this;
		M=setTimeout(function(){J.call(P,e);},200);
	}
	function I(e){K('block');}
	function J(e){K('none');}
	function K(s){$D.setStyle(B,'display',s);}
	function L(){
		clearTimeout(M);
	}
	$E.on(A,'mouseover',G);
	$E.on(A,'mouseout',H);
	$E.on(B,'mouseover',G);
	$E.on(B,'mouseout',H);
}

(function() {
	var A = YAHOO.util;
	Sale8.widgets.Slide2 = function(B, C) {
		this.init(B, C)
	};
	Sale8.widgets.Slide2.defConfig = {
		slidesClass: "Slides",
		triggersClass: "SlideTriggers",
		currentClass: "Current",
		eventType: "click",
		autoPlayTimeout: 5,
		disableAutoPlay: false
	};
	Sale8.widgets.Slide2.prototype = {
		init: function(B, C) {
			this.container = $(B);
			this.config = Sale8.common.applyIf(C || {},Sale8.widgets.Slide2.defConfig);
			try {
				this.slidesUL = $D.getElementsByClassName(this.config.slidesClass, "ul", this.container)[0];
				if (!this.slidesUL) {
					this.slidesUL = $D.getFirstChild(this.container,
					function(E) {
						return E.tagName.toLowerCase === "ul"
					})
				}
				this.slides = $D.getChildren(this.slidesUL);
				if (this.slides.length == 0) {
					throw new Error()
				}
			} catch(D) {
				throw new Error("can't find slides!")
			}
			this.delayTimeId = null;
			this.autoPlayTimeId = null;
			this.curSlide = -1;
			this.sliding = false;
			this.pause = false;
			this.onSlide = new A.CustomEvent("onSlide", this, false, A.CustomEvent.FLAT);
			if (YAHOO.lang.isFunction(this.config.onSlide)) {
				this.onSlide.subscribe(this.config.onSlide, this, true)
			}
			this.beforeSlide = new A.CustomEvent("beforeSlide", this, false, A.CustomEvent.FLAT);
			if (YAHOO.lang.isFunction(this.config.beforeSlide)) {
				this.beforeSlide.subscribe(this.config.beforeSlide, this, true)
			}
			$D.addClass(this.container, "tb-slide");
			$D.addClass(this.slidesUL, "tb-slide-list");
			$D.setStyle(this.slidesUL, "height", (this.config.slideHeight || this.container.offsetHeight) + "px");
			this.initSlides();
			this.initTriggers();
			if (this.slides.length > 0) {
				this.play(1)
			}
			if (!this.config.disableAutoPlay) {
				this.autoPlay()
			}
			if (YAHOO.lang.isFunction(this.config.onInit)) {
				this.config.onInit.call(this)
			}
		},
		initTriggers: function() {
			var D = $D.getElementsByClassName(this.config.triggersClass, "ul", this.container)[0];
			var I = D.getElementsByTagName("li");
			for (var i=0;i<I.length;i++ ) {
				I[i].idx = i;
			}
			this.triggersUL = D;
			if (this.config.eventType == "mouse") {
				$E.on(this.triggersUL, "mouseover", this.mouseHandler, this, true);
				$E.on(this.triggersUL, "mouseout",
				function(E) {
					clearTimeout(this.delayTimeId);
					this.pause = false
				},
				this, true)
			} else {
				$E.on(this.triggersUL, "click", this.clickHandler, this, true)
			}
		},
		initSlides: function() {
			$E.on(this.slides, "mouseover",
			function() {
				this.pause = true
			},
			this, true);
			$E.on(this.slides, "mouseout",
			function() {
				this.pause = false
			},
			this, true);
			$D.setStyle(this.slides, "display", "none")
		},
		clickHandler: function(D) {
			var C = $E.getTarget(D);
			while (C != this.container) {
				if (C.nodeName.toUpperCase() == "LI") {
					if (!this.sliding) {
						this.play(D.idx + 1, true)
					}
					break
				} else {
					C = C.parentNode
				}
			}
		},
		mouseHandler: function(E) {
			var D = $E.getTarget(E);
			while (D != this.container) {
				if (D.nodeName.toUpperCase() == "LI") {
					var C = this;
					this.delayTimeId = setTimeout(function() {
						C.play(D.idx + 1, true);
						C.pause = true
					},
					(C.sliding ? 0.5: 0.1) * 1000);
					break
				} else {
					D = D.parentNode
				}
			}
		},
		play: function(E, C) {
			E = E - 1;
			if (E == this.curSlide) {
				return
			}
			var B = this.curSlide >= 0 ? this.curSlide: 0;
			if (C && this.autoPlayTimeId) {
				clearInterval(this.autoPlayTimeId)
			}
			var D = this.triggersUL.getElementsByTagName("li");
			D[B].className = "";
			D[E].className = this.config.currentClass;
			this.beforeSlide.fire(E);
			this.slide(E);
			this.curSlide = E;
			if (C && !this.config.disableAutoPlay) {
				this.autoPlay()
			}
		},
		slide: function(C) {
			var B = this.curSlide >= 0 ? this.curSlide: 0;
			this.sliding = true;
			$D.setStyle(this.slides[B], "display", "none");
			$D.setStyle(this.slides[C], "display", "block");
			this.sliding = false;
			this.onSlide.fire(C)
		},
		autoPlay: function() {
			var B = this;
			var C = function() {
				if (!B.pause && !B.sliding) {
					var D = (B.curSlide + 1) % B.slides.length + 1;
					B.play(D, false)
				}
			};
			this.autoPlayTimeId = setInterval(C, this.config.autoPlayTimeout * 1000)
		}
	};
	Sale8.widgets.ScrollSlide2 = function(B, C) {
		this.init(B, C)
	};
	YAHOO.extend(Sale8.widgets.ScrollSlide2, Sale8.widgets.Slide2, {
		initSlides: function() {
			Sale8.widgets.ScrollSlide2.superclass.initSlides.call(this);
			$D.setStyle(this.slides, "display", "")
		},
		slide: function(E) {
			var B = this.curSlide >= 0 ? this.curSlide: 0;
			var C = {
				scroll: {
					by: [0, this.slidesUL.offsetHeight * (E - B)]
				}
			};
			var D = new A.Scroll(this.slidesUL, C, 0.5, A.Easing.easeOutStrong);
			D.onComplete.subscribe(function() {
				this.sliding = false;
				this.onSlide.fire(E)
			},
			this, true);
			D.animate();
			this.sliding = true
		}
	});
	Sale8.widgets.FadeSlide2 = function(B, C) {
		this.init(B, C)
	};
	YAHOO.extend(Sale8.widgets.FadeSlide2, Sale8.widgets.Slide2, {
		initSlides: function() {
			Sale8.widgets.FadeSlide2.superclass.initSlides.call(this);
			$D.setStyle(this.slides, "position", "absolute");
			$D.setStyle(this.slides, "top", this.config.slideOffsetY || 0);
			$D.setStyle(this.slides, "left", this.config.slideOffsetX || 0);
			$D.setStyle(this.slides, "z-index", 1)
		},
		slide: function(D) {
			if (this.curSlide == -1) {
				$D.setStyle(this.slides[D], "display", "block");
				this.onSlide.fire(D)
			} else {
				var B = this.slides[this.curSlide];
				$D.setStyle(B, "display", "block");
				$D.setStyle(B, "z-index", 10);
				var C = new A.Anim(B, {
					opacity: {
						to: 0
					}
				},
				0.5, A.Easing.easeNone);
				C.onComplete.subscribe(function() {
					$D.setStyle(B, "z-index", 1);
					$D.setStyle(B, "display", "none");
					$D.setStyle(B, "opacity", 1);
					this.sliding = false;
					this.onSlide.fire(D)
				},
				this, true);
				$D.setStyle(this.slides[D], "display", "block");
				C.animate();
				this.sliding = true
			}
		}
	})
})();
Sale8.widgets.SimpleSlide2 = new function() {
	this.decorate = function(A, B) {
		if (!A) {
			return
		}
		B = B || {};
		if (B.effect == "scroll") {
			return new Sale8.widgets.ScrollSlide2(A, B)
		} else {
			if (B.effect == "fade") {
				return new Sale8.widgets.FadeSlide2(A, B)
			} else {
				return new Sale8.widgets.Slide2(A, B)
			}
		}
	}
};
function Marquee()
{

	this.ID = document.getElementById(arguments[0]);
	if(!this.ID)
	{
		alert("您要设置的\"" + arguments[0] + "\"初始化错误\r\n请检查标签ID设置是否正确!");
		this.ID = -1;
		return;
	}
	this.Direction = this.Width = this.Height = this.DelayTime = this.WaitTime = this.CTL = this.StartID = this.Stop = this.MouseOver = 0;
	this.Step = 1;
	this.Timer = 30;
	this.DirectionArray = {"top":0 , "up":0 , "bottom":1 , "down":1 , "left":2 , "right":3};
	if(typeof arguments[1] == "number" || typeof arguments[1] == "string")this.Direction = arguments[1];
	if(typeof arguments[2] == "number")this.Step = arguments[2];
	if(typeof arguments[3] == "number")this.Width = arguments[3];
	if(typeof arguments[4] == "number")this.Height = arguments[4];
	if(typeof arguments[5] == "number")this.Timer = arguments[5];
	if(typeof arguments[6] == "number")this.DelayTime = arguments[6];
	if(typeof arguments[7] == "number")this.WaitTime = arguments[7];
	if(typeof arguments[8] == "number")this.ScrollStep = arguments[8];
	this.ID.style.overflow = this.ID.style.overflowX = this.ID.style.overflowY = "hidden";
	this.ID.noWrap = true;
	this.IsNotOpera = (navigator.userAgent.toLowerCase().indexOf("opera") == -1);
	if(arguments.length >= 7)this.Start();
}

Marquee.prototype.Start = function()
{
	if(this.ID == -1)return;
	if(this.WaitTime < 800)this.WaitTime = 800;
	if(this.Timer < 20)this.Timer = 20;
	if(this.Width == 0)this.Width = parseInt(this.ID.style.width);
	if(this.Height == 0)this.Height = parseInt(this.ID.style.height);
	if(typeof this.Direction == "string")this.Direction = this.DirectionArray[this.Direction.toString().toLowerCase()];
	this.HalfWidth = Math.round(this.Width / 2);
	this.HalfHeight = Math.round(this.Height / 2);
	this.BakStep = this.Step;
	try
	{
		this.ID.style.width = this.Width + "px";
		this.ID.style.height = this.Height + "px";
	}
	catch (e){}
	if(typeof this.ScrollStep != "number")this.ScrollStep = this.Direction > 1 ? this.Width : this.Height;
	var templateLeft = "<table cellspacing='0' cellpadding='0' style='border-collapse:collapse;display:inline;'><tr><td noWrap=true style='white-space: nowrap;word-break:keep-all;'>MSCLASS_TEMP_HTML</td><td noWrap=true style='white-space: nowrap;word-break:keep-all;'>MSCLASS_TEMP_HTML</td></tr></table>";
	var templateTop = "<table cellspacing='0' cellpadding='0' style='border-collapse:collapse;'><tr><td>MSCLASS_TEMP_HTML</td></tr><tr><td>MSCLASS_TEMP_HTML</td></tr></table>";
	var msobj = this;
	msobj.tempHTML = msobj.ID.innerHTML;
	if(msobj.Direction <= 1)
	{
		msobj.ID.innerHTML = templateTop.replace(/MSCLASS_TEMP_HTML/g,msobj.ID.innerHTML);
	}
	else
	{
		if(msobj.ScrollStep == 0 && msobj.DelayTime == 0)
		{
			msobj.ID.innerHTML += msobj.ID.innerHTML;
		}
		else
		{
			msobj.ID.innerHTML = templateLeft.replace(/MSCLASS_TEMP_HTML/g,msobj.ID.innerHTML);
		}
	}
	var timer = this.Timer;
	var delaytime = this.DelayTime;
	var waittime = this.WaitTime;
	msobj.StartID = function(){msobj.Scroll()}
	msobj.Continue = function()
				{
					if(msobj.MouseOver == 1)
					{
						setTimeout(msobj.Continue,delaytime);
					}
					else
					{	clearInterval(msobj.TimerID);
						msobj.CTL = msobj.Stop = 0;
						msobj.TimerID = setInterval(msobj.StartID,timer);
					}
				}

	msobj.Pause = function()
			{
				msobj.Stop = 1;
				clearInterval(msobj.TimerID);
				setTimeout(msobj.Continue,delaytime);
			}

	msobj.Begin = function()
		{
			msobj.ClientScroll = msobj.Direction > 1 ? msobj.ID.scrollWidth / 2 : msobj.ID.scrollHeight / 2;
			alert(msobj.ClientScroll);
			if((msobj.Direction <= 1 && msobj.ClientScroll <= msobj.Height + msobj.Step) || (msobj.Direction > 1 && msobj.ClientScroll <= msobj.Width + msobj.Step))			{
				msobj.ID.innerHTML = msobj.tempHTML;
				delete(msobj.tempHTML);
				return;
			}
			delete(msobj.tempHTML);
			msobj.TimerID = setInterval(msobj.StartID,timer);
			if(msobj.ScrollStep < 0)return;
			msobj.ID.onmousemove = function(event)
						{
							if(msobj.ScrollStep == 0 && msobj.Direction > 1)
							{
								var event = event || window.event;
								if(window.event)
								{
									if(msobj.IsNotOpera)
									{
										msobj.EventLeft = event.srcElement.id == msobj.ID.id ? event.offsetX - msobj.ID.scrollLeft : event.srcElement.offsetLeft - msobj.ID.scrollLeft + event.offsetX;
									}
									else
									{
										msobj.ScrollStep = null;
										return;
									}
								}
								else
								{
									msobj.EventLeft = event.layerX - msobj.ID.scrollLeft;
								}
								msobj.Direction = msobj.EventLeft > msobj.HalfWidth ? 3 : 2;
								msobj.AbsCenter = Math.abs(msobj.HalfWidth - msobj.EventLeft);
								msobj.Step = Math.round(msobj.AbsCenter * (msobj.BakStep*2) / msobj.HalfWidth);
							}
						}
			msobj.ID.onmouseover = function()
						{
							if(msobj.ScrollStep == 0)return;
							msobj.MouseOver = 1;
							clearInterval(msobj.TimerID);
						}
			msobj.ID.onmouseout = function()
						{
							if(msobj.ScrollStep == 0)
							{
								if(msobj.Step == 0)msobj.Step = 1;
								return;
							}
							msobj.MouseOver = 0;
							if(msobj.Stop == 0)
							{
								clearInterval(msobj.TimerID);
								msobj.TimerID = setInterval(msobj.StartID,timer);
							}
						}
		}
	setTimeout(msobj.Begin,waittime);
}

Marquee.prototype.Scroll = function()
{
	switch(this.Direction)
	{
		case 0:
			this.CTL += this.Step;
			if(this.CTL >= this.ScrollStep && this.DelayTime > 0)
			{
				this.ID.scrollTop += this.ScrollStep + this.Step - this.CTL;
				this.Pause();
				return;
			}
			else
			{
				if(this.ID.scrollTop >= this.ClientScroll)
				{
					this.ID.scrollTop -= this.ClientScroll;
				}
				this.ID.scrollTop += this.Step;
			}
		break;

		case 1:
			this.CTL += this.Step;
			if(this.CTL >= this.ScrollStep && this.DelayTime > 0)
			{
				this.ID.scrollTop -= this.ScrollStep + this.Step - this.CTL;
				this.Pause();
				return;
			}
			else
			{
				if(this.ID.scrollTop <= 0)
				{
					this.ID.scrollTop += this.ClientScroll;
				}
				this.ID.scrollTop -= this.Step;
			}
		break;

		case 2:
			this.CTL += this.Step;
			if(this.CTL >= this.ScrollStep && this.DelayTime > 0)
			{
				this.ID.scrollLeft += this.ScrollStep + this.Step - this.CTL;
				this.Pause();
				return;
			}
			else
			{
				if(this.ID.scrollLeft >= this.ClientScroll)
				{
					this.ID.scrollLeft -= this.ClientScroll;
				}
				this.ID.scrollLeft += this.Step;
			}
		break;

		case 3:
			this.CTL += this.Step;
			if(this.CTL >= this.ScrollStep && this.DelayTime > 0)
			{
				this.ID.scrollLeft -= this.ScrollStep + this.Step - this.CTL;
				this.Pause();
				return;
			}
			else
			{
				if(this.ID.scrollLeft <= 0)
				{
					this.ID.scrollLeft += this.ClientScroll;
				}
				this.ID.scrollLeft -= this.Step;
			}
		break;
	}
}

function showWelcome() {
	var welcomeData = {
		'3-8':'卖吧祝妇女同胞节日快乐！',
		'5-1':'卖吧祝您“五一”快乐！',
		'5-4':'卖吧提示：今天是五四青年节！',
		'5-10':'今天是母亲节，记得给母亲打个电话哦！',
		'5-17':'今天是全国助残日，请关爱残疾人身心健康!',
		'5-28':'移动卖吧祝您端午节快乐！',
		'6-1':'今天是儿童节，祝福小朋友们快乐永远！',
		'8-1':'祝福人民子弟兵建军节快乐！',
		'8-26':'七夕情人节，祝有情人终成眷属！',
		'9-10':'今天是教师节，老师：您辛苦了！',
		'10-1':'卖吧祝您国庆节快乐！',
		'10-3':'中秋佳节，月圆人团圆！',
		'10-6':'卖吧提示：今天是老人节，请关爱身边的老人！',
		'10-26':'卖吧祝您重阳节快乐！',
		'12-22':'温馨提示：今天是冬至，记得吃饺子哦！',
		'12-25':'卖吧祝您圣诞快乐，Merry Christmas！'
	};
	var o = document.getElementById('headWelcome');
	if (o)
	{
		var d = new Date();
		var m = d.getHours() * 60 + d.getMinutes();
		var s = (d.getMonth() + 1) + '-' + d.getDate();
		var w = '';

		if (m>=360 && m<720){w = '上午好,';}
		if (m>=720 && m<=810){w = '中午好,';}
		if (m>810 && m<1080){w = '下午好,';}
		if (m>=1080 || m<=360){w = '晚上好,';}

		//o.innerHTML =(welcomeData[s] ? welcomeData[s] : '')+ w;
		o.innerHTML = w;
	}
}

function CountDown(o,t)
{
	o=$(o);
	if(!o||!t){return;}
	var end=new Date(t),M;

	function T(){
		var ms=end-new Date();

		if (ms>0)
		{
			var MinMilli=1000*60;
			var HrMilli=MinMilli*60;
			var DyMilli=HrMilli*24;
			var d=0,h=0,m=0,s=0;

			d=parseInt(ms/DyMilli);
			h=parseInt((ms-d*DyMilli)/HrMilli);
			m=parseInt((ms-d*DyMilli-h*HrMilli)/MinMilli);
			s=parseInt((ms-d*DyMilli-h*HrMilli-m*MinMilli)/1000);

			o.innerHTML=d+'天'+h+'小时'+m+'分'+s+'秒';
		} else {
			o.innerHTML='已结束';
			if(M){clearInterval(M);}
		}
	}
	M=setInterval(function(){T();},1000);
}



function checkLocation_zekou(){
	var scrollT = document.documentElement.scrollTop;

	var t_x = 0;	
	var t_y = scrollT+200;

	document.getElementById("zekou_div").style.pixelTop = t_y;
	document.getElementById("zekou_div").style.pixelLeft = t_x;

	setTimeout("checkLocation_zekou()",100);
}


