function SlideClass(){
	for(var i = 0;i<=5; i++){if(typeof arguments[i] === "undefined")return false;}
	if(!document.getElementById(arguments[0])||!document.getElementById(arguments[1]))return false;
	var vEle = arguments[0];
	var oEle = document.getElementById(vEle);
	var oNav = document.getElementById(arguments[1]);
	var fx = arguments[2]==null?"slideX":arguments[2];
	var iWidth = arguments[3]==null?oEle.offsetParent.clientWidth:arguments[3];
	var iHeight = arguments[4]==null?oEle.offsetParent.clientHeight:arguments[4];	
	var iSpeed = arguments[5]==null?20:arguments[5];
	var currentPage = 1;
	this.timer = null;
	this.move=false;
	if(isNaN(arguments[6])||arguments[6]==null){
		var auto_move = false;	
	}else{
		var auto_move = true;
		var autospeed = arguments[6];
	}
	switch (fx){
		case "slideX":
			iHeight = 0
			oEle.className = "slide-con slide-x";
			break
		case "slideY":
			iWidth = 0
			oEle.className = "slide-con slide-y";
			break
	}
	var oli = oNav.getElementsByTagName("li");
	for(var i=0;i<oli.length;i++){
		oli[i].onmouseover = function(){
			if (auto_move) stopAuto();
			if(this.timer)clearTimeout(this.timer);
			if(currentPage > 1 )oli[currentPage-2].className = null;
			this.className = "on";
			if(oEle.movement){clearTimeout(oEle.movement);}
			moveEle(vEle,iWidth-iWidth*parseInt(this.innerHTML),iHeight-iHeight*parseInt(this.innerHTML),iSpeed);
		}
		oli[i].onmouseout = function(){
			this.className = null;
			currentPage = parseInt(this.innerHTML);
			startAuto(autospeed);
		}
	}

	var moveEle = function(vEle,xNum,yNum,iSpeed){
		if(oEle.movement){clearTimeout(oEle.movement);}
		var xpos = oEle.style.left?parseInt(oEle.style.left):0;
		var ypos = oEle.style.top?parseInt(oEle.style.top):0;			
		if(xpos == xNum && ypos == yNum){this.move=false;return true;}
		this.move=true;
		if (xpos < xNum){xpos = xpos + Math.ceil((xNum - xpos)/5)}
		else if (xpos > xNum){xpos = xpos - Math.ceil((xpos - xNum)/5)}
		else if (ypos < yNum){ypos = ypos + Math.ceil((yNum - ypos)/5)}
		else if (ypos > yNum){ypos = ypos - Math.ceil((ypos - yNum)/5)}
		oEle.style.left = xpos + "px";
		oEle.style.top = ypos + "px";
		oEle.movement = setTimeout(function(){moveEle(vEle,xNum,yNum,iSpeed);},iSpeed);
	}
	function startAuto(s){
		if(this.move) {clearTimeout(this.timer);this.timer = setTimeout(function(){startAuto(s);},1000*s);return true;}
		if(currentPage > 1 )oli[currentPage-2].className = null;
		if(currentPage == oli.length+1){currentPage =1;}
		oli[currentPage-1].className = "on";
		moveNext(currentPage);
		currentPage = currentPage + 1;
		this.timer = setTimeout(function(){startAuto(s);},1000*s);
	}
	function stopAuto(){
		if (this.timer == null) return true;
		clearTimeout(this.timer);
		this.timer = null;
	}
	function moveNext(page){
		var xpos = oEle.style.left?parseInt(oEle.style.left):0;
		var ypos = oEle.style.top?parseInt(oEle.style.top):0;
		if(page == oli.length+1){	xpos = iWidth,ypos=iHeight;}
		moveEle(vEle,iWidth-iWidth*page,iHeight-iHeight*page,iSpeed);
		return true
	}
	if (auto_move) {startAuto(autospeed);}
}
