/**
 * @author Joseph
 */
/**
 * Overlabel
 */
( function( jQuery ) {
	 
    // plugin definition
    jQuery.fn.overlabel = function( options ) {
 
        // build main options before element iteration
        var opts = jQuery.extend( {}, jQuery.fn.overlabel.defaults, options );
 
        var selection = this.filter( 'label[for]' ).map( function() {
 
            var label = jQuery( this );
            var id = label.attr( 'for' );
            var field = document.getElementById( id );
			
			var tag_name = field.tagName.toLowerCase();
 
            if ( !field || tag_name == 'select') return;
 
            // build element specific options
            var o = jQuery.meta ? jQuery.extend( {}, opts, label.data() ) : opts;
 
            label.addClass( o.label_class );
 
            var hide_label = function() { label.css( o.hide_css ) };
            var show_label = function() { this.value || label.css( o.show_css ) };
 
            jQuery( field )
                 .parent().addClass( o.wrapper_class ).end()
                 .focus( hide_label ).blur( show_label ).each( hide_label ).each( show_label );
 
            return this;
 
        } );
 
        return opts.filter ? selection : selection.end();
    };
	
	    // publicly accessible defaults
    jQuery.fn.overlabel.defaults = {
        label_class:   'overlabel-apply',
        wrapper_class: 'overlabel-wrapper',
        hide_css:      { 'text-indent': '-90000px' },
        show_css:      { 'text-indent': '0px', 'cursor': 'text' },
        filter:        false
    };
 
} )( jQuery );
jQuery(document).ready(function(){
	
	//Searchbox Overlabel
	var options = {
		label_class:   'overlabel-apply',
        wrapper_class: 'overlabel-wrapper',
        hide_css:      { 'text-indent': '90000px' },
        show_css:      { 'text-indent': '0px', 'cursor': 'text' },
        filter:        false
	}
	var labels = jQuery('#searchfield label');
	labels.overlabel(options);
	labels.show();
	labels.css({
		'color' : '#999999'
	});
	
	//Searchbox Overlabel
	var labels = jQuery('.tx_powermail_pi1_fieldwrap_html_text label');
	labels.overlabel();
	labels.show();
	labels.css({
		'color' : '#999999'
	});
});
