/* Toggle Play Pause links */
function togglePlay(element1,element2) {
     document.getElementById(element1).style.display = 'inline';
     document.getElementById(element2).style.display = 'none';
}

jQuery(document).ready(function() {
    var t = $('.homeWelcomeIntro').text();
    $('.homeWelcomeIntro').text('');
    $('.welcome').css({opacity:0, marginLeft:'80px'}).animate({opacity:1, marginLeft:'0px'}, 4000, function() {
  $(this).get(0).style.removeAttribute('filter');
});
    $(document).oneTime(4000, 'typeCharacterStartDelay', function() {
        $(document).everyTime(28, 'typeCharacter', function(i) {
            $('.homeWelcomeIntro').text(t.substr(0, i));
        }, t.length);
    });

    $('.newsSlider .stgslide').cycle({
        fx: 'fade',
        random: 0,
        autostop: true,
        autostopCount: 32,
        delay: 5000,
	timeout: 4000,
	speed: 1000,
        cleartypeNoBg: true,
        prev: '#prevButton',
        next: '#nextButton',
        pager: '.stgbtnwrpr .stgbtngrp',
        pagerAnchorBuilder: function(idx, slide) {
            idx += 1;
            return '<div class="stgbtnoff">' + idx + '</div>';
        }
    });

    $('.newsSlider .stgbtngrp .stgbtnoff').click(function() {
        $('.newsSlider .stgslide').cycle('pause');
    });
    $('#pauseButton').click(function() {
        $('.newsSlider .stgslide').cycle('pause');
    });
    $('#playButton').click(function() { 
        $('.newsSlider .stgslide').cycle('resume'); 
    });

});

$.fn.cycle.updateActivePagerLink = function(pager, currSlideIndex) {
    $(pager).find('div').removeClass('stgbtnon').filter('div:eq(' + currSlideIndex + ')').addClass('stgbtnon');
};
