var carousel, hashAnterior;$(document).ready(function () {    $("#slider").jcarousel({        vertical: true,        scroll: 3,        initCallback: initCallback    });    $("#fotos img").hover(function () {                if (!$(this).hasClass("selected"))            $(this).stop(true, true).animate({queue: false, opacity: 1.0});    }, function () {        if (!$(this).hasClass("selected"))            $(this).stop(true, true).animate({queue: false, opacity: 0.8});    })    .click(function () {                if (!$(this).hasClass("selected")) {            var imagem = $(this);                        $("#fotos img").removeClass("selected").stop(true, true).animate({queue: false, opacity: 0.8}, 100);            imagem.addClass("selected").stop(true, true).animate({queue: false, opacity: 0.2}, 150, function () {                $("#detalhes #foto_left").hide();                $("#detalhes #foto_left").html('<img src="' + $(this).attr("src") + '" alt="" class="new" />').fadeIn('slow');                            });        }        return false;    }).eq(0).addClass("selected").css("opacity", 0.2).end().not(":eq(0)").css("opacity", 0.8);});function initCallback(c) {    if (carousel == null) {        carousel = c;        $("#slider .jcarousel-item").hover(function () {            if (!$(this).hasClass("selected"))                $(this).stop(true, true).animate({queue: false, opacity: 0.6});        }, function () {            if (!$(this).hasClass("selected"))                $(this).stop(true, true).animate({queue: false, opacity: 0.3});        })        .click(function () {            window.location.hash = ($(this).index() + 1).toString();            return false;        });    }    $("#slider .jcarousel-item").css("opacity", 0.3);    setInterval(function () {        if (hashAnterior == null) {            if (window.location.hash == "") {                hashAnterior = 1;                $("#slider .jcarousel-item:eq(0)").addClass("selected").stop(true, true).animate({queue: false, opacity: 1.0}, 400, function () {                    carousel.scroll(hashAnterior - 1);                    selectedItemChanged(hashAnterior - 1);                });            } else {                hashAnterior = parseInt(window.location.hash.replace("#", ""));                $("#slider .jcarousel-item").removeClass("selected").stop(true, true).animate({queue: false, opacity: 0.3});                $("#slider .jcarousel-item:eq(" + (hashAnterior - 1) + ")").addClass("selected").stop(true, true).animate({queue: false, opacity: 1.0}, 400, function () {                    carousel.scroll(hashAnterior - 1);                    selectedItemChanged(hashAnterior - 1);                });            }        } else if (hashAnterior == 1 && window.location.hash == "") {            return;        } else if (hashAnterior != parseInt(window.location.hash.replace("#", ""))) {            hashAnterior = parseInt(window.location.hash.replace("#", ""));            $("#slider .jcarousel-item").not(":eq(" + (hashAnterior - 1) + ")").removeClass("selected").stop(true, true).animate({queue: false, opacity: 0.3});            $("#slider .jcarousel-item:eq(" + (hashAnterior - 1) + ")").addClass("selected").stop(true, true).animate({queue: false, opacity: 1.0}, 400, function () {                carousel.scroll(hashAnterior - 1);                selectedItemChanged(hashAnterior - 1);            });        }    }, 100);}function selectedItemChanged(index) {    $("#detalhes li").hide().eq(index).show();}
