 $(document).ready(function() {
    var d = new Date();
	var navitemlen = 3; //note!: set this variable to the num of items in the .navi element - so it scrolls though only once.
	var maxDispItems = 9; //used to set the maximum number of total items to scroll through.
    var cnt = 0;
    var feedUrl = '/rss/news.xml'+'?x='+d.getDate();
     jQuery.getFeed({
       url:feedUrl,
       success: function(feed){
            $(feed.items).each(function(x){
				if(x<maxDispItems){
                var itemDiv = document.createElement("div");
                var aLink = document.createElement("a");
                $(itemDiv).attr("class","nsitem");
                $(aLink).append(this.title);
                $(aLink).attr("href",this.link);
                $(aLink).attr("class", "nslink");
                $(".nsdisp").append(aLink);
				}
                cnt+1;
            });
        //note: dynamically add navi items based off number of articles.

        $("#news-block").scrollable({size:3, speed:1500, navi:'.navi', items:'.nsdisp', horizontal:false});
		$(".nsdisp").css('height','95px'); //reset the size of the display area
        //attach the timer for autoscrolling
        $("#news-block").everyTime("8s", function() {
                 //jQuery("#ns").scrollable("nextPage", 1, 300);
                 jQuery("#news-block").scrollable("nextPage", 1, 1200);
           }, 
           navitemlen, false);
        } //end success
    }); //end getFeed
 }); //end ready
