/*
 * http://github.com/amiel/html5support
 * Amiel Martin
 * 2010-01-26
 *
 * Support certain HTML 5 attributes with javascript, but only if the browser doesn't already support them.
 */

var HTML5Support=function(b){function h(){var a=b(this),c=a.attr(d)+"\u00a0\u00a0\u00a0";a.focus(function(){a.val()==c&&a.val("").removeClass(g)}).blur(function(){if(b.trim(a.val())==""||a.val()==c)a.val(c).addClass(g)}).blur()}function i(){var a=b(this),c=a.attr(d),e=b('<input type="text">').val(c).addClass(g).addClass(a.attr("class")).css("display","none");c=function(){if(b.trim(a.val())==""){e.show();a.hide()}};a.after(e);e.focus(function(){e.hide();a.show().focus()}).blur(c);a.blur(c).blur()}
var d="placeholder",g=d,f={};b.extend(f,{supports_attribute:function(a,c){return a in document.createElement(c||"input")}});b.fn.placeholder=function(){if(f.supports_attribute("placeholder"))return this;return this.each(function(){b(this).attr("type")=="password"?i.apply(this):h.apply(this)})};b.fn.autofocus=function(){if(f.supports_attribute("autofocus"))return this;return this.focus()};b.autofocus=function(){b("[autofocus]").autofocus()};b.placeholder=function(){b("["+d+"]").placeholder()};b.html5support=
function(){b.autofocus();b.placeholder()};return f}(jQuery);
