

$(document).ready(function () {


    //Png fix
    $(".logo,.position,#winelist").pngFix();

    //Header photos
    $('.banners').innerfade({
        speed: 4000,
        timeout: 10000,
        type: 'sequence',
        containerheight: '458px'
    });


    $(".thumbs div.item a, .wine_photo a").lightBox({
        imageLoading: '/css/lightbox/images/lightbox-ico-loading.gif',
        imageBtnClose: '/css/lightbox/images/lightbox-btn-close.gif',
        imageBtnPrev: '/css/lightbox/images/lightbox-btn-prev.gif',
        imageBtnNext: '/css/lightbox/images/lightbox-btn-next.gif'
    });

    

    //Drop Down
    $('ul.sf-menu').supersubs({
        minWidth: 10,   // minimum width of sub-menus in em units 
        maxWidth: 50,   // maximum width of sub-menus in em units 
        extraWidth: 1     // extra width can ensure lines don't sometimes turn over 
        // due to slight rounding differences and font-family 
    }).superfish({
        delay: 50,                            // one second delay on mouseout
        animation: {
            height: 'show',
            width: 'show'
        },
        speed: '500',                          // faster animation speed 
        autoArrows: true,                           // disable generation of arrow mark-up 
        dropShadows: true                            // disable drop shadows
    });

    //Custom drop down combo boxes
    try {
        //oHandler = $(".mydds").msDropDown().data("dd");
        oHandler2 = $("#ddlColor").msDropDown({ mainCSS: 'dd2' }).data("dd2");
        oHandler3 = $("#ddlType").msDropDown({ mainCSS: 'dd2' }).data("dd2");
        oHandler4 = $("#ddlLand").msDropDown({ mainCSS: 'dd2' }).data("dd2");
        oHandler5 = $("#ddlBrand").msDropDown({ mainCSS: 'dd2' }).data("dd2");
    }
    catch (e) { /* alert("Error: " + e.message); */ }


    //News ticker
    $('#news').vTicker({
        speed: 700,
        pause: 6000,
        showItems: 1,
        animation: 'fade',
        mousePause: true,
        height: 162,
        direction: 'up'
    });

    if (!($.browser.msie && $.browser.version.substr(0, 1) < 7)) {

        $("#winelist").CloudCarousel({
            xPos: 350,
            yPos: 25,
            FPS: 20,
            yRadius: 20,
            mouseWheel: 'true',
            bringToFront: 'true',
            buttonLeft: $("#rightBut"),
            buttonRight: $("#leftBut"),
            altBox: $("#alt-text"),
            titleBox: $("#title-text")
        });

    }
    else {
        $("#winelist").css('height', 'auto').css('overflow', 'visible').css('padding', '5px').css('width', '690px');
        $("#winelist a").addClass("wineHover").css('margin-left', '5px');
        $("#winelist a img").width("100px").height("250px");
        $(".left_arrow,.right_arrow").css('visibility', 'hidden');
        $("#winelist a").bind('mouseover', this, function (event) {

            var text = $(event.target).attr('alt');
            // If we have moved over a carousel item, then show the alt and title text.

            if (text !== undefined && text !== null) {
                $("#alt-text").html(($(event.target).attr('alt')));
                $("#title-text").html(($(event.target).attr('title')));
            }
        });

    }

});
