var rssTicker = function () {
	this.tickerId = 'news_ticker_area';
	this.itemId   = 'news_headline';
	this.tickerMessage = ticker_value;
	this.showNum = 0;
	this.showMax = this.tickerMessage.length;
	this.tId = 0;
	this.tAnimeId = 0;
	this.interval = 6000;
	this.intervalFPS = 17;
	this.vPosition = 32;
}
rssTicker.prototype = {
	begin: function () {
		this.start();
		return;
	},
	start: function() {
		this.show();
		var self = this;
		this.tId = setTimeout(
			'objRssTicker.start()',
			this.interval
		);
		return;
	},
	stop: function() {
		clearTimeout(this.tId);
		return;
	},
	show: function () {
		this.after();
		return;
	},
	pre: function () {
		this.vPosition = 32;
		this.pre_animation();
		return;
	},
	pre_animation : function () {
		this.locate(0, this.vPosition);
		this.vPosition = this.vPosition - 1;
		if ( this.vPosition >= 0 ) {
			var self = this;
			this.tAnimeId = setTimeout(
				'objRssTicker.pre_animation()', this.intervalFPS
			);
		}
		return;
	},
	after: function () {
		this.vPosition = 0;
		this.after_animation();
		return;
	},
	after_animation : function () {
		this.locate(0, this.vPosition);
		this.vPosition = this.vPosition - 1;
		if (this.vPosition > -32) {
			var self = this;
			this.tAnimeId = setTimeout(
				'objRssTicker.after_animation()', this.intervalFPS
			);
		} else {
			if (this.tickerMessage[this.showNum].event != '') {
				$(this.itemId).innerHTML = '<a id="href" href="'
				+ this.tickerMessage[this.showNum].link
				+ '" ' + this.tickerMessage[this.showNum].event + '>'
				+ this.tickerMessage[this.showNum].title
				+ '</a>';
			} else if (this.tickerMessage[this.showNum].link != '') {
				$(this.itemId).innerHTML = '<a id="href" href="'
				+ this.tickerMessage[this.showNum].link
				+ '" target="_blank">'
				+ this.tickerMessage[this.showNum].title
				+ '</a>';
			} else {
				$(this.itemId).innerHTML = this.tickerMessage[this.showNum].title;
			}
			this.showNum++;
			this.showNum %= this.showMax;
			this.pre();
		}
		return;
	},
	locate: function(x, y) {
		this.x = x;
		this.y = y;
		$(this.itemId).style.left = this.x + "px";
		$(this.itemId).style.top  = this.y + "px";
		return [this.x, this.y];
	}
}
objRssTicker  = new rssTicker();
window.onload = function () { objRssTicker.begin() };
