


// Declarations
var lNewImage;
var arrFeatureImage; // = new Array();
var arrFeatureText; // = new Array();

// Start the feature
var tid = setInterval('RotateFeature();', 7500);

// Set up the list of images and supporting text
//<% For Each objItem In ildic_FeatureList %>
//	arrFeatureImage.push('<%= ildic_FeatureList(objItem)("Filename") %>');
//	arrFeatureText.push('<%= ildic_FeatureList(objItem)("Text") %>');
//<% Next %>

// Preload the next image
function GetImages() {
    //alert("dd");
    
    //set first image
    
    
    
    
    //images
    txt = document.getElementById("ctl00_hidImages").value;
    txt = txt.replace("&amp;","&")
    arrFeatureImage = txt.split('|');
    
    //text
    txt = document.getElementById("ctl00_hidImagesText").value;
    txt = txt.replace("&amp;","&")
    arrFeatureText = txt.split('|');
    
    //set first image
    //$(".FeatureImage").attr("src", "/" + arrFeatureImage[0]);

    // And text
	//$("#ctl00_FeatureText").text(arrFeatureText[0]);
    
    PreLoadNewImage()    
}
// =====================================================================================

function PreLoadNewImage()
{

	// Calculate the next image
	SetNewImage()

	// Preload it
	var objImage = new Image(418, 370);
	objImage.src = '/' + arrFeatureImage[lNewImage];

}

// =====================================================================================

function SetNewImage()
{

	// Calculate the next image
	lNewImage = Math.round(Math.random() * (arrFeatureImage.length - 1));

	// See if it is the same as the one that we are already showing
	while ($(".FeatureImage").attr("src") == "/" + arrFeatureImage[lNewImage])
	{
		// It is, pick another
		lNewImage = Math.round(Math.random() * (arrFeatureImage.length - 1));
	}

}

// =====================================================================================

function RotateFeature()
{

	// Fade it out
	$(".FeatureImage").fadeOut(500, function () {
		// Change the image
		$(".FeatureImage").attr("src", "/" + arrFeatureImage[lNewImage]);

		// And text
		$("#ctl00_FeatureText").text(arrFeatureText[lNewImage]);

		// And fade it in
		$(".FeatureImage").fadeIn(500);

		// Preload the next image
		PreLoadNewImage()
	});
}

function NavOver(vobj) {
	$(vobj).parent().parent().get(0).className = 'Highlight';
}

function NavOut(vobj) {
	$(vobj).parent().parent().get(0).className = '';
}