/**
 *
 * Ex.: <input type="text" class="watermark" value="teste" />
 *
 */
watermark = {

    init: function(){
		
		/*$('input').each(function(){
			$(this).attr('value',$(this).prev('label').html());
			$(this).prev('label').hide();
		});*/
		
        $('*.watermark').focus(function(){
            watermark.focus($(this));
        }).blur(function(){
            watermark.blur($(this));
        }).each(function(){
            $(this).attr('title', $(this).val());
        });
    },

    focus: function(valor){
        val = $(valor).val();
        if($(valor).val() == $(valor).attr('title')){
            $(valor).val('');
            $(valor).attr('alt', val);
        }
    },

    blur: function(valor){
        val = $(valor).attr('alt');
        if($(valor).val() == ''){
            $(valor).val(val);
            $(valor).attr('alt', '');
        }
    }

}
