/*
(c) Copyrights 2008

Author David McReynolds
Daylight Studio
dave@thedaylightstudio.com
*/
jQuery.fn.fillin = function(txt) {
	var txt_orig = txt;
	return this.each(function(){
		if (txt_orig == null) txt = $(this).val();
		if ($(this).val() == '') $(this).val(txt);
		
		if ($(this).val() != txt && $(this).val() != ''){
			$(this).removeClass("fillin");
		} else {
			$(this).addClass("fillin");
		}
		
		$(this).bind('focus', {t:txt}, function(e){
			if ($(this).val() == e.data['t']) {
				$(this).val("");
				$(this).removeClass("fillin");
			}
		});
		$(this).bind('blur', {t:txt}, function(e){
			if ($(this).val() == "" || $(this).val() == e.data['t']){
				$(this).val(e.data['t']);
				$(this).addClass("fillin");
			} else {
				$(this).removeClass("fillin");
			}
		});
		$(this).bind('keyup', {t:txt}, function(e){
			if ($(this).val() != e.data['t']) {
				$(this).removeClass("fillin");
			} else {
				$(this).addClass("fillin");
			}
		});
	});
};