function FocusedDescriptionHider( control, unfocusedText )
{
    //this.textEntered = false;

    this.control = control;
    this.unfocusedText = unfocusedText;
    
    if ( control.attr( "value" ) == unfocusedText )
    {
    	control.attr( "value", "" );
    }

    this.Refresh();
}

FocusedDescriptionHider._CONTROLS_COUNTER = 0;
FocusedDescriptionHider._HIDERS = { };
FocusedDescriptionHider._HIDER_ID_PROPERTY = "__hider_id";

FocusedDescriptionHider.Apply = function ( control, unfocusedText )
{
	unfocusedText = unfocusedText ? unfocusedText : control[ 0 ].value;

    var hider = new FocusedDescriptionHider( control, unfocusedText );

    var onFocus = function()
    {
        hider.Focus();
    };

    var onBlur = function()
    {
        hider.Blur();
    }

    var onChange = function()
    {
        hider.Change();
    }

    control.focus( onFocus );
    control.blur( onBlur );
    control.change( onChange );

    control[ 0 ][ FocusedDescriptionHider._HIDER_ID_PROPERTY ] = FocusedDescriptionHider._GenerateNewId( hider );
}

FocusedDescriptionHider.Refresh = function( control )
{
    var hider = FocusedDescriptionHider._GetHider( control ); 
    if ( !hider )
    {
    	return;
    }

    hider.Refresh();
}

FocusedDescriptionHider.IsTextEntered = function( control )
{
	var hider = FocusedDescriptionHider._GetHider( control );
	if ( !hider )
	{
		return false;
	}
	
	return hider.textEntered;
}

FocusedDescriptionHider._GetHider = function( control )
{
	var idValue = control[ 0 ][ FocusedDescriptionHider._HIDER_ID_PROPERTY ];

    if ( !idValue )
    {
        return null;
    }

    return FocusedDescriptionHider._HIDERS[ idValue ];
}

FocusedDescriptionHider._GenerateNewId = function( hider )
{
    ++FocusedDescriptionHider._CONTROLS_COUNTER;

    var id = FocusedDescriptionHider._CONTROLS_COUNTER;

    FocusedDescriptionHider._HIDERS[ id ] = hider;

    return id;
}

FocusedDescriptionHider.prototype.Focus = function()
{
    if ( this.textEntered )
    {
        return;
    }

    this.ControlValue( "" );
}

FocusedDescriptionHider.prototype.Blur = function()
{
    if ( this.textEntered )
    {
        return;
    }

    this.ControlValue( this.unfocusedText );
}

FocusedDescriptionHider.prototype.Change = function()
{
    this.textEntered = this.ControlValue().length > 0;
    this.control[ 0 ].textEntered = this.textEntered;
}

FocusedDescriptionHider.prototype.ControlValue = function( value )
{
    if ( value || ( typeof( value ) == "string" ) )
    {
        this.control[ 0 ].value = value;
    }

    return this.control[ 0 ].value ? this.control[ 0 ].value : "";
}

FocusedDescriptionHider.prototype.Refresh = function()
{
	this.Change();
    this.Blur();
}