﻿
// perform JavaScript after the document is scriptable.
$(function() {
    // setup ul.tabs to work as tabs for each div directly under div.panes
    $("ul.tabs").tabs("div.panes div.panes_page");

    //Carousel
    var items = $("#product_gallery_images").find('img').size();
    var maxnumberofthumbnails = $('#maxnumberofthumbnails').val();

    //if (items > maxnumberofthumbnails) items = maxnumberofthumbnails;

    $("#product_gallery_images").jCarouselLite({
        btnNext: "#movedown",
        btnPrev: "#moveup",
        visible: items /*number of items or maximum 5*/
    });

    $('.move_link').click(function(event) {
        $('#largeimage a').show();
        $('#largeimage a').attr('href', $(this).attr('href'));
        $('#largeimage img').attr('src', $(this).attr('rev'));

        $('#product_gallery_images').find('.bar').removeClass('bar_selected');
        $(this).parent().find('.bar').addClass('bar_selected');


        event.preventDefault();
    });

    $('#largeimage img').click(function(event) {
        event.preventDefault();
    });

    //Dimensions
    if ($("div.dimensionstext").html())
        $("div.dimensionstext").html($("div.dimensionstext").html()
    .replace("Height:", "<span>Height:</span>")
    .replace("Width:", "<span>Width:</span>")
    .replace("Depth:", "<span>Depth:</span>"));
    $("div.dimensionstext span:contains('Height'),div.dimensionstext span:contains('Width'),div.dimensionstext span:contains('Depth')")
        .css("color", "898989");

    $('.video a').click(function(event) {
        $('#largeimage a').hide();
        event.preventDefault();
    });

    //$('#largeimage a').prettyPhoto();
    $('#largeimage a').fancybox();

    //$(".sidebar .readmore").fancybox();

});
function flashPrice() {
    $('.price').fadeOut().fadeIn();
}
