$(document).ready(function() {
    // remove misc hidden inputs from 7.65 ContentLists
    var container = document.getElementById('ctl00_BodyPlaceHolder_IndexCarousel_CarouselImagesContentList');
    var inputs = new Array();
    for (var node in container.childNodes)
    {
        if (container.childNodes[node].nodeName == "INPUT") {
            //alert(container.childNodes[node].id);
            inputs[node]=document.getElementById(container.childNodes[node].id);
        }
    }
    for (var input in inputs) {
        if (input.length > 0) container.removeChild(inputs[input]);
    }
    // load cycle fade
	$('.carousel-right').cycle({
		fx:'fade',
		speed: 500,
		timeout: 8000,
		pager:'#carousel-nav',
		after: function() {
		    var beginning;
		    var end;
		    beginning = this.alt;
		    if(beginning != "" && beginning != null) {
		        end = beginning.substring(beginning.indexOf("- ") + 2);
		        beginning = beginning.substring(0, beginning.indexOf(" -"));
		        var hyperlink = $(this).attr('longdesc');
			    $('#carousel-top').html('<a class="carousel-link" href="' + hyperlink + '">' + beginning + '&nbsp;<span class="carouselSummary">' + end + '</span></a>');
		    }
		}
	});
	$('#carousel-nav a').click(function() {
		$('.carousel-right').cycle('stop');
	});
});