(function($) {
    function toggleLabel() {
        var input = $(this);
        setTimeout(function() {
            var def = input.attr('title');
            if (!input.val() || (input.val() == def)) { 
                input.prev().find('span').css('visibility', '');
                if (def) {
                    var dummy = $('<label></label>').text(def).css('visibility','hidden').appendTo('body');
                    input.prev('span').css('margin-left', dummy.width() + 3 + 'px');
                    dummy.remove();
                }
            } else {
                input.prev().find('span').css('visibility', 'hidden');
            }
        }, 0);
    };

    function resetField() {
        var def = $(this).attr('title');
        if (!$(this).val() || ($(this).val() == def)) {
            $(this).val(def);
            $(this).prev('span').css('visibility', '');
        }
    };

    $('input, textarea').live('keydown', toggleLabel);
    $('input, textarea').live('paste', toggleLabel);
    $('select').live('change', toggleLabel);

    $('input, textarea').live('focusin', function() {
        $(this).prev().find('span').css('opacity',  '0.4');
    });
    $('input, textarea').live('focusout', function() {
        $(this).prev().find('span').css('opacity', '1');
    });
    $('label').live('click', function() {
        $(this).next().focus();
    });

    $(function() {
        $('input, textarea').each(function() {toggleLabel.call(this);});
    });

})(jQuery);

      jQuery.fn.slideFadeToggle = function(speed, easing, callback) { 
                    return this.animate({opacity: 'toggle',height: 'toggle'}, speed, 
                    easing, callback); 
                }; 

(function(){if(!/*@cc_on!@*/0)return;var e = "abbr,article,aside,audio,bb,canvas,datagrid,datalist,details,dialog,eventsource,figure,footer,header,hgroup,mark,menu,meter,nav,output,progress,section,time,video".split(',');for(var i=0;i<e.length;i++){document.createElement(e[i])}})()
