/*
 * jQuery Form Example Plugin 1.4.1
	http://mucur.name/system/jquery_example/
 */
	
(function($) {
  
  $.fn.example = function(text, args) {
    
    var isCallback = $.isFunction(text);
    var options = $.extend({}, args, {example: text});
    
    return this.each(function() {
      var $this = $(this);

      if ($.metadata) {        
        var o = $.extend({}, $.fn.example.defaults, $this.metadata(), options);
      } else {
        var o = $.extend({}, $.fn.example.defaults, options);
      }
      
      $this.attr('placeholder', isCallback ? o.example.call(this) : o.example);
      if (!$.fn.example.boundClassNames[o.className]) {

        $(window).unload(function() {
          $('.' + o.className).val('');
        });
        $('form').submit(function() {
          $(this).find('.' + o.className).val('');
        });
      
        $.fn.example.boundClassNames[o.className] = true;
      }
      if ($.browser.msie && !$this.attr('defaultValue') && (isCallback || $this.val() == o.example))
        $this.val('');

      if ($this.val() == '' && this != document.activeElement) {
        $this.addClass(o.className);

        $this.val(isCallback ? o.example.call(this) : o.example);
      }

      $this.focus(function() {
        
        if ($(this).is('.' + o.className)) {
          $(this).val('');
          $(this).removeClass(o.className);
        }
      });
    
      $this.blur(function() {
        if ($(this).val() == '') {
          $(this).addClass(o.className);

          $(this).val(isCallback ? o.example.call(this) : o.example);
        }
      });
    });
  };
  

  $.fn.example.defaults = {
    className: 'example'
  };
  
  /* All the class names used are stored as keys in the following array. */
  $.fn.example.boundClassNames = [];
  
})(jQuery);

$(function(){
		$('.txtField').example(function() {
  return $(this).attr('title');
});
})
