
/*
 * animation */
/*
 * animation */
var Animation = {
	p: {x:0.5, pix:0.1, speed:50},
	scrollLeft: function(element) {
		var status = true, goto = null;
		var end = null, now, method; 
		setMethod();
		function setMethod() { if(now > end) { method = false } else if(now < end) { method = true } else { return false } }
		function start() {
			now += (end - now)*Animation.p["x"] + Animation.p["pix"];
			if((method)? (now < end): (now-1 > end)) { 
				element.scrollLeft = now;
			} else { 
				window.clearInterval(goto); element.scrollLeft = end; status = true; 
			}
		} this.status = function(){ return status } 
		this.to = function(newNumber){
			if(status) {
				now = element.scrollLeft;
				if(goto != null) window.clearInterval(goto);
				status = false, end = newNumber; setMethod();
				goto = window.setInterval(start,Animation.p["speed"]);
			} else {
				return false;
			}
		}
		this.tos = function(newNumber){
			now = element.scrollLeft;
			if(goto != null) window.clearInterval(goto);
			status = false, end = newNumber; setMethod();
			goto = window.setInterval(start,Animation.p["speed"]);
		}
	},
	alpha: function(element) {
		var status = false, goto = null;
		var end = null, now , method; 
		now = Style.getAlpha(element);
		setMethod();
		function setMethod() { if(now > end) { method = false } else if(now < end) { method = true } else { return false } }
		function start() {
			now += (end - now)*0.175 ;
			if((method)? (now < end): (now > end)) { 
				if( now > 99 ) { 
					now = 100;
				} else {
					Style.setAlpha(element,now);
				}
			} else { 
				window.clearInterval(goto); Style.setAlpha(element,end); status = true; 
			}
		} this.status = function(){ return status }
		this.to = function(newNumber){
			if(goto != null) window.clearInterval(goto); 
			status = false, end = newNumber; setMethod();
			goto = window.setInterval(start,Animation.p["speed"]);
		}
	}
}