/*
 * ClearText
 *
 */

(function($) {
	$.fn.extend({
		ClearText: function(oConfig) {
			this.bind("focus", function(e) {
				var _this = $(this);
				
				if (_this.attr("value") == _this.attr("defaultValue")) {
					_this.attr("value", "");
				}
			});
			this.bind("blur", function(e) {
				var _this = $(this);
				
				if (_this.attr("value") == "") {
					var defaultVal = _this.attr("defaultValue");
					_this.attr("value", defaultVal)
				}
			});
		}
	});
        $.fn.extend({
                ClearTextAndSetClass: function(oConfig) {
			this.bind("focus", function(e) {
				var _this = $(this);

				if (_this.attr("value") == _this.attr("defaultValue")) {
					_this.attr("value", "");
                                        _this.removeClass('text_2');
                                        _this.addClass('text');
				}
			});
			this.bind("blur", function(e) {
				var _this = $(this);

				if (_this.attr("value") == "") {
					var defaultVal = _this.attr("defaultValue");
					_this.attr("value", defaultVal)
                                        _this.removeClass('text');
                                        _this.addClass('text_2');
				}
			});
		}
        });
	
	$(document).ready(function() {
		$("input.clear").ClearText();
                $("input.clearAndSetClass").ClearTextAndSetClass();
	});
})(jQuery);