//---------------------------------------------------------------------------

#ifndef Unit1H
#define Unit1H
//---------------------------------------------------------------------------
#include <Classes.hpp>
#include <Controls.hpp>
#include <StdCtrls.hpp>
#include <Forms.hpp>
#include "SHDocVw_OCX.h"
#include <ExtCtrls.hpp>
#include <OleCtrls.hpp>
#include <mshtml.h>
#include <DB.hpp>
#include <DBTables.hpp>
#include <vector>
#include <map>
#include "Unit2.h"

using namespace std;
//---------------------------------------------------------------------------
class TForm1 : public TForm
{
__published:	// IDE-managed Components
  TPanel *Panel2;
  TButton *Button2;
  TPanel *Panel1;
  TMemo *Memo1;
  TMemo *Memo2;
  TTimer *Timer1;
  TTable *Table1;
  TTimer *Timer2;
  TTable *Table2;
  TSplitter *Splitter1;
  TCppWebBrowser *CppWebBrowser1;
  void __fastcall FormCreate(TObject *Sender);
  void __fastcall Button2Click(TObject *Sender);
  void __fastcall Timer1Timer(TObject *Sender);
  void __fastcall Timer2Timer(TObject *Sender);
  void __fastcall FormClose(TObject *Sender, TCloseAction &Action);
  void __fastcall CppWebBrowser1NewWindow2(TObject *Sender,
          LPDISPATCH *ppDisp, VARIANT_BOOL *Cancel);
  void __fastcall CppWebBrowser1DocumentComplete(TObject *Sender,
          LPDISPATCH pDisp, Variant *URL);
private:	// User declarations
    TStringList * UrlList;
    map<AnsiString , int > urlMap;
    map<AnsiString , int > nextUrlMap;
    vector<AnsiString> GoneQue;
public:		// User declarations
  __fastcall TForm1(TComponent* Owner);
  AnsiString SeedUrl;
  unsigned int Depth;
  void __fastcall GetHotelList(int idx);
  void __fastcall GetHotelDesc(void);
  void __fastcall DbProcess(void);
  void __fastcall HotelListParaser (LPDISPATCH pDoc);
  bool __fastcall IsNextPage (void)
      {return !GoneQue.empty();}
  void __fastcall GetNextPage ( void );

  typedef struct
    {
      AnsiString Url;
      AnsiString Airport;
//      void HotelUrl(AnsiString AUrl,unsigned int ADepth):Url(AUrl),Depth(ADepth);
    } Hotel_Url;

  vector<Hotel_Url> Hotel_Que;
  TLogFile * LogFile;
  int LineCount;
  bool db_Process;
  AnsiString Current_AirPort;
  int mode;

};
//---------------------------------------------------------------------------
extern PACKAGE TForm1 *Form1;
//---------------------------------------------------------------------------
#endif
