function mycarousel_initCallback(carousel)
{
    // Disable autoscrolling if the user clicks the prev or next button.
    carousel.buttonNext.bind('click', function() {
        carousel.startAuto(0);
    });

    carousel.buttonPrev.bind('click', function() {
        carousel.startAuto(0);
    });

    // Pause autoscrolling if the user moves with the cursor over the clip.
    carousel.clip.hover(function() {
        carousel.stopAuto();
    }, function() {
        carousel.startAuto();
    });
};

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 '<table width="150" height="180" cellpadding="0" cellspacing="0" border="0"><tr><td align="center" height="30">' + item.title + '</td></tr><tr><td width="150" Height="150" valign="middle" align="center"><img src="' + item.url + '"  style="HEIGHT:106px;BORDER:10px solid #DAD9D5;" alt="' + item.title + '" /></td></tr></table>';
	//return '<table cellpadding="0" cellspacing="0" border="0" width="146" height="220"><tr><td height="50" align="center" valign="bottom" class="toptext">' + item.title + '</td></tr><tr><td align="center" height="151"><table cellpadding="0" cellspacing="0" border="0" height="141"><tr><td rowspan="3" height="141" width="18" background="../pix/scroller/left.gif"></td><td height="17" background="../pix/scroller/top_middle.gif"></td><td rowspan="3" height="141" width="23" background="../pix/scroller/right.gif"></td></tr><tr><td height="101"><a href="' + item.url + '"><img src="' + item.image + '" height="101" border="0"></a></td></tr><tr><td height="23" background="../pix/scroller/bottom_middle.jpg"></td></tr></table></td></tr><tr><td height="19" align="center" valign="middle"><a href="' + item.url + '" class="bottomtext">more ></a></td></tr></table>';
	//return '<table cellpadding="0" cellspacing="0" border="0" width="29" height="40"><tr><td height="40" width="29" align="center" valign="middle"><a href="' + item.url + '" onClick="' + item.click + '"><img src="' + item.image + '" width="29" border="0"></a></td></tr></table>';
	//return '<table cellpadding="0" cellspacing="0" border="0" width="37" height="40"><tr><td height="40" width="29" align="center" valign="middle"><a href="' + item.url + '" onClick="' + item.click + '"><img src="' + item.image + '" width="29" border="0"></a></td><td width="8"><img src="../pix/x.gif" width="8"></td></tr></table>';
	//return '<table cellpadding="0" cellspacing="0" border="0" width="37" height="40"><tr><td height="40" width="29" align="center" valign="middle"><a href="' + item.url + '" onMouseOver="' + item.click + '"><img src="' + item.image + '" width="29" border="0"></a></td><td width="8"></td></tr></table>';
	return '<table cellpadding="0" cellspacing="0" border="0" width="57" height="65"><tr><td height="65" width="47" align="center" valign="middle"><a href="' + item.url + '" onMouseOver="' + item.click + '"><img src="' + item.image + '" width="45" border="0"></a></td><td width="10"></td></tr></table>';
};

function startScroller() {
	jQuery('#mycarousel').jcarousel({auto: 4,wrap: 'circular',itemVisibleInCallback: {onBeforeAnimation: mycarousel_itemVisibleInCallback},itemVisibleOutCallback: {onAfterAnimation: mycarousel_itemVisibleOutCallback},scroll: 1,animation: 1000,initCallback: mycarousel_initCallback});
}