﻿
$(function() {
    var containerWidth = '400px';
    $('#navLinks')
    .css({ width: containerWidth, 'text-align': 'center', margin: '4px 0' })
    .append("[ <a href='#'><span id='prev'>&lt; Previous</span></a>"
    + " | <a id='pause-play' href='#'>Pause</a>"
    + " | <a href='#'><span id='next'>Next &gt;</span></a> ]"
  );
    // <div> container holding all the news stories
    var $newsStories = $('#newsStories');
    /* dynamically style:
    * [1] container itself
    * [2] each paragraph in the summary 
    */
    $newsStories.css({ width: containerWidth, height: '230px', margin: '10px 0', color: '#0000ff' }).find('div div').css({ padding: '8px' });

    // call the plugin and set the options  
    $newsStories.cycle({
        timeout: 6000, cleartype: 1, speed: 400,
        prev: '#prev', next: '#next',
        after: function(currSlideElement, nextSlideElement, options, forwardFlag) {
            $('#newsInfo').html('<strong>'
        + 'Article ' + (options.currSlide + 1) + ' of ' + options.slideCount
        + '</strong>'
      );
        }
    });
    //    $('#pause-play').click(function() {
    //        var pause = 'Pause';
    //        var text = $(this).text();
    //        if (pause == text) {
    //            $newsStories.cycle('pause');
    //            $(this).text('Play');
    //        }
    //        else {
    //            $newsStories.cycle('resume', true);
    //            $(this).text(pause);
    //        }
    //        return false;
    //    });
    $('img.newsPic').css({ float: 'center', padding: '0 4px', margin: '8px' });
    //$('a.msgAlert').click(function() {
    //alert('Hyperlink disabled for this example; News Article does not exist.');
    //return false;
    //});
});
