function NewsTicker(){
	
	var currentActive = 0;
	var timeout = null;
	
    this.init = function(){
    	(function($) {
    		self.setTimeout();
    	})(jQuery);
    }
	
	this.shownext = function() {
		
		var no = $('.tickerText').length;
		  
		if(currentActive + 1 ==  no)
			var newActive = 0;
		else
			var newActive = currentActive + 1;
			
		
		$('.tickerText').each(function(k, v) { 
			if(k == newActive) {
				//$(v).slideDown("slow");	
				//$(v).animate({width: 'show'});
				//$(v).slideUp("slow");
				
				$(v).show("slide", { direction: "right" }, 1000);
				/*$(v).animate({
					marginLeft: "0",
					visibility: 'visible'
				});*/
			}
			else if(k == currentActive) {
				//$(v).slideUp("slow");
				//$(v).animate({width: 'hide'});
				//$(v).slideDown("slow");
				$(v).hide("slide", { direction: "left" }, 1000);
				
				/*
				$(v).animate({
					marginLeft: "-"+$(v).width(),
					visibility: 'hidden'
				});*/
			}
		});
		
		currentActive = newActive;
        
		self.setTimeout();
	}
	
	this.setTimeout = function() {
		timeout = window.setTimeout(function(){ newsTicker.shownext(); }, 4000);
	}
	
	this.clearTimeou = function() {
		window.clearTimeout(timeout);
	}


    
    var self = this;
}

var newsTicker = new NewsTicker();

(function($) {
	$(document).ready(function(){
        newsTicker.init();
	});
})(jQuery);
	
