var mycarousel_itemList = [
    {img: '/ita/thumbnail.php?h=150&w=150&file=A02-PL302singolo.gif', title: 'NetPower 302AV', corpo: 'PowerLine Ethernet AV', id: 'A02-PL302KIT'}, {img: '/ita/thumbnail.php?h=150&w=150&file=A03-PS652_trasp.gif', title: 'OnePower 652', corpo: 'Line Interactive UPS', id: 'A03-PS652'}, {img: '/ita/thumbnail.php?h=150&w=150&file=A02-UP1-WN_320.png', title: 'NetFly UP1 WN', corpo: 'Wireless N Mini USB Adapter', id: 'A02-UP1-WN'}, {img: '/ita/thumbnail.php?h=150&w=150&file=A02-RA242-W54.gif', title: 'WebShare 242W', corpo: 'Wireless ADSL2+ Router', id: 'A02-RA242-W54'}, {img: '/ita/thumbnail.php?h=150&w=150&file=A02-RA111U_320x320bis.gif', title: 'WebShare 111U', corpo: 'WebShare 111U', id: 'A02-RA111U'}, {img: '/ita/thumbnail.php?h=150&w=150&file=A02-NASF101_320.png', title: 'DiskMaster NAS F101', corpo: 'SATA Single Bay Gigabit Network Storage', id: 'A06-NASF101'}, {img: '/ita/thumbnail.php?h=150&w=150&file=A02-F8PoE_320x320bis.gif', title: 'NetMaster F8PoE', corpo: 'NetMaster F8PoE', id: 'A02-F8PoE'}, {img: '/ita/thumbnail.php?h=150&w=150&file=A06-NASG303S_DSK.png', title: 'DiskMaster NAS G303S', corpo: 'SATA Single Bay Gigabit Network Storage', id: 'A06-NASG303S'}, {img: '/ita/thumbnail.php?h=150&w=150&file=A02-RAU244-W300N_320x320.gif', title: 'WebShare 3G 244WN', corpo: '802.11n Wireless ADSL2+/3G Router', id: 'A02-RAU244-W300N'}];

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);
    var htmlitem = mycarousel_getItemHTML(mycarousel_itemList[idx - 1]);
    
    carousel.add(i, htmlitem);
    $("a.thickbox").unbind();
    tb_init('a.thickbox');
};

function mycarousel_itemVisibleOutCallback(carousel, item, i, state, evt)
{
    carousel.remove(i);
};

/**
 * Item html creation helper.
 */
function mycarousel_getItemHTML(item)
{
    var html = '';
    html = '<div style="margin-top:15px;"><table border="0" cellspacing="2" cellpadding="2" width="260px">';
    html += '<tr>';
    html += '<td><img src="'+item.img+'" border="0"></td>';
    html += '<td><span class="home_prodotti_titolo">'+item.title+'</span><br>';
    html += '<span class="home_prodotti_corpo">'+item.corpo+'</span><br><br>';
    html += '<a class="thickbox" style="padding: 0; margin:0;" href="loadpopupprodotti.php?height=363&width=620&id='+item.id+'"><img src="/img_comuni/dettagli.png" border="0"></a>';
    html += '</td></tr></table></div>';
    return html;
};
