(function($){$.fn.toggleVal=function(theOptions){theOptions=$.extend({focusClass:"tv-focused",changedClass:"tv-changed",populateFrom:"default",removeLabels:false},theOptions);return this.each(function(){var defText="";switch(theOptions.populateFrom){case"alt":defText=$(this).attr("alt");$(this).val(defText);break
case"label":defText=$("label[for='"+$(this).attr("id")+"']").text();$(this).val(defText);break
default:defText=$(this).val();}
$(this).addClass("toggleval");if(theOptions.removeLabels==true){$("label[for='"+$(this).attr("id")+"']").remove();}
$(this).focus(function(){if($(this).val()==defText){$(this).val("");}
$(this).addClass(theOptions.focusClass).removeClass(theOptions.changedClass);}).blur(function(){if($(this).val()==""){$(this).val(defText);}
$(this).removeClass(theOptions.focusClass);if($(this).val()!=defText){$(this).addClass(theOptions.changedClass);}
else{$(this).removeClass(theOptions.changedClass);}});});};})(jQuery);