jQuery(function($) {
    // Your code using failsafe $ alias here...
    $(document).ready(function() {
        $("#tabs").tabs();
    });

    $('#controls a#pause').toggle(
			function() {
			    $('#slides').cycle('pause');
			    $('#controls a#pause').addClass('pauseActive');
			    $('#controls a#pause').html('<img src="/images/play.gif" style="width:11px; height:11px; border-style:none;" alt="Play" />');
			}, function() {
			    $('#slides').cycle('resume');
			    $('#controls a#pause').removeClass('pauseActive');
			    $('#controls a#pause').html('<img src="/images/pause.gif" style="width:11px; height:11px; border-style:none;" alt="Pause" />');
			}
		);


    $('#slides').cycle({
        fx: 'fade',
        slideExpr: '#slide',
        speed: 500,
        timeout: 5000,
        next: '#next',
        prev: '#prev',
        cleartype: 0
    });

    $(".enterZip").live("click", function() {
        $(this).parent().siblings(".shipData").toggle();
        return false;
    });

    $("ul.sf-menu").superfish({
        animation: { height: 'show' },
        speed: 300,
        autoArrows: false,
        dropShadows: false
    }).find("ul").bgIframe();

    $(".itemRow").equalHeights(true);
    $(".modCarousel .items").equalHeights(true);

    $(".itemWrapper ul.swatchList li a").live("mouseover", function() {
        $(this).parents(".swatchList").find("a").removeClass("active");
        $(this).addClass("active");
        var newImg = $(this).find(".swatchAlt").html();
        $(this).parents(".itemWrapper").find(".itemImage").attr({ src: newImg });
    });

    //Banner slide show
    $("#homeSSW").cycle({
        fx: 'fade',
        speed: 300,
        timeout: 5000,
        pager: '.nav'
    });

    $(".truncate").truncate({
        max_length: 400,
        more: "read more",
        less: "read less"
    });

    // dialog windows 
    $(".uiModal").dialog({
        autoOpen: false,
        width: "720px",
        bgiframe: true,
        modal: true,
        resizable: false,
        buttons: {
            Close: function() {
                $(this).dialog('close');
            }
        }
    });

    $(".uiDialog").dialog({
        autoOpen: false,
        width: "720px",
        bgiframe: true,
        modal: false,
        resizable: false,
        buttons: {
            Close: function() {
                $(this).dialog('close');
            }
        }
    });

    $(".pageTools .recent").live("click", function() {
        $(".recentDialog").dialog("open");
        return false;
    });

    $(".productImage .btnEnlarge").live("click", function() {
        $(".enlargeView").dialog("open");
        return false;
    });
    // END dialog windows 

    $(".tabModule .tabsRow > ul").tabs();
    $(".cartSupport .supportTabs > ul").tabs();

    // carousels 
    $(".modCarousel4 .scrollable").scrollable({
        size: 4,
        items: ".items",
        clickable: false
    });


    $(".modCarousel5 .scrollable").scrollable({
        size: 5,
        items: ".items",
        clickable: false
    });

    $(".scrollable").each(function() {
        var mcHeight = $(".itemWrapper:first", this).height();
        $(this).css({ 'height': mcHeight });
    });
    // END carousels 

    $(".swatchList a").cluetip({
        cluetipClass: 'swatch',
        width: '178px',
        positionBy: 'fixed',
        topOffset: '-122px',
        leftOffset: '-115px',
        local: true,
        dropShadow: false,
        showTitle: false
    });
});


$(document).ready(function() {
    //hide the all of the element with class msg_body
    $(".msg_body").hide();
    //toggle the component with class msg_body
    $(".msg_head").click(function() {
        $(this).next(".msg_body").toggle();
    });
});


$(document).ready(function() {
    //hide the all of the element with class msg_body
    $(".msg_body3").hide();
    //toggle the component with class msg_body
    $(".msg_head3").click(function() {
        $(this).next(".msg_body3").toggle(),
    $(".msg_head3").toggleClass("expanded");
    });

});






// IE 6 Png Fix
$(function() { $(document).pngFix(); });

