function toggle_img(item,type) {
    item.src = 'img/'+item.id+'_'+type+'.gif';
}

function clearIf(obj,thisvalue) {
    if (obj.value == thisvalue) {
        obj.value='';
    }
}

$('document').ready(function() {
    var $userInput = $('#user_input');
    var $passInput = $('#pass_input');
    var $passInputFake = $('#pass_input_fake');

    if (!$userInput.val() && $passInput.get(0)) {
        $userInput.val('username');
        $userInput.addClass('grayed');
        $userInput.focus(function() {
            clearIf(this,'username');
            $userInput.removeClass('grayed');
        });
        $passInputFake.val('password');
        $passInputFake.addClass('grayed');
        $passInput.focus(function() {
            clearIf(this,'password');
            $passInput.removeClass('grayed');
        });

        // shouldn't be needed - but cover all bases
        $passInputFake.focus(function() {
            $passInput.show();
            $passInputFake.hide();
            $passInput.focus();
        });
    }
});

