// JavaScript Document
var mycarousel_itemList = [
    {href: 'http://www.ergoindemand.com/product_info.php?products_id=544', url: 'images_spinner/03-MON8020.jpg', title: '03-MON8020.LG', description: "Wall Mount with Keybaord Tray", price: '$439.95'},
    {href: 'http://www.ergoindemand.com/product_info.php?products_id=1952', url: 'images_spinner/14-FLIP_s.jpg', title: '14-FLIP', description: "Flip Down LCD Mount", price: '$45.95'},
    {href: 'http://www.ergoindemand.com/product_info.php?products_id=3220', url: 'images_spinner/25-KTP-230B.jpg', title: '25-KTP-230B', description: "Dual LCD Vertical Stand", price: '$249.95'},
    {href: 'http://www.ergoindemand.com/product_info.php?products_id=22073', url: 'images_spinner/60-9140-08.jpg', title: '60-9140-08', description: "Flexible Data Entry Arm", price: '$319.95'},
    {href: 'http://www.ergoindemand.com/product_info.php?products_id=5596', url: 'images_spinner/05-716B-BR91.jpg', title: '05-716B-BR91', description: "Table Top Display Board", price: '$204.95'},
    {href: 'http://www.ergoindemand.com/product_info.php?products_id=3077', url: 'images_spinner/25-KPD-110S.jpg', title: '25-KPD-110S', description: "16 Inch Swing Arm Pole Mount", price: '$179.95'},
    {href: 'http://www.ergoindemand.com/product_info.php?products_id=1791', url: 'images_spinner/03-MON7020BK.jpg', title: '03-MON7020BK', description: "Adjustable Wall Mount",price: '$313.95'},
    {href: 'http://www.ergoindemand.com/product_info.php?products_id=826', url: 'images_spinner/05-89759.jpg', title: '05-89759', description: "Laptop Projector Sit-Stand Cart", price: '$233.95'},
    {href: 'http://www.ergoindemand.com/product_info.php?products_id=7154', url: 'images_spinner/11-1929GR.jpg', title: '11-1929GR', description: "Stand Up Computer Desk", price: '$339.95'},
	{href: 'http://www.ergoindemand.com/product_info.php?products_id=22928', url: 'images_spinner/06-FDS021L.jpg', title: '06-FDS021L', description: "Flip and Find Desk Organizer", price: '$99.95'},
    {href: 'http://www.ergoindemand.com/product_info.php?products_id=4701', url: 'images_spinner/25-PFC-UB.jpg', title: '25-PFC-UB', description: "Portable Plasma TV Cart", price: '$789.95'},
    {href: 'http://www.ergoindemand.com/product_info.php?products_id=1594', url: 'images_spinner/05-669RG-DD.jpg', title: '05-669RG-DD', description: "4 ft x 6 ft Marker Board", price: '$759.95'},
    {href: 'http://www.ergoindemand.com/product_info.php?products_id=1955', url: 'images_spinner/14-AM2.jpg', title: '14-AM2', description: "17 inch Swing Out LCD Mount", price: '$74.95'},
    {href: 'http://www.ergoindemand.com/product_info.php?products_id=4432', url: 'images_spinner/11-5370BL.jpg', title: '11-5370BL', description: "Mobile File Cart with Locking Top", price: '$198.95'},
    {href: 'http://www.ergoindemand.com/product_info.php?products_id=8743', url: 'images_spinner/02-AB4-CH.jpg', title: '02-AB4-CH', description: "AlphaBetter Student Desk", price: '$354.95'},
    {href: 'http://www.ergoindemand.com/product_info.php?products_id=3717', url: 'images_spinner/02-CML927.jpg', title: '02-CML927', description: "Lift & Lock Keyboard Tray", price: '$124.95'},
    {href: 'http://www.ergoindemand.com/product_info.php?products_id=7284', url: 'images_spinner/05-34434.jpg', title: '05-34434', description: "Executive Chair with Headrest", price: '$466.95'}
];

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.href + '"><img src="' + item.url + '" width="100" height="100" border="0" alt="' + item.title + '"/></a><div align="center"><font size="1"><a style="text-decoration:none;" href="' + item.href + '">' + item.description + '</a></font><br>' + item.price + '</div>';
};

jQuery(document).ready(function() {
    jQuery('#mycarousel').jcarousel({
        wrap: 'circular',
        itemVisibleInCallback: {onBeforeAnimation: mycarousel_itemVisibleInCallback},
        itemVisibleOutCallback: {onAfterAnimation: mycarousel_itemVisibleOutCallback}
    });
});
