/*
  (C) by KSI media sp. z o.o. ( www.ksimedia.pl )  
  Description : SearchWindowLengthPresentation class.
  Author      : MS
  Create date : 2010-08-22
  Comment     :
*/

function classSearchWindowLength_default()
{

  this.updateValue = function ( name )
  {
    if ( ExtComponents.getValue( name ) == '' )
    {
      document.getElementById( 'vis_'+name ).value = ' - dowolna - ' ;
    }
    else
    {
      var val ;
      var tmp ;
      tmp = '' ;
      val = ExtComponents.getValue( name ) ;     
      if ( val == '6;8' ) tmp = '1 tydzień' ;
      if ( val == '13;15' ) tmp = '2 tygodnie' ;
      if ( val == '20;22' ) tmp = '3 tygodnie' ; 
      if ( val == '21' ) tmp = 'powyżej 3 tygodni' ;
      if ( tmp == '' )
      {
        valArr = val.split ( ';' ) ;      
        if ( valArr[0] != undefined )
        {
          if ( valArr[0] != '' )
          {
            tmp = 'od '+ valArr[0] ;
          }
        }
        if ( valArr[1] != undefined )
        {
          if ( valArr[1] != '' )
          {
            tmp = tmp + ' do '+ valArr[1] ;
          }
        }
        tmp = tmp + ' dni' ;
      }
      document.getElementById( 'vis_'+name ).value = tmp ;      
    }
    try
    {
      this.itemsUpdateValues ( name ) ;
    }
    catch(err)
    { 
      // alert ( 'noItems' ) ;
    }
  }
  
  //
  // Akcje z interfejsu okna Items
  //
  
  this.itemsUpdateValues = function ( name )
  {
    ExtComponents.setValue ( 'mb_'+name, ExtComponents.getValue ( name ) ) ;
  }
  
  this.itemsCloseWindow = function ( name )
  {
    EditBox.itemsHideWindow( name ) ;
    ExtComponents.setValue ( name, ExtComponents.getValue ( 'mb_'+name ) );
  }
  
  this.itemsClear = function ( name )
  {
    ExtComponents.setValue ( name, '' ) ;
    this.itemsUpdateValues ( name ) ;
  }

}
SearchWindowLength_default = new classSearchWindowLength_default ;

