/*
* clearingInput: a jQuery plugin
*
* clearingInput is a simple jQuery plugin that provides example/label text
* inside text inputs that automatically clears when the input is focused.
* Common uses are for a hint/example, or as a label when space is limited.
*
* For usage and examples, visit:
* http://github.com/alexrabarts/jquery-clearinginput
*
* Licensed under the MIT:
* http://www.opensource.org/licenses/mit-license.php
*
* Copyright (c) 2008 Stateless Systems (http://statelesssystems.com)
*
* @author   Alex Rabarts (alexrabarts -at- gmail -dawt- com)
* @requires jQuery v1.2 or later
* @version  0.1.2
*/

(function ($) {
$.extend($.fn, {
	clearingInput: function (options) {
		var defaults = {blurClass: 'blur'};

		options = $.extend(defaults, options);

		return this.each(function () {
			var input = $(this).addClass(options.blurClass);
			var form  = input.parents('form:first');
			var label, text;

			text = options.text || textFromLabel() || input.val();

			if (text) {
				input.val(text);

				input.blur(function () {
					if (input.val() === '') {
						input.addClass(options.blurClass).val(text);
					}
				}).focus(function () {
					if (input.val() === text) {
						input.val('');
					}
					input.removeClass(options.blurClass);
				});

				// this has been disabled as it clears the defaults on submit, there is no need for this
				form.submit(function() {
					if (input.hasClass(options.blurClass)) {
						input.val('');
					}
				});

				input.blur();
			}

			function textFromLabel() {
				label = form.find('label[for=' + input.attr('id') + ']');
				// Position label off screen and use it for the input text
				return label ? label.css({position: 'absolute', left: '-9999px'}).text() : '';
			}
		});
	}
});
})(jQuery);



/*! Copyright (c) 2009 Brandon Aaron (http://brandonaaron.net)
 * Dual licensed under the MIT (http://www.opensource.org/licenses/mit-license.php)
 * and GPL (http://www.opensource.org/licenses/gpl-license.php) licenses.
 * Thanks to: http://adomas.org/javascript-mouse-wheel/ for some pointers.
 * Thanks to: Mathias Bank(http://www.mathias-bank.de) for a scope bug fix.
 *
 * Version: 3.0.2
 * 
 * Requires: 1.2.2+
 */

// (function(b){function d(a){var f=[].slice.call(arguments,1),e=0;a=b.event.fix(a||window.event);a.type="mousewheel";if(a.wheelDelta)e=a.wheelDelta/120;if(a.detail)e=-a.detail/3;f.unshift(a,e);return b.event.handle.apply(this,f)}var c=["DOMMouseScroll","mousewheel"];b.event.special.mousewheel={setup:function(){if(this.addEventListener)for(var a=c.length;a;)this.addEventListener(c[--a],d,false);else this.onmousewheel=d},teardown:function(){if(this.removeEventListener)for(var a=c.length;a;)this.removeEventListener(c[--a],
// d,false);else this.onmousewheel=null}};b.fn.extend({mousewheel:function(a){return a?this.bind("mousewheel",a):this.trigger("mousewheel")},unmousewheel:function(a){return this.unbind("mousewheel",a)}})})(jQuery);
