/*
  (C) by KSI media sp. z o.o. ( www.ksimedia.pl )  
  Description : SearchWindowLengthPresentation class.
  Author      : MS
  Create date : 2010-08-22
  Comment     :
*/

function classSearchWindowText_default()
{
  this.focused = Array();
  this.updateValue = function ( name )
  {
    var tmp ;
    var ifNullValue ;
    ifNullValue = ' - wpisz np. nazwę hotelu - ' ;
    tmp = ExtComponents.getValue( name ) ;
    if ( tmp == '' ) 
    {      
      if ( this.focused [ name ] == true )
      {
        document.getElementById( 'vis_'+name ).value = '' ;
      }
      else
      {
        document.getElementById( 'vis_'+name ).value = ifNullValue ;
      }
    }
    
    if ( tmp.substr ( 0, ifNullValue.length ) == ifNullValue )
    {
      tmp = tmp.substr ( ifNullValue.length ) ;
      if ( tmp.length > 0 ) document.getElementById( 'vis_'+name ).value = tmp ;
    }
    else
    {
      if ( tmp.length > 0 ) document.getElementById( 'vis_'+name ).value = tmp ;
    }
    
  }
  
  this.onKeyUp = function ( name )
  {
    ExtComponents.setValue ( name, ExtComponents.getValue ( 'vis_' + name ) ) ;
  }
  
  this.onFocus = function ( name )
  {
    var tmp ;
    this.focused [ name ] = true ;
    tmp = ExtComponents.getValue ( name ) ;
    if ( tmp == '' ) 
    {
      ExtComponents.setValue ( 'vis_'+name,'' ) ;
    }
  }
  
  this.onBlur = function ( name )
  {
    this.focused [ name ] = false ;
    ExtComponents.updateValue ( name ) ;
  }

}
SearchWindowText_default = new classSearchWindowText_default ;

