/* Javascript code for Harish's Auto Services  */

//___ SCRIPT.ACULO.US VAR SETTING

// set the starting image.
var i = 0;            

// The array of div names which will hold the images
var image_slide = new Array('image-1','image-2','image-3','image-4','image-5');

// The number of images in the array.
var NumOfImages = image_slide.length;

// The time to wait before moving to the next image. Set to 4 seconds by default.
var wait = 3000;

//___ IMAGE TRANSITION

// The Fade Function
function swapImage(x,y) {        
    $(image_slide[x]).appear({ duration: 1.5 });
    $(image_slide[y]).fade({duration: 1.5});
}

// the onload event handler that starts the fading.
function startTransition() {
    play = setInterval('Play()',wait);                                
}

function Play() {

    var imageShow, imageHide;

    imageShow = i+1;
    imageHide = i;
    
    if (imageShow == NumOfImages) {
        swapImage(0,imageHide);    
        i = 0;                    
    }
    else {
        swapImage(imageShow,imageHide);            
        i++;
    }
}

