$(function() {
    
    $(".form-label").each(function() {
        var input = $(this).parent().find("#" + $(this).attr("for"));
        var label = $(this);
        
        if (input.val() != "") $(this).hide();
        
        input.bind('hastext', function() {
            label.hide();
        });
        
        input.bind('notext', function() {
            label.show();
        });
    }); 
    
    $("form .label").click(function() {
        $(this).parent().find("[name=" + $(this).attr("for") + "]").focus();
    });
    
    $("#section_content .block:lt(3)").resize(function() {
        var height = $(this).height();
        $("#section_content .block:lt(3)").each(function() {
            if ($(this).height() > height)
                height = $(this).height();
        });
        $("#section_content .block:lt(3)").css('minHeight', height);
    }).trigger('resize');
    
    //$("#section_portfolio_1, #section_portfolio_2, #section_portfolio_3").css('marginTop', $("#section_content").offset().top + $("#section_content").height() + 50);
    
});
