/* counter that gets incremented each iteration */
var counter = 0;
/* how long each array element shows */
var stamina = 2000; /* 2 seconds */
/* how long to pause between fading in the next element */
var intermission = 200; /* 1/2 second */

/* build our content array */
var fadeContent = new Array(
    "<img src='/images/aboutus/1-1.jpg' alt=''>",
    "<img src='/images/aboutus/1-2.jpg' alt=''>",
    "<img src='/images/aboutus/1-3.jpg' alt=''>",
    "<img src='/images/aboutus/1-4.jpg' alt=''>",
    "<img src='/images/aboutus/1-5.jpg' alt=''>",
    "<img src='/images/aboutus/1-6.jpg' alt=''>",
    "<img src='/images/aboutus/1-7.jpg' alt=''>",
    "<img src='/images/aboutus/1-8.jpg' alt=''>",
    "<img src='/images/aboutus/1-9.jpg' alt=''>",
    "<img src='/images/aboutus/1-10.jpg' alt=''>",
    "<img src='/images/aboutus/1-11.jpg' alt=''>",
    "<img src='/images/aboutus/1-12.jpg' alt=''>",
    "<img src='/images/aboutus/1-13.jpg' alt=''>"
);

/* swaps the content to the next element in the array,
then fades in the content */
function fadeInContent() {
    /* reset the counter if we have reached the end */
    if(counter == fadeContent.length) {
        counter = 0;
    }

    /* swap the html content */
    document.getElementById('fadeshow').innerHTML = fadeContent[counter];

    /* then fade in the next element */
    $('#fadeshow').fadeIn('slow', function() {
    	setTimeout("fadeOutContent()",stamina);
    });
}

/* fades out the current element, increments the counter,
then loops back to the previous function */
function fadeOutContent() {
    /* fade out the current element */
    $('#fadeshow').fadeOut('slow', function() {
	    /* increment the counter */
	    ++counter;
	
	    /* wait...then fade in the next element */
	    setTimeout("fadeInContent()",intermission);
    });
}
