﻿/*
* Copyright (c) 2010 Romain Ruetschi <romain.ruetschi@gmail.com>
* 
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
* 
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
* 
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
(function (a) { a.fn.placeHoldize = (function () { function b() { var e = a(this); if ((a.browser.webkit || !e.attr("placeholder")) && !e.is("textarea")) { return; } var d = e.attr("placeholder"); e.val(d); e.removeAttr("placeholder").addClass("placeholdized").addClass("placeholder-visible"); e.focus(function () { var f = a(this); if (f.val() === d) { f.val(""); f.removeClass("placeholder-visible").addClass("placeholder-hidden"); } }); e.blur(function () { var f = a(this); if (f.val() === "") { f.val(d); f.removeClass("placeholder-hidden").addClass("placeholder-visible"); } }); } function c(d) { var e = d.closest("form"); e.submit(function () { var f = a(this); if (f.data("placeHoldize.submitHandlerCalled")) { return; } f.find(".placeholder-visible").val("").data("placeHoldize.submitHandlerCalled", true); }); return true; } return function () { this.each(b); c(this); return this; }; })(); })(jQuery);
