function Dialog()
{ 
  this.open = function( strTitle, strContent, blnCanClose, intAutoClose )
  {
    $( '#loader' ).hide();
    $( '#loader_small' ).hide();
    $( '#window' ).show();

    $( '#window_content' ).html( strContent );
    
    if( blnCanClose == false )
    {
      $( '#window_close' ).hide();
    }
    else
    {
      $( '#window_close' ).show();
    }
    
    if(strTitle == '') {
        $("#window_close").hide(); 
    } else {
        $("#window_close").show();    
        $("#window_title").html( strTitle );
    }    

    if( intAutoClose > 0 )
    {
      setTimeout( this.close, intAutoClose * 1000 );
    }
    
    if(strTitle == 'Uwaga'){
        $("#overlay").css('background', 'none');
    }
    $( '#overlay' ).fadeIn( 'slow' );

    $( '#window' ).css( 'margin-left', '-' + ( $( '#window' ).width() / 2 ) + 'px' );
    $( '#window' ).css( 'margin-top', '-' + ( $( '#window' ).height() / 2 ) + 'px' );
    
    //uniform(); 
  };

  this.close = function()
  {
    $( '#overlay' ).fadeOut( 'fast' );

    $.validationEngine.closePrompt( '.formError', true );
  }

  this.loading = function()
  {
    $.validationEngine.closePrompt( '.formError', true );
    $( '#window' ).hide();
    $( '#loader_small' ).hide();
    $( '#loader' ).show();

    $( '#overlay' ).fadeIn( 'slow' );

    $( '#loader' ).css( 'margin-left', '-' + ( $( '#loader' ).width() / 2 ) + 'px' );
    $( '#loader' ).css( 'margin-top', '-' + ( $( '#loader' ).height() / 2 ) + 'px' );
  }

  this.loading_small = function()
  {
    $.validationEngine.closePrompt( '.formError', true );
    $( '#window' ).hide();
    $( '#loader' ).hide();
    $( '#loader_small' ).show();

    $( '#overlay' ).fadeIn( 'fast' );

    $( '#loader_small' ).css( 'margin-left', '-' + ( $( '#loader_small' ).width() / 2 ) + 'px' );
    $( '#loader_small' ).css( 'margin-top', '-' + ( $( '#loader_small' ).height() / 2 ) + 'px' );
  }

  this.message = function( strContent, strType, autoClose )
  {
    if( strType == 'error' )
    {
      strContent = '<p style="vertical-align: middle; display: inline; width: 300px; font-size: 13px; font-weight: bold; color: #ffffff; line-height: 20px;">' + strContent + '</p><br style="clear: both;">';
    }
    else if( strType == 'accept' )
    {
      strContent = '<p style="vertical-align: middle; display: inline; width: 300px; font-size: 13px; font-weight: bold; color: #FFFFFF; line-height: 20px;">' + strContent + '</p><br style="clear: both;">';
    }
    
    $( '#loader_small' ).hide();

    this.open( 'Komunikat', strContent, true, 3, !autoClose );
  }
}
