function newsSlider(){
	this.data = null;
	this.itemCount = 0;
	
	this.isChangeable = 1;
	this.curIndex = 0;
	this.prevItem = -1;
	this.timeoutFunction = '';
	this.timeoutIndex = "";
	
	this.imageElement = null;
	this.linkElement = null;
	this.titleElement = null;
	
	this.changeItem = function(opcode){		
		this.clearTimeout();
		this.curIndex += opcode;
		
		if(this.curIndex > this.itemCount)
			this.curIndex = 1;
		else if (this.curIndex < 1)
			this.curIndex = this.itemCount;
		
		if(this.imageElement){
			this.imageElement.src = this.data[this.curIndex]['image'];
		}
		if(this.linkElement){
			this.linkElement.href = this.data[this.curIndex]['link'];
		}
		if(this.titleElement){
			this.titleElement.innerHTML = '<a href="'+ this.data[this.curIndex]['link'] + '" target="_blank">' +this.data[this.curIndex]['title'] + '</a>';
		}
		this.prevItem = this.curIndex;
		if(this.isChangeable)
			this.timeoutIndex = setTimeout(this.timeoutFunction, 5000);
		
	}
	this.clearTimeout = function(){
		if(this.timeoutIndex != ""){
			clearTimeout(this.timeoutIndex);
			this.timeoutIndex = "";
		}
	}
	this.forwClick = function(){
		this.isChangeable = 1;
		this.timeoutFunction = this.name + ".changeItem(1)";
		this.changeItem(1);
		this.clearTimeout();
		this.timeoutIndex = setTimeout(this.timeoutFunction, 5000);
	}
	this.backClick = function(){
		this.isChangeable = 1;
		this.timeoutFunction = this.name + ".changeItem(-1)";
		this.changeItem(-1);
		this.clearTimeout();
		this.timeoutIndex = setTimeout(this.timeoutFunction, 5000);
	}
}

