/********************  Home page animator - English **************************/

/* this variable will keep the number of the image displayed notice that it is global so that different functions can change and see it */
var count = 0;

// these are the dynamic targets (changed depending on picture displayed)
var targ = new Array(3);
targ[0] = "/categories/kitchen-faucet-suites?productFamily=119";
targ[1] = "/categories/bathroom-faucet-suites?productFamily=155";
targ[2] = "/products/275";

// these are the alt values for the rotating images (changed depending on picture displayed)
var altxt = new Array(3);
altxt[0] = "Camerist Kitchen Faucet";
altxt[1] = "Duna Bathroom Sink Faucet";
altxt[2] = "ExactTemp Vertical Spa";

// preload your images
var images = new Array(3);  // image array (again, assuming three pictures)
for (var i = 0; i < 3; i++)
{
        images[i] = new Image();
        images[i].src = "images/homebanner" + i + ".jpg";
        /* this assums you named your images homebanner0.jpg, homebanner1.jpg, and
homebanner2.jpg
        // and put them in the "images" directory */
}

function do_animation() // this will animate your picture
{
    if (count==3) count = 0;  // reset the counter if it gets to the last picture
	
    document.animation.src = images[count].src;  // changes your picture appropriately
	document.getElementById('animation-link').href = targ[count]; // change href 
	document.getElementById('animation').alt = altxt[count]; // change text for alt tag
    setTimeout("do_animation()", 5000); // delay before the next switch
    // make the number higher for a longer pause between switching

count++; // increment the counter
}

do_animation(); 
