var mycarousel_itemList = [
    {url: 'images/pubs/DE20111013276.jpg', title: 'Clean Cities Now: Plugging In, Cities are planning for electric vehicle infrastructure', go: 'pdf/pubs/DE20111013276.pdf'},
    {url: 'images/pubs/DE20111009368.jpg', title: 'Management of Water Extracted from Carbon Sequestration Projects', go: 'pdf/pubs/DE20111009368.pdf'},
    {url: 'images/pubs/DE20111013266.jpg', title: 'Survey and Down-Selection of Acid Gas Removal Systems for the Thermochemical Conversion of Biomass to Ethanol', go: 'pdf/pubs/DE20111013266.pdf'},
    {url: 'images/pubs/PB2011112703.jpg', title: 'Testing of Volatile and Nonvolatile Emissions from Advanced Technology Natural Gas Vehicles', go: 'pdf/pubs/PB2011112703.pdf'},
    {url: 'images/pubs/PB2011113887.jpg', title: 'Review of Transportation Fuel Life Cycle Analysis', go: 'pdf/pubs/PB2011113887.pdf'},
    {url: 'images/pubs/DE20111013068.jpg', title: 'China\'s Energy and Carbon Emissions Outlook to 2050', go: 'pdf/pubs/DE20111013068.pdf'},
    {url: 'images/pubs/DE20111008109.jpg', title: 'Biofuel Impacts on Water', go: 'pdf/pubs/DE20111008109.pdf'},
    {url: 'images/pubs/PB2011105287.jpg', title: 'Gasoline Composition Regulations Affecting LUST Sites', go: 'pdf/pubs/PB2011105287.pdf'},
    {url: 'images/pubs/DE20111010951.jpg', title: 'Intelligent Bioreactor Management Information System for Mitigation of Greenhouse Gas Emissions', go: 'pdf/pubs/DE20111010951.pdf'}

];

function mycarousel_itemVisibleInCallback(carousel, item, i, state, evt)
{
    // The index() method calculates the index from a given index who is out of the actual item range.
    var idx = carousel.index(i, mycarousel_itemList.length);
    carousel.add(i, mycarousel_getItemHTML(mycarousel_itemList[idx - 1]));
};

function mycarousel_itemVisibleOutCallback(carousel, item, i, state, evt)
{
    carousel.remove(i);
};

/*** Item html creation helper. */
function mycarousel_getItemHTML(item)

{
    return '<a href="' + item.go + '"><img src="' + item.url + '" height="200" alt="" title="' + item.title + '" border="0" style="outline-width:0px" /></a>';
};

jQuery(document).ready(function() {
    jQuery('#mycarousel').jcarousel({
        wrap: 'circular',
        itemVisibleInCallback: {onBeforeAnimation: mycarousel_itemVisibleInCallback},
        itemVisibleOutCallback: {onAfterAnimation: mycarousel_itemVisibleOutCallback}
    });
});

