$(document).ready(function(){

	$('#jq_deals h5').toggle(function() {
		$('#jq_deals').animate({left:'65px'},"slow");
		$('#jq_deals').animate({left:"85px"},"fast");
		$(this).text("Shut this caption");
	}, function() {
		$('#jq_deals').animate({left:"390px"},"slow");
		$('#jq_deals').animate({left:"370px"},"fast");
		$(this).text("Find out more");
	});
	
	$("#shoppingcart h3 a").click(function(){
		$("#shoppingcartContent").slideToggle("slow");
	}); 
	
	$("#login_toggle span").click(function(){
		$("#loginboxContent").slideToggle("slow");
	}); 
	
});



var mycarousel_itemList = [
    {url: 'images/brands/brands_cat.gif', title: 'Caterpillar', link: 'index.php?main_page=index&manufacturers_id=10'},
    {url: 'images/brands/brands_dickies.gif', title: 'Dickies', link: 'index.php?main_page=index&manufacturers_id=34'},
    {url: 'images/brands/brands_drmartens.gif', title: 'Dr. Martens', link: 'index.php?main_page=index&manufacturers_id=6'},
    {url: 'images/brands/brands_dunlop.gif', title: 'Dunlop', link: 'index.php?main_page=index&manufacturers_id=8'},
    {url: 'images/brands/brands_groundwork.gif', title: 'Groundwork', link: 'index.php?main_page=index&manufacturers_id=18'},
    {url: 'images/brands/brands_hitec.gif', title: 'HI-TEC', link: 'index.php?main_page=index&manufacturers_id=4'},
    {url: 'images/brands/brands_hunter.gif', title: 'Hunter', link: 'index.php?main_page=index&manufacturers_id=30'},
    {url: 'images/brands/brands_kappa.gif', title: 'Kappa', link: 'index.php?main_page=index&manufacturers_id=28'},
    {url: 'images/brands/brands_stormwells.gif', title: 'Stormwells', link: 'index.php?main_page=index&manufacturers_id=3'}
];

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.link + '" title="' + item.title + '"><img src="' + item.url + '" width="158" height="158" alt="' + item.title + '" border="0" /></a>';
};

jQuery(document).ready(function() {
    jQuery('#mycarousel').jcarousel({
        auto: 6,
        wrap: 'circular',
        itemVisibleInCallback: {onBeforeAnimation: mycarousel_itemVisibleInCallback},
        itemVisibleOutCallback: {onAfterAnimation: mycarousel_itemVisibleOutCallback}
    });
});