	/*
* vertical news ticker
* Tadas Juozapaitis ( kasp3rito@gmail.com )
* http://www.jugbit.com/jquery-vticker-vertical-news-ticker/
*/

$abc = jQuery.noConflict();

isPaused = false;

(function($abc){

$abc.fn.vTicker = function(options) {
		 
	document.getElementById("tickercontainer").style.overflow = "hidden";
	
	var defaults = {
		speed: 700,
		pause: 4000,
		showItems: 3,
		mousePause: true,
		direction: 'up',
		height: 0
	};

	var options = $abc.extend(defaults, options);

	moveUp = function(obj2, height, options){
		if(isPaused)
			return;
			
		var obj = obj2.children('ul');
		
    	var clone = obj.children('li:first').clone(true);
		
		if(options.height > 0)
		{
			height = obj.children('li:first').height();
		}		
		
    	obj.animate({top: '-=' + height + 'px'}, options.speed, function() {
        	$abc(this).children('li:first').remove();
        	$abc(this).css('top', '0px');
        });
		
			//Fließender Übergang
			obj.children('li:first').fadeOut(options.speed);
			if(options.height == 0)
			{
			obj.children('li:eq(' + options.showItems + ')').hide().fadeIn(options.speed).show();
			}

    	clone.appendTo(obj);
	};
	

	
	return this.each(function() {
		var obj = $abc(this);
		var maxHeight = 0;

		obj.css({overflow: 'hidden', position: 'relative'})
			.children('ul').css({position: 'absolute', margin: 0, padding: 0})
			.children('li').css({margin: 0, padding: 0});

		if(options.height == 0)
		{
			obj.children('ul').children('li').each(function(){
				if($abc(this).height() > maxHeight)
				{
					maxHeight = $abc(this).height();
				}
			});

			obj.children('ul').children('li').each(function(){
				$abc(this).height(maxHeight);
			});

			obj.height(maxHeight * options.showItems);
		}
		else
		{
			obj.height(options.height);
		}
		
    	var interval = setInterval(function(){

			moveUp(obj, maxHeight, options); 

		}, options.pause);
		
		if(options.mousePause)
		{
			obj.bind("mouseenter",function(){
				isPaused = true;
			}).bind("mouseleave",function(){
				isPaused = false;
			});
		}
	});
};
})(jQuery);
	


	
