function Ticker(name){
	this.name = name;
	this.links = new Array();
	this.link = null;
	this.frame = null;
	this.ticker = null;
	this.index = 0;
	this.step = -8;
}
Ticker.prototype.setLink = function(index){
	this.index = ((typeof index == "number") ? index : this.index+1) % this.links.length;
    this.link = document.createElement("a");
    this.link.style.top="120px";
    var oLink = this.links[this.index]
    if(document.all && parseInt(navigator.appVersion) < 7){
        this.link.style.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + oLink.image.src + "', sizingMethod='scale')";
    }else {
        this.link.style.backgroundImage = "url(" + oLink.image.src + ")";
    }
    this.link.title = oLink.title;;
    this.link.href = oLink.href;
}
Ticker.prototype.tick = function(){
	var iPos = parseInt(this.link.style.top);
    if((this.step < 0) ? (iPos <= -120) : (iPos >= 120)){
        this.step = -Math.abs(this.step);
        this.frame.removeChild(this.link);
        this.setLink();
        this.frame.appendChild(this.link);
    }
    else if(iPos == 0 && this.ticks < 250) {
		this.step = -Math.abs(this.step);
		this.ticks++;
	}
	else {
		this.ticks = 0;
		this.link.style.top= (iPos + this.step).toString() + "px";
	}
	setTimeout( this.name+".tick();", 10);
}
Ticker.prototype.addLink = function(src, title, href){
	var oLink = new Object();
	var oImage = new Image();
	oImage.src = src;
	oLink.image = oImage;
	oLink.title = title;
	oLink.href = href;
	this.links.push(oLink);
}
Ticker.prototype.prev = function(evt){
    this.step = Math.abs(this.step);
	if(window.event) window.event.cancelBubble  = true;
	this.frame.removeChild(this.link);
    this.setLink(this.index + this.links.length - 1);
    this.link.style.top="-120px";
    this.frame.appendChild(this.link);
	return false;
}
Ticker.prototype.next = function(evt){
	this.step = -Math.abs(this.step);
	if(window.event) evt = window.event;
	if(evt)evt.cancelBubble == true;
	this.frame.removeChild(this.link);
    this.setLink();
    this.frame.appendChild(this.link);
	return false;
}
Ticker.prototype.click = function(evt){
	if(window.event) evt = window.event;
	if(evt)evt.cancelBubble == true;
	if(this.link.click)this.link.click();
	else if(this.link.href) location.href = this.link.href;
	this.link.click();
	return false;
}

Ticker.prototype.write = function(id){
	// Init
	this.ticker = document.getElementById(id);
	this.ticker.style.cursor = "pointer";
	var oChild = this.ticker.childNodes[0];
	oChild.style.display = "none";
	this.frame = document.createElement("div");
	this.frame.style.overflow = "hidden";
	this.setLink(0);
	this.ticker.appendChild(this.frame);
	this.frame.appendChild(this.link);
	setTimeout( this.name+".tick();", 10);
	/*// Up
	var oUp = document.createElement("a");
	oUp.href = "#";
	oUp.className = "up";
	oUp.title = "previous";
	this.ticker.appendChild(oUp);
	if (oUp.addEventListener) oUp.addEventListener("click", new Function(this.name + ".prev(); return false;"), false); 
	else if (oUp.attachEvent) oUp.attachEvent("onclick", new Function(this.name + ".prev(); return false;"));
	// Down
	var oDown = document.createElement("a");
	oDown.href = "#";
	oDown.className = "down";
	oDown.title = "next";
	this.ticker.appendChild(oDown);
	if (oDown.addEventListener) oDown.addEventListener("click", new Function(this.name + ".next(); return false;"), false); 
	else if (oDown.attachEvent) oDown.attachEvent("onclick", new Function(this.name + ".next(); return false;"));*/
}