/**
 * 简单的js跑马灯效果.
 * @param outerwarp_id 外层DOM元素id
 * @param innerwrap_id 内层DOM元素id
 * @param type 跑马灯类型:0:水平,1:垂直.默认为0
 * @param speed 跑马灯速度,整型一般30就够了.
 * @param px 跑马灯每次移动的速度.
 * @author Aaxron (徐新华) QQ:23283316 MSN:moyalun@hotmail.com
 * @version 1.0
 */	
function marquee(outerwarp_id,innerwrap_id,type,speed,px){
	var outerwarp = document.getElementById(outerwarp_id);
	if(!outerwarp) {
		alert("您要设置的\"" + outerwarp_id + "\"初始化错误\r\n请检查标签ID设置是否正确!");
		return;
	}
	var _this = this;
	
	outerwarp.onmouseover = function(){
		_this.isStoped = true;
	}
	outerwarp.onmouseout = function(){
		_this.isStoped = false;
	}	
	var innerwrap = document.getElementById(innerwrap_id);	
		innerwrap.innerHTML += innerwrap.innerHTML+innerwrap.innerHTML;
		
	this.isStoped = false;
	//this.isIE = (navigator.appName == "Microsoft Internet Explorer");
	this.speed = speed || 30;
	
	type = (type=='1')?1:0;
	if(type==0){
		outerwarp.noWrap = true;
		outerwarp.style.whiteSpace = "nowrap";
	}
	px = px || 1;
	
	this.start = function(){
		this.timerID = window.setInterval(this.scroll,this.speed);
	}

	this.scroll = function(){
		if(_this.isStoped){
			return;
		}
		if(type==0){
			//document.title = outerwarp.scrollWidth+":"+outerwarp.offsetWidth+"::"+outerwarp.scrollLeft
			
			outerwarp.scrollLeft += px;
			if(outerwarp.scrollLeft>= (outerwarp.scrollWidth-outerwarp.offsetWidth)){
				//alert(document.title);
				outerwarp.scrollLeft = 0;
			}
		}
		else{
			//document.title = outerwarp.scrollHeight+":"+outerwarp.offsetHeight+"::"+outerwarp.scrollTop
			
			outerwarp.scrollTop += px;
			if(outerwarp.scrollTop>= (outerwarp.scrollHeight-outerwarp.offsetHeight)){
				//alert(document.title);
				outerwarp.scrollTop = 0;
			}	
		}
	}
	this.start();
}
