function radar_hatti() {
	this.data = null;
	this.itemCount = 0;
	this.name = '';
	//this.itemsName = '';
	
	this.isChangeable = 1;
	this.curIndex = 0;
	this.prevItem = -1;
	this.timeoutFunction = '';
	this.timeoutIndex = "";
	
	this.imageElement = null;
	this.linkElement = null;
	this.titleElement = null;
	this.displayElement = null;
	this.newsTypeElement = 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 = "http://www.medyaradar.com/" + this.data[this.curIndex]['image'];
		}
		
		if(this.linkElement){
			this.linkElement.href = "http://www.medyaradar.com" + this.data[this.curIndex]['link'];
		}
		
		//if(this.itemsName){
			//document.getElementById(this.itemsName + this.curIndex).className = "item active";
			//if(this.prevItem != -1){
				//document.getElementById(this.itemsName + this.prevItem).className = "item";
			//}
		//}
		if(this.displayElement){
			this.displayElement.innerHTML = this.curIndex + ' / ' + this.itemCount;
		}
		this.prevItem = this.curIndex;
		if(this.isChangeable)
			this.timeoutIndex = setTimeout(this.timeoutFunction, 8000);
	}
	
	this.clearTimeout = function() {
		if(this.timeoutIndex != "") {
			clearTimeout(this.timeoutIndex);
			this.timeoutIndex = "";
		}
	}
	
	this.jumpTo = function(idx) {
		if(idx == this.prevItem)
			return;
		this.isChangeable = 0;
		this.clearTimeout();
		this.changeItem(idx - this.prevItem);
	}
	
	this.forwClick = function() {
		this.isChangeable = 1;
		this.timeoutFunction = this.name + ".changeItem(1)";
		this.changeItem(1);
		this.clearTimeout();
		this.timeoutIndex = setTimeout(this.timeoutFunction, 8000);
	}
	
	this.backClick = function() {
		this.isChangeable = 1;
		this.timeoutFunction = this.name + ".changeItem(-1)";
		this.changeItem(-1);
		this.clearTimeout();			
		this.timeoutIndex = setTimeout(this.timeoutFunction, 8000);
	}

}
