$(document).ready(function(){
    
    
    $("#search input[type='text']").click(function(){
        $(this).val("");
        $(this).unbind("click");
    });
    
    $('#navigation li').mouseenter(function(){
        if ($(this).find('ul').length > 0){
            $(this).find('ul').first().show();
        }
    });
    
    $('#navigation li').mouseleave(function(){
        if ($(this).find('ul').length > 0){
            $(this).find('ul').first().hide();
        }
    });
    
    $('#social img.hover').mouseenter(function(){
        var nome_img = $(this).attr('src').replace('.png', '_hover.png');
       $(this).attr('src', nome_img);
    });
    
    $('#social img.hover').mouseleave(function(){
        var nome_img = $(this).attr('src').replace('_hover.png', '.png');
       $(this).attr('src', nome_img);
    });
    
    $("#slider_in").jcarousel({
        buttonNextHTML: null,
        buttonPrevHTML: null,
//        btnNext: "#slider_dx",
//        btnPrev: "#slider_sx",
        visible: 6,
        scroll: 6,
        wrap: 'circular',
        auto: 5,
        initCallback: mycarousel_initCallback
    });   
    
    $.each($('.progressbar'), function(index, element){
        var value = $(element).attr("rel");
        
        $(element).progressbar({
            value: parseInt(value)
        });
    });
    
    

    
});

function mycarousel_initCallback(carousel) {

    $('#slider_dx').bind('click', function() {
        carousel.next();
        return false;
    });

    $('#slider_sx').bind('click', function() {
        carousel.prev();
        return false;
    });
};

