/**
 * Input Default - jQuery plugin 1.0.0
 * 
 * Copyright (c) 2009 Pavel Virskiy - virskiy-p@mail.ru http://twitter.com/Paaashka
 * 
 * Dual licensed under the MIT and GPL licenses:
 *   http://www.opensource.org/licenses/mit-license.php
 *   http://www.gnu.org/licenses/gpl.html
 * 
 * Revised: 2009-09-10
 * 
 * To enable, simply add "inputDef" class to neccecary <input type="text" /> tags, and set attribute "default" for default value.
 * Example: <input type="text" class="someClassForInput inputDef" default="Default value" />
 *
 * Also you can change default text CSS. Class is named "jqueryInputDefault". One .css is provided with plugin.
 *
 */

jquery_inputDefault = function() {
	this.init = function(){
		var inputs = $("input.inputDef");
		inputs.each(function(){
							 $(this).attr('value',$(this).attr('default')).addClass('jqueryInputDefault');
							 });
		
		inputs.focus(function(){
							  if($(this).attr('value') == $(this).attr('default')){
								 	 $(this).attr('value','').removeClass('jqueryInputDefault');
								  }
							  });
		inputs.blur(function(){
							 if($(this).attr('value') == ''){
								 	$(this).attr('value',$(this).attr('default')).addClass('jqueryInputDefault');
								 }
							 });
	}
};
$(document).ready(function(){
	var jQinputDefault = new jquery_inputDefault();
	jQinputDefault.init();
});
