function newsanim(object){
	this.obj=object;
	this.items=0;
	this.current=0;
	this.displayTime=8000;
	this.animTime=800;
	this.interval=0;
	this.menu=true;
	this.anim='fade';
	this.init = function(){
		var scope = this;
		if(scope.anim=='fade'){
			scope.obj.find('div.article').css('position','absolute');
			scope.obj.find('.news').css('position','relative');
		}
		scope.items = $(scope.obj).find(".news .article").size();
		if(scope.items>1)
		{
			$(scope.obj).find(".news .article").fadeOut(0);
			$(scope.obj).find(".news .article:eq("+scope.current+")").fadeIn(scope.animTime);
			scope.interval = setInterval(function(){
				scope.animate()
			},scope.displayTime);
			if(scope.menu===true){
				$(scope.obj).find(".menu a:eq("+scope.current+")").fadeIn(scope.animTime);
				$(scope.obj).find(".menu a").click(function(){
					clearInterval(scope.interval);
					scope.animate($(this).index()+1);
					scope.interval = setInterval(function(){
						scope.animate()
					},scope.displayTime);
				});
			}else{
				$(scope.obj).find("div.menu").fadeOut(0);
			}
		}
		else
		{
			$(scope.obj).find(".news .article").fadeIn(scope.animTime);
			$(scope.obj).find(".menu").fadeOut(0);
		}
	}
	this.animate = function(ch){
		var scope = this;
		if(scope.menu===true) $(scope.obj).find("div.menu a").removeClass('selected');
		$(scope.obj).find(".news .article:eq("+scope.current+")").fadeOut(scope.animTime,function()
		{
			if(scope.anim=='hideshow'){
				if( ch>0 && ch <= scope.items ){
					scope.current=ch-1;
				}
				else
				{
					scope.current = ++(scope.current)%scope.items;
				}
				$(scope.obj).find(".news .article:eq("+scope.current+")").fadeIn(scope.animTime);
				if(scope.menu===true) $(scope.obj).find("div.menu a:eq("+scope.current+")").addClass('selected');
			}
		});
		if(scope.anim=='fade'){
			if( ch>0 && ch <= scope.items ){
				scope.current=ch-1;
			}
			else
			{
				scope.current = ++(scope.current)%scope.items;
			}
			$(scope.obj).find(".news .article:eq("+scope.current+")").fadeIn(scope.animTime);
			if(scope.menu===true) $(scope.obj).find("div.menu a:eq("+scope.current+")").addClass('selected');
		}
	}
}

