var totalQuotes;
var currentQuote = 1;
var lhsOutMargin = "-650px"


function getTotalCaseStudies()
{
    totalQuotes = $("[id^='scrollElement']").length;
}

function doPlay()
{
       
        
        setTimeout("nextQuote();doPlay();",9000);    
              
}

function nextQuote()
{
    slideOut(currentQuote);
    moveCurrent();
    setTimeout("slideIn()", 600);
       
}


function slideOut(id)
{
$("#scrollElement"+currentQuote).animate({opacity:"0"},600);

}

function slideIn()
{

$("#scrollElement"+currentQuote).animate({opacity:"1"},600);
}







function moveCurrent()
{
    if(currentQuote  == totalQuotes)
    {
        currentQuote =1;
    }
    else{
    currentQuote++;
    }

}


$(document).ready(function(){



getTotalCaseStudies();

if(totalQuotes > 1)
{
	doPlay();
}







 });


