/*
 * jZFI JavaScript Library v1.0
 * http://www.zfi.ch
 *
 * Copyright 2011, Daniel Schmutz, ZFI 
 * http://www.zfi.ch
 *
 *
 */

function News() {
	this.width = 200;
	this.timer = null;
	this.index = 0;
	this.start = function() {
		// start news interval
		this.timer = setInterval("zfiNews.next()", 20000);
	}
	this.next = function() {
		var _this = this;
//		alert("news width = " + _this.width + ", news index = " + _this.index);
		$('#zfi-news').hide();
		$.ajax({
			  url      : '/ajax/news.php',
			  data     : { action : 'next', width: _this.width, index : _this.index++ },
			  type     : 'GET',
			  dataType : 'html',
			  success  : function(html) {	
				  $('#zfi-news').fadeIn('slow').html(html);				  
			  },
			  error    : function(xhr, status) { },
			  complete : function(xhr, status) { }
			});
	}
}

var zfiNews = new News();
zfiNews.start();

