﻿window.contentIndex = 0;

function rotateContent() {
    if (window.contentIndex > $ektron('div.ContentRotatorContent div.ContentHtml').length - 1) { window.contentIndex = 0; }
    $ektron('.contentRotator').fadeOut(window.FadeDuration, function() {
        if ($ektron('div.ContentRotatorContent div.ContentHtml').length > 0) {
            var replacementHtml = $ektron($ektron('div.ContentRotatorContent div.ContentHtml')[window.contentIndex]).html();
            $ektron('div.contentRotator').html(replacementHtml);
            $ektron('div.contentRotator').children('img').attr({
                height: window.crheight.replace('px',''),
                width: window.crwidth.replace('px','')
            });
            switchContent(this);
        }
    });
}
function startContentRotator(interval) {
    rotateContent();
    setInterval('rotateContent()', interval);
}
function switchContent(content) {
    $ektron(content).fadeIn(window.FadeDuration);
    $ektron('div.contentRotator a.EktronEditorsMenuMarker').remove();    
    window.contentIndex++; 
}

