
$(document).ready(function() {
 // Ustawiam focus na pole typu text
    $('input[type=text], textarea').each(function() {
        var VALUE = $(this).attr('value');
        $(this).focus(function() {
            if ($(this).attr('value') == VALUE)
            $(this).attr('value', '');
            if($(this).attr('type') == 'password') {
                $(this).attr('type', 'text');
            }
            
        });

        $(this).blur(function() {
            if ($(this).attr('value') == '')
            $(this).attr('value', VALUE);
        });
    });
     setFocus();
});

function setFocus() {
    $('#pass').focus(function() {
       // value = $(this).attr(value);
        $('#pass').replaceWith('<input type="password" name="password" class="reg_input" id="pass" />');
        $('#pass').focus();
        $('#pass').blur(function(){
            if($(this).val() == '') { // Nie uzupełniono pola
                $('#pass').replaceWith('<input type="text" name="password" class="reg_input" id="pass" value="Podaj hasło" />');
                setFocus(); // Ustawiam ponownie focus na pole typu text
            }
        });
    });
}
