/** 
Author : Maulik Bavishi   
Company Name : Artoonsolutions Pvt Ltd.
Auto slider
**/

var prevStop;
var nextStop;
var sliderElement;
var ulWidth = 0;
var liWidth = 585;    //159 is width of each li. replace it with your li width in this file in all places.
var totalImage;
var slideTime = 10000;		//10 Seconds

function slider(elemen , showImageNumber )
{	
	sliderElement = elemen;
	
	/** giving width to the ul slider class according to images in that **/
	totalImage = jQuery(elemen+' li').size();
	ulWidth = liWidth*totalImage;
	
	/** giving width to the ul slider class according to images in that **/
	jQuery(elemen).css('left','0px');
	jQuery(elemen).css('width',ulWidth);
	
	/** for stoping slider two variable **/
	prevStop = 0;
	nextStop = totalImage-showImageNumber;

	setTimeout('nextAction()',slideTime);
}

function nextAction()
{
	if(nextStop != 0)
	{
		var tLeft = jQuery(sliderElement).css('left');
		tLeft = tLeft.split("px");
		tLeft = eval(tLeft[0])-liWidth;
		
		jQuery(sliderElement).stop().animate( { left :tLeft },1000 ,function() { nextStop--; prevStop++; setTimeout('nextAction()',slideTime); } );
	}
	else
	{
		jQuery(sliderElement).stop().animate( { left : 0 },1000 ,function() { nextStop=totalImage-1; prevStop=0; setTimeout('nextAction()',slideTime); } );
	}
}


var prevStop1;
var nextStop1;
var sliderElement1;
var mainDivWidth = 0;
var divWidth = 298;    //159 is width of each li. replace it with your li width in this file in all places.
var totalDiv;
var slideTime1 = 8000;		//10 Seconds

function serviceSlider(elemen1 , showImageNumber )
{	
	sliderElement1 = elemen1;
	
	/** giving width to the ul slider class according to images in that **/
	totalDiv = jQuery(elemen1+' .about_project1').size();
	mainDivWidth = divWidth*totalDiv;
	
	/** giving width to the ul slider class according to images in that **/
	jQuery(elemen1).css('left','0px');
	jQuery(elemen1).css('width',mainDivWidth);
	
	/** for stoping slider two variable **/
	prevStop1 = 0;
	nextStop1 = totalDiv-showImageNumber;

	setTimeout('nextAction1()',slideTime1);
}

function nextAction1()
{
	if(nextStop1 != 0)
	{
		var tLeft = jQuery(sliderElement1).css('left');
		tLeft = tLeft.split("px");
		tLeft = eval(tLeft[0])-divWidth;
		
		jQuery(sliderElement1).stop().animate( { left :tLeft },1000 ,function() { nextStop1--; prevStop1++; setTimeout('nextAction1()',slideTime1); } );
	}
	else
	{
		jQuery(sliderElement1).stop().animate( { left : 0 },1000 ,function() { nextStop1=totalDiv-1; prevStop1=0; setTimeout('nextAction1()',slideTime1); } );
	}
}
