$(document).ready(function(){ 
    $("#itemPicture a").fancybox({
    				'overlayShow'	: false,
    				'transitionIn'	: 'elastic',
    				'transitionOut'	: 'elastic'
    });
    if($(".tab_content").length > 0){
        //When page loads...
    	$(".tab_content").hide(); //Hide all content
    	$("ul.tabs li:first").addClass("active").show(); //Activate first tab
    	$(".tab_content:first").show(); //Show first tab content
    
    	//On Click Event
    	$("ul.tabs li").click(function() {
    
    		$("ul.tabs li").removeClass("active"); //Remove any "active" class
    		$(this).addClass("active"); //Add "active" class to selected tab
    		$(".tab_content").hide(); //Hide all tab content
    
    		var activeTab = $(this).find("a").attr("href"); //Find the href attribute value to identify the active tab + content
    		$(activeTab).fadeIn(); //Fade in the active ID content
    		return false;
    	});
    }
    /*
    //Recomended
    $("#recommended").cycle({ 
        fx:    'fade', 
        containerResize: false,
        delay: -1000,
        fit: 1
    });
    */
    
    /* SEARCH INPUT BLUR / FOCUS */
    
    //Search input on focus
    $('#search_input').focus(function(){
        if($(this).val() == "Numele produsului"){
            $(this).attr('value','');
        }
    });
    
    //Search input on blur
    $('#search_input').blur(function(){
        var newValue = $(this).val();
        if($(this).val() == ''){
            $(this).attr('value',"Numele produsului");
        } else {
            $(this).val(newValue);
        }
    });
    //Left height
    var left_h = $("#left"). height();
    var right_h = $("#right"). height();
    var cont_h = $("#content"). height();
    if(left_h < cont_h){
        $("#left").height(cont_h);
    }
    if(left_h < right_h){
        $("#left").height(right_h);
    }
    if(right_h < cont_h){
        $("#right").height(cont_h);
    }
    if(right_h < left_h){
        $("#right").height(left_h);
    }
}); 
