function returnA(title, first, index) {
    if(first)
        return "<a href='#' class='cs_cr_navigation" + index + "  first'>" + title + "</a>";
    return "<a href='#' class='cs_cr_navigation" + index + " '>" + title + "</a>";
}

function returnDiv(title, first) {
    if(first)
        return "<div class='cs_cr_navigation first activeSlide'>" + title + "</div>";
    return "<div class='cs_cr_navigation'>" + title + "<div class='separator'></div></div>";
}
function returnDiv2(title, first, index) {
    if(first)
        return "<div class='cs_cr_navigation" + index + " activeSlide'><div class='value'>" + title + "</div><div class='separator2'></div></div>";
    return "<div class='cs_cr_navigation" + index + "'><div class='value'>" + title + "</div><div class='separator2'></div></div>";
}

function rotateContent(type, options)
{
    jQueryCS('#rotate' + options.moduleId).show();
    if(type == 1)
    {                    
        jQueryCS('#rotate' + options.moduleId).cycle({
            fx: options.effect, 
            speed:   options.speed, 
            timeout:  options.timeout,
            pause: 1,
	    cleartypeNoBg: true,
            random: 0
        });
    }
    if(type == 2)
    {                    
        jQueryCS('#rotate' + options.moduleId).cycle({
            fx: options.effect, 
            speed:   options.speed, 
            timeout:  options.timeout,
            pause: 1,
	    cleartypeNoBg: true,
            random: 0,
            next:'.next' + options.moduleId,
            prev:'.prev' + options.moduleId,
            pager: '.cs_cr_nav' + options.moduleId,
            pagerEvent: 'click',
            pagerAnchorBuilder: function(index, DOMelement) {
                return returnA('&nbsp;&nbsp;&nbsp;&nbsp;', false, index); 
            }
        });
    }
    if(type == 3)
    {                    
        jQueryCS('#rotate' + options.moduleId).cycle({
            fx: options.effect, 
            speed:   options.speed, 
            timeout:  options.timeout,
            pause: 1,
	    cleartypeNoBg: true,
            random: 0,
            pager: '.cs_cr_nav' + options.moduleId,
            pagerEvent: 'click',
            pagerAnchorBuilder: function(index, DOMelement) {
                return returnDiv2(options.items[index].Title.length > 0 ? options.items[index].Title : '&nbsp;&nbsp;&nbsp;&nbsp;', index == 0, index); 
            },
            before: function onBefore(curr, next, opts) {
                jQueryCS(jQueryCS(opts.pager).children()).removeClass('activeSlide');
                jQueryCS(jQueryCS(opts.pager).children()[opts.nextSlide]).addClass('activeSlide');
                opts.timeout = options.isClick ? 10000 : options.timeout; 
                options.isClick = false;
            },
            pagerClick:function(zeroBasedSlideIndex, slideElement) {
                options.isClick = true;
            }
        });
    }          
}
