﻿//<![CDATA[
$(function () {
    //    positionFooter();
    //    function positionFooter() {
    //        var padding_top = $(".footer").css("padding-top").replace("px", "");
    //        var page_height = $(document.body).height() - padding_top;
    //        var window_height = $(window).height();
    //        var difference = window_height - page_height;
    //        if (difference < 0) {
    //            difference = 0;
    //        }

    //        $(".footer").css({
    //            padding: difference + "px 0 0 0"
    //        })
    //    }

    //    $(window).resize(positionFooter);

    //Realiza o scrool
    var elem = window.location.hash;
    if (elem) {
        $(elem).slideDown();
    }

    $('.item_click').click(function () {
        var itemClicado = $(this).attr("href");
        $(".item_expand").slideUp();
        $(".oculto").slideUp();
        $(itemClicado).slideDown();
    });


    $('.link_encomendas').click(function () {
        var itemClicado = $(this).parent().parent().find(".titulo").html();
        window.location.href = '/encomendas/' + itemClicado;
    });




    $('.icon_encomendas').mouseenter(function () {
        $(this).find("span").show();
    });
    $('.icon_encomendas').mouseleave(function () {
        $(this).find("span").hide();
    });



    //Realiza o evento de scrool do box
    //    var $scrollingDiv = $("#lateral_produtos");

    $(window).scroll(function () {
        // what the y position of the scroll is
        var y = $(this).scrollTop();
        var top = 200;
        // whether that's below the div
        if (y >= top) {
            // if so, ad the fixed class
            $('#lateral_produtos').addClass('fixed');
            //$('$membership').css("right", right);
        } else {
            // otherwise remove it
            $('#lateral_produtos').removeClass('fixed');
        }
    });


    //    $(window).scroll(function () {

    //        $("#lateral_produtos").addClass('fixed');
    //        
    //        //if ($(window).scrollTop() < 809) {
    //        //    $scrollingDiv.stop().animate({ "marginTop": ($(window).scrollTop()) + "px" }, "slow");
    //        //}
    //    });



});


//jQuery.fn.fadeSliderToggle = function (settings) {
//    settings = jQuery.extend({
//        speed: 900,
//        easing: "swing"
//    }, settings)

//    caller = this
//    if ($(caller).css("display") == "none") {
//        $(caller).animate({
//            opacity: 1,
//            height: 'toggle'
//        }, settings.speed, settings.easing);
//    } else {
//        $(caller).animate({
//            opacity: 0,
//            height: 'toggle'
//        }, settings.speed, settings.easing);
//    }
//};
    
//]]>
