/*
 * overLabel 0.1.7  http://jlix.net/extensions/jquery/overLabel/0.1.7
 * + forRef 0.1.5   http://jlix.net/extensions/jquery/forRef/0.1.5
 *
 * Copyright (c) 2009 Sander Aarts  (jlix.net)
 * Dual licensed under the MIT (http://jlix.net/MIT.txt)
 * and GPL (http://jlix.net/GPL.txt) licenses.
 *
 * Requires jQuery to work  (jquery.com). Tested with version 1.2.6
 *
 * 2008-10-03
 */
(function($){$.fn.extend({overLabel:function(){return this.each(function(){var jThis=$(this);var jRef=jThis.forRef();if(jThis.is("label[for]")){var jFormControl=jRef;var jLabels=jThis;}else{var jFormControl=jThis;var jLabels=jRef;}if(!(jFormControl.length>0&&jLabels.length>0))return true;jLabels.each(function(){$(this).addClass("jsOverLabel");if(jFormControl.val()==="")jFormControl.parent().addClass("jsOverLabelBlur");jFormControl.focus(function(){$(this).parent().removeClass("jsOverLabelBlur");}).blur(function(){var jFormControl=$(this);if(jFormControl.val()==="")jFormControl.parent().addClass("jsOverLabelBlur");}).click(function(){$(this).forRef().each(function(){this.focus();});});});});},forRef:function(){return this.is("label[for]")?$("#"+this[0].htmlFor):$("label[for='"+this[0].id+"']");}});})(jQuery);
