

function onAfter(curr, next, opts) {
    var index = opts.currSlide;
    var index = index + 1;

    jQuery("#showContent").html(jQuery("#thumb-" + index).html());
    jQuery("#columns_0_banner_0_hlImageLink1, #columns_0_banner_0_hlImageLink2, #columns_0_banner_0_hlImageLink3, #columns_0_banner_0_hlImageLink4").css('background-position', 'bottom left');
    jQuery("#columns_0_banner_0_hlImageLink1, #columns_0_banner_0_hlImageLink2, #columns_0_banner_0_hlImageLink3, #columns_0_banner_0_hlImageLink4").removeClass('active');
    jQuery("#columns_0_banner_0_hlImageLink" + index).css('background-position', 'top left');
    jQuery("#columns_0_banner_0_hlImageLink" + index).addClass('active')
}

jQuery(document).ready(function () {

    jQuery("#showContent").html(jQuery("#thumb-1").html());

    jQuery('#swap').cycle({
        fx: 'fade',
        autostop: 1,
        autostopCount: 5,
        after: onAfter,
        timeout: 5200
    });

    jQuery(".slideshow a").mouseover(function () { jQuery(this).css('background-position', 'top left'); });
    jQuery(".slideshow a").mouseout(function () {
        var aclass = jQuery(this).attr('class');

        if (aclass != "active") {
            jQuery(this).css('background-position', 'bottom left');
        }
    });

    jQuery("#slideshow a").click(function () {

        var now = jQuery(this).parent().index() + 1;

        // Switch content
        jQuery("#showContent").html(jQuery("#thumb-" + now).html());

        var i = 1;
        for (i = 1; i < 5; i++) {
            if (i != now) {
                jQuery("#columns_0_banner_0_hlImageLink" + i).removeClass('active');
                jQuery("#columns_0_banner_0_hlImageLink" + i).css('background-position', 'bottom left');
                //jQuery("#slideshow").children().eq(i).children().removeClass('active');
                //jQuery("#slideshow").children().eq(i).children().css('background-position','bottom left');
            }
        }

        jQuery(this).addClass('active');
        jQuery(this).css('background-position', 'top left');

        var imgId = jQuery(this).attr('id');
        //jQuery("#swap img").fadeOut();
        //alert(jQuery("#i"+imgId).attr('class'));
        jQuery("#swap").hide();
        jQuery("#swap").html("<img src='" + jQuery(this).attr('href') + "' />");
        jQuery("#swap").fadeIn('slow');
        return false;
    });
}); 

