/**
 * plugin printLabel()
 * Insere placeholder nos campos de formulário
 * @example $(element).printLabel('Texto aqui');
 */
jQuery.fn.extend({
    printLabel: function( label ) {

        $(this).val(label);
        $(this).focus(function(){if($(this).val() == label) {$(this).val('');}});
        $(this).blur(function(){if($(this).val() == '') {$(this).val(label);}});

        return this;
    }
});

$(document).ready( function(){
    
    base_url = $('base').attr('href');
    
    $('a#sitename').html('<img src="'+ base_url +'/images/libra-empreendimentos.png" alt="Libra empreendimentos" />');
    
    $(".fone").mask("(99) 9999-9999"); 

    $("input[name=info_nome]").printLabel('nome').css({'color':'#999'});
    $("input[name=info_telefone]").printLabel('telefone').css({'color':'#999'});
    $("textarea[name=info_comentario]").printLabel('comentário').css({'color':'#999'});

    $('.zoom').fancybox();
    
    $('.msnchat').click(function(){
        
        window.open('http://settings.messenger.live.com/Conversation/IMMe.aspx?invitee=cedd55b822800e7d@apps.messenger.live.com&mkt=pt-BR', 'Atendimento Online', 'width=500,height=400,menubar=0,scrollbars=0,status=0,titlebar=0,top=100,left=100');
        
        return false;
    });
    
    $('img').error(function(){$(this).hide();});    
    
    $('#translate .hidden').click(function(){
        
        var language_id = $(this).attr('id');        
        
        $('#language_id').val(language_id);        
        
        $('#language').submit();
    });
});
