if(typeof(app)=="undefined")var app={}
if(typeof(app['showTabbedContent'])=="undefined")app.showTabbedContent=function(d,r){
    var current=0,timer=null,ids='#'+d['id'].join(',#');
    $(".tabsNav a[href='#"+d['id'].join("'],.tabsNav a[href='#")+"']").each(function(){$(this).parent().addClass($(this).attr('href').replace('#',''))});
    $(ids).addClass('tabsContent');
    $('.tabsContent:not(:first)').hide();
    $('.tabsContent:first').show();
    $('.tabsNav li a').click(function(){
        if(!$(this).hasClass('active')){
            $(this).addClass('active').parent().siblings().find('a').removeClass('active');
            $(ids).css({'display':'none'});
            $($(this).attr('href')).css({'display':'block'});
            current=$('.active').index('.tabsNav li a');
        }
        return false;
    });
    function switchTabs(){
        current=(current==$('.tabsNav li').size()-1)?0:current+1;
        $('.tabsNav li:eq('+current+') a').trigger('click');
    }
    function setHoverHandler(){
        switchTabs();
        $('.tabsNav,'+ids).hover(function(){clearInterval(timer);timer=null},function(){timer=setInterval(switchTabs,r)}).trigger('mouseleave');
    }
    if(r>0)setHoverHandler();
}

