/*
	Vladimir "Sky" Slavin
	10.52 CET
	Copyright 2010 Ludopoli
	Licenced under MIT Licence
	Based on Jason Resig's talk at FullFrontal 2009
	and email discussions.
*/
(function () {
    $("label.clear").click(function () {
        $(this).next().trigger('focus');
    }).next()
    .wrap("<div class='clear-input'></div>")
    .focus(function () {
        $(this).prev().hide();
    })
    .blur(function () {
        if (!this.value) $(this).prev().show();
    })
    .each(function () {
        $(this).before($(this).parent().prev());
        if (this.value) $(this).prev().hide();
    });
})();
