var wcv_feature_hover = 0;
function rotateFeature() {
    // don't rotate if the mouse cursor is hovering over the features
    if (wcv_feature_hover) return;
    
    // don't rotate if only one image
    if (jq('#feature-images a').length < 2) return;

    // find next elements
    next_image = jq('#feature-images .selected').next('a');
    next_title = jq('#feature-captions .selected').next('.feature-caption');

    // out with the old
    jq('#feature-captions .selected').fadeOut(2000).removeClass('selected');
    jq('#feature-images .selected').fadeOut(2000).removeClass('selected');

    // in with the new
    if (next_title.length) {
        next_image.fadeIn(2000).addClass('selected');
        next_title.fadeIn(2000).addClass('selected');
    } else {
        jq('#feature-caption-0').fadeIn(2000).addClass('selected');
        jq('#feature-image-0').fadeIn(2000).addClass('selected');
    }
    
}

// rotate every 12 seconds
registerPloneFunction(
    function () {
        setInterval(rotateFeature, 12000);
        }
    );

