;(function($){var H=$.hint=function(txt,opts){return $(document).hint(txt,opts);},toOpts=function(t,o){if(!o&&typeof t=="object"){o=$.extend(true,{},H,t);}else{o=!o?$.extend({},H):$.extend(true,{},H,o);if(t){o.text=''+t;}}
if(o.keepLabel)o.method='valueSwap';return o;};$.fn.hint=function(txt,opts){H.init.call(this,toOpts(txt,opts));return this;};$.extend(H,{version:"1.5",query:'input:password,input:text:not(._hintPw),textarea',on:'hint',attr:false,text:undefined,method:'labelOver',parentCss:{position:'relative',float:'left'},labelCss:{position:'absolute',top:'4px',left:'5px'},hasValue:function(h){var v=this.val();return(v&&$.trim(v)!='');},start:function(){var i=$(this),h=i.data('hint');if(!h.hasValue.call(i,h)){h.show.call(i,h);}},end:function(){var i=$(this),h=i.data('hint');if(h&&h.hasHint.call(i,h)){h.hide.call(i,h);}},getText:function(h){return h.text||this.attr(h.attr||'title');},getElements:function(h){var inputs=this.is(h.query)?this:this.find(h.query);return(inputs.length==0?this:inputs);},init:function(h){$.extend(h,h[h.method]);h.getElements.call(this,h).each(function(){h.create.call($(this),$.extend({},h));});},create:function(h){if(this.data('hint')){this.data('hint').destroy.call(this);}
h.setup.call(this,h);this.blur(h.start).focus(h.end).data('hint',h);h.start.call(this);},destroy:function(){var h=this.data('hint');h.teardown.call(this,h);this.unbind('blur',h.start).unbind('focus',h.end).data('hint',null);},valueSwap:{setup:function(h){var self=this,text=h.getText.call(self,h);h.kill=function(){h.destroy.call(self);};if(self.is(':password')){h.password=$('<input type="text" value="'+text+'" class="_hintPw">').click(function(){self.show().focus();}).addClass(h.on).insertBefore(self);}else if($.browser.msie&&!self.attr('defaultValue')&&self.val()==text){self.val('');}
$(window).unload(h.kill);$(this[0].form).submit(h.kill);},hide:function(h){if(h.password){h.password.hide();this.show();}else{this.val('').removeClass(h.on);}},show:function(h){if(h.password){this.hide();h.password.show();}else{this.addClass(h.on).val(h.getText.call(this,h));}},hasHint:function(h){if(h.password){return h.password.is(':visible');}
return(this.val()==h.getText.call(this,h))&&this.hasClass(h.on);},teardown:function(h){h.end.call(this);if(h.password){h.password.remove();}
$(window).unbind('unload',h.kill);$(this[0].form).unbind('submit',h.kill);}},labelOver:{setup:function(h){var self=this,n=this.attr('name'),l=$('label[for='+n+']'),p=self.parent();if(l.size()==0){h.newLabel=true;l=$('<label for="'+n+'">'+h.getText.call(this,h)+'</label>');self.before(l);}else if(h.text||h.attr){h.labelText=l.text();l.text(h.getText.call(this,h));}
p=self.wrap('<div></div>').before(l.remove()).parent().css(h.parentCss);h.labelStyle=l.attr('style')||'';h.label=l.addClass(h.on).css(h.labelCss).click(function(){self.focus();});},hide:function(h){h.label.css('textIndent',-10000);},show:function(h){h.label.css('textIndent',0);},hasHint:function(h){return h.label.css('textIndent').charAt(0)=='0';},teardown:function(h){h.label.removeClass(h.on).attr('style',h.labelStyle);if(h.newLabel){h.label.remove();h.label=null;}else if(h.labelText){h.label.text(h.labelText);}
var p=this.parent().after(this);if(h.label){p.before(h.label);}
p.remove();}}});})(jQuery);