$(document).ready(function(){
    $(".prod-container").equalHeights();
    
    $(".prod-expand").each(function(i){
    
        var parinte = $(this).parent();
        var inaltimeparinte = parinte.innerHeight();
        parinte.css("height", inaltimeparinte);
        var produse = parinte.find(".produse-cat:first");
        var imagineexpand = $(this).find("img");
        
        var idexpand = $(this).attr("id");
        
        
        
        $(this).click(function(){
            if (produse.css("display") == "none") {
                $(this).css("background-color", "#6DB12C");
                produse.stop().fadeIn("slow");
                parinte.equalHeights();
                var inaltimecategorie = produse.innerHeight() + inaltimeparinte;
                parinte.animate({
                    height: inaltimecategorie
                }, 1000);
                imagineexpand.attr("src", "images/colapseprod.gif");               
            }
            else {
                $(this).css("background-color", "#e3e3e3");
                produse.stop().fadeOut("slow");
                parinte.find(".prod-main").css("min-height", "0em");
                
                parinte.stop().animate({
                    height: inaltimeparinte
                }, 500);
                imagineexpand.attr("src", "images/expandprod.gif");
                var varreturn = inaltimeparinte - 20;
                //parinte.find(".prod-main").css("min-height", varreturn.pxToEm());
            
            };
            
            
            
                    }).hover(function(){
            if (produse.css("display") == "none") {
                $(this).animate({
                    backgroundColor: "#6DB12C"
                }, 250);
                imagineexpand.attr("src", "images/expandprodwhite.gif");
            }
        }, function(){
            if (produse.css("display") == "none") {
                $(this).animate({
                    backgroundColor: "#e3e3e3"
                }, 250);
                imagineexpand.attr("src", "images/expandprod.gif");
            }
        });
        
    })
    ///////////////////////////////////////
    $("a[rel^='prettyPhoto']").prettyPhoto({
        animationSpeed: 'normal', /* fast/slow/normal */
        padding: 40, /* padding for each side of the picture */
        opacity: 0.20, /* Value betwee 0 and 1 */
        showTitle: true, /* true/false */
        allowresize: true, /* true/false */
        counter_separator_label: '/', /* The separator for the gallery counter 1 "of" 2 */
        theme: 'light_rounded', /* light_rounded / dark_rounded / light_square / dark_square */
        callback: function(){
        }
    });
    
    
    
})
