/*
CallOut Rotator

Karl Glasgow
code@keg4.com
Copyright 2011, All Rights Reserved.
*/

var intCallOuts = 0;
for (c = 0; c < 50; c++) 
{
    if (document.getElementById('CallOut-' + c) != null) 
    {
        intCallOuts++;
    }
}
if (intCallOuts > 0) 
{
    var intCallOutDelay = 8100; // made 100 milliseconds slower than the banner rotator, in order to improve synchronization
    var intCurrentCallOut = 1;
    var intLastCallOut = intCallOuts;
    var tmrNextCallOut = setTimeout(function() { NextCallOut(); }, intCallOutDelay);

    function NextCallOut()
    {
        clearTimeout(tmrNextCallOut);
        divPreviousCallOut = document.getElementById('CallOut-' + intCurrentCallOut);
        intCurrentCallOut = ((intCurrentCallOut + 1) > intLastCallOut? 1 : (intCurrentCallOut + 1));
        divNextCallOut = document.getElementById('CallOut-' + intCurrentCallOut);
        $('#' + divPreviousCallOut.id).hide();
        $('#' + divNextCallOut.id).show();
        
        tmrNextCallOut = setTimeout(function() { NextCallOut(); }, intCallOutDelay);
    }
}

