// this array consists of the id attributes of the divs we wish to alternate between
var currentCrossFadeDiv = 'SilkLace';
var currentCrossBlindDiv = '';
var visibleSet = '';
var nextSet = '';

// the starting index in the above array.  It should be set to the value of the div which doesn't have the CSS //Display property set to "none"
var i = 0;

// the number of milliseconds between swaps.  Default is five seconds.
var wait = 1000;

// the function toggles the set rows
function toggleSets(element) {
    doBlindUp(element);
    if (element == 'Thumbs1') {
        visibleSet = 'Thumbs2';
        window.setTimeout('doBlindDown()', wait);
    }
    else if (element == 'Thumbs2') {
        visibleSet = 'Thumbs3';
        window.setTimeout('doBlindDown()', wait);
    }
    else { // visibleSet == 'Thumbs3'
        visibleSet = 'Thumbs1';
        window.setTimeout('doBlindDown()', wait);
    }
}

function toggleRows(element1, element2) {
	Effect.BlindUp(element1, { duration:1, from:0.0, to:1.0 });
	nextSet = element2;
	window.setTimeout("showNextRow()", wait);
}

function showNextRow() {
	Effect.BlindDown(nextSet, { duration:1, from:0.0, to:1.0 })
}

function doBlindUp(element) {
    Effect.BlindUp($(element), { duration:1, from:0.0, to:1.0 });
}

function doBlindDown() {
    Effect.BlindDown($(visibleSet), { duration:1, from:0.0, to:1.0 });
}

// the function that performs the fade
function crossFade(element) {
	if (currentCrossFadeDiv != '')
	    Effect.Fade($(currentCrossFadeDiv), { duration: 1, from:1.0, to:0.0}) ;
    if (currentCrossFadeDiv != element)  {
	    currentCrossFadeDiv = element;
	    window.setTimeout('doFadeIn()', wait);
    }
    else
    	currentCrossFadeDiv = '';
    
}

function doFadeIn() {
	Effect.Appear($(currentCrossFadeDiv), { duration:1, from:0.0, to:1.0 });
}

function doFadeIn2() {
	Effect.Appear($(currentCrossBlindDiv ), { duration:1, from:0.0, to:1.0 });
}

