﻿// twitter gadget
$(function() {
    $("._home #twitter #tweets").tweet({
        avatar_size: 0,
        count: 1,
        fetch: 20,
        filter: function(t) { return !/^@\w+/.test(t["tweet_raw_text"]); },
        username: "sheerluxe",
        template: function(info) {
            return (info.text + info.time).replace(/<a\s+/g, "<a target='_blank' ")
                + "<ul class='respond'><li id='retweet'><a target='_blank' href='http://twitter.com/intent/retweet?tweet_id=" + info.item.id_str + "' title='Re-tweet this on Twitter'>Re-tweet</a></li>"
                + "<li id='reply'><a target='_blank' href='http://twitter.com/intent/tweet?in_reply_to=" + info.item.id_str + "' title='Reply to this on Twitter'>Reply</a></li></ul>";
        }
    });
});

// hot products/latest offers/magazine highlights carousels
$(function() {
    var $c = $('.carousel');
    $c.append("<div class='previous carousel-overlay'></div><div class='next carousel-overlay'></div>");    
    
    // latest offers
    $("#latest-offers .carousel").jCarouselLite({
        visible: 1,
        btnNext: "#latest-offers .next",
        btnPrev: "#latest-offers .prev",
        start: 0,
        circular: true
    });

    // hot products
    $("#hot-products .carousel").jCarouselLite({
        visible: 1,
        btnNext: "#hot-products .next",
        btnPrev: "#hot-products .prev",
        start: 0,
        circular: true
    });
    
    // magazine highlights
    $("#magazine-highlights .carousel").jCarouselLite({
        visible: 2,
        btnNext: "#magazine-highlights .next",
        btnPrev: "#magazine-highlights .prev",
        start: 0,
        circular: true
    });
    
    $("a.next").mousedown(function() { return false; });
});

// popular items slideshow
$(document).ready(function() {
    $('.slideshow').cycle({
        fx: 'fade', // choose your transition type, ex: fade, scrollUp, shuffle, etc...
        pager: '#popular .controls'
    });
});

