$(function() {
	/* this is not needed anymore
    $('div.product').hover(
        function (){
            $(this).find('.order_link').show();
        },
        function (){
            $(this).find('.order_link').hide();
        }
    );
    */

    $('#offer_carousel').jcarousel({
        scroll: 1,
        visible: 1,
        wrap: "circular",
        buttonNextHTML: '<div><span class="jcarousel-next-text">Next image</span></div>'
    });
    
    
    $("a.prod-detail").fancybox({
		'transitionIn'		: 'none',
		'transitionOut'		: 'none',
		'titlePosition' 	: 'over',
		'titleFormat'       : function(title, currentArray, currentIndex, currentOpts) {
    		var id = currentOpts.orig.attr('product');
		    return '<span id="fancybox-title-over">' + title + '<span class="order_link"><a href="/order/'+ id +'/">more</a></span></span>';
		}
	});
    
    //Submit emial handler
    $('form.email').ajaxForm({ 
        target: '#emailresult',
        beforeSubmit:  function(){
    		$('#emailresult').html('Seding...').show('fast');
    	}
    }); 
    
    //"Fadein effect"
    $('.fadeeffect').hover(
        function(){
            $(this).animate({opacity: 0.5});
        },
        function(){
            $(this).animate({opacity: 1});
        }
    );

});


