/**
 * jQuery.labelify - Display in-textbox hints
 * Stuart Langridge, http://www.kryogenix.org/
 * Released into the public domain
 * Date: 25 June 2008
 * Last update: 08 September 2008
 * @author Stuart Langridge
 * @author Garrett LeSage
 * @version 2.0
 */

/**
 * Defaults to taking the in-field label from the field's title attribute
 * @example $("input").labelify();
 * @param {object|string} [settings] optional parameters to pass
 * @config {string} [text] "title" to use the field's title attribute (default),
 *                         "label" to use its <label> (for="fieldid" must be specified)
 * @config {string} [labeledClass] class applied to the field when it has label text
 *
 * @example $('input').labelify('hasLabel'); // return true if the field has a label
 */
jQuery.fn.labelify=function(b){if(typeof b==='string'&&b==='hasLabel'){return $(this).data('hasLabel')}b=jQuery.extend({text:'title',labeledClass:''},b);if(b.labelledClass){b.labeledClass=b.labelledClass}var c,hideLabel,lookups,lookup,$labelified_elements;lookups={title:function(a){return $(a).attr('title')},label:function(a){return $("label[for="+a.id+"]").text()}};$labelified_elements=$(this);c=function(a){a.value=$(a).data("label");$(a).addClass(b.labeledClass).data('hasLabel',true)};hideLabel=function(a){a.value=a.defaultValue;$(a).removeClass(b.labeledClass).data('hasLabel',false)};return $(this).each(function(){var a=$(this),removeValuesOnExit;if(typeof b.text==='string'){lookup=lookups[b.text]}else{lookup=b.text}if(typeof lookup!=="function"||!lookup(this)){return}a.bind('focus.label',function(){if(this.value===$(this).data("label")){hideLabel(this)}}).bind('blur.label',function(){if(this.value===this.defaultValue){c(this)}}).data('label',lookup(this).replace(/\n/g,''));removeValuesOnExit=function(){$labelified_elements.each(function(){if(this.value===$(this).data("label")){hideLabel(this)}})};a.parents("form").submit(removeValuesOnExit);$(window).unload(removeValuesOnExit);if(this.value!==this.defaultValue){return}c(this)})};

$(document).ready(function(){
	$("#mlistForm input[type=text]").labelify({labeledClass:'labelHighlight'});
});

