// JavaScript Document
			
var sliderWidget = new function()
{
	this.timerInterval = 4000;
	this.timer = null;
	this.homePageSliderCurrentItem = 0;
	this.homePageSliderItems = 0;
	
	this.init = function()
	{
		//alert("init()");

		//Get Number of Contents
		this.homePageSliderItems = $(".home-page-slider-text-conent .content").length;		
		if(this.homePageSliderItems>0)
		{
			//Add Navigations
			for(i=0; i<this.homePageSliderItems;i++)
			{
				$(".home-page-slider-nav").append("<a href='#'>&nbsp;</a>&nbsp;");
			}			
			
			this.slide();
		}
		else
		{
			//alert("failed");
		}
	}
	
	this.slide = function()
	{
		//Hide All Contents
		$(".home-page-slider-text-conent .content").hide();
		
		//Set Default Index
		$(".home-page-slider-text-conent .content").eq(this.homePageSliderCurrentItem).fadeIn('slow');
		sel = ".home-page-slider-nav a";
		$(sel).removeClass("active");
		$(sel).eq(this.homePageSliderCurrentItem).addClass("active");
	}
	
	this.start = function()
	{
		//Start Timer
		$.timer(this.timerInterval, function(timer){		
			sliderWidget.timer = timer;
			sliderWidget.step();
			sliderWidget.slide();
		});		
	}
	
	this.step = function(step)
	{
		this.homePageSliderCurrentItem = step!=null ? step : this.homePageSliderCurrentItem++;
		if(this.homePageSliderCurrentItem>=this.homePageSliderItems)
			this.homePageSliderCurrentItem = 0;
	}
	
	this.stop = function()
	{
		if(this.timer!=null)
		{
			this.timer.stop();
		}
	}
	
	this.restart = function()
	{
		if(this.timer!=null)
		{
			this.timer.reset(this.timerInterval);
		}
	}			
}
