{* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
Author:       Alexander Vaga
EMail:        primary:   icq2000cc@hobi.ru
              secondary: alexander_vaga@hotmail.com
Web:          http://icq2000cc.hobi.ru
Creation:     May, 2002
Legal issues: Copyright (C) 2002 by Alexander Vaga
              Kyiv, Ukraine

              This software is provided 'as-is', without any express or
              implied warranty.  In no event will the author be held liable
              for any  damages arising from the use of this software.

              Permission is granted to anyone to use this software for any
              purpose, including commercial applications, and to alter it
              and redistribute it freely.
 * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *}

unit util;
interface
type TArrayType = packed record
     Text : string[40];
     Code : word;
    end;
const
Countries : array[0..121] of TArrayType =
(
  (Text:'USA';                Code:1),
  (Text:'Russia';             Code:7),
  (Text:'Egypt';              Code:20),
  (Text:'South Africa';       Code:27),
  (Text:'Greece';             Code:30),
  (Text:'Netherlands';        Code:31),
  (Text:'Belgium';            Code:32),
  (Text:'France';             Code:33),
  (Text:'Monaco';             Code:33),
  (Text:'Spain';              Code:34),
  (Text:'Hungary';            Code:36),
  (Text:'Yugoslavia';         Code:38),
  (Text:'Italy';              Code:39),
  (Text:'San Marino';         Code:39),
  (Text:'Vatican City';       Code:39),
  (Text:'Romania';            Code:40),
  (Text:'Liechtenstein';      Code:41),
  (Text:'Switzerland';        Code:41),
  (Text:'Czech Republic';     Code:42),
  (Text:'Austria';            Code:43),
  (Text:'UK';                 Code:44),
  (Text:'Denmark';            Code:45),
  (Text:'Sweden';             Code:46),
  (Text:'Norway';             Code:47),
  (Text:'Poland';             Code:48),
  (Text:'Germany';            Code:49),
  (Text:'Peru';               Code:51),
  (Text:'Mexico';             Code:52),
  (Text:'Guantanomo Bay';     Code:53),
  (Text:'Argentina';          Code:54),
  (Text:'Brazil';             Code:55),
  (Text:'Chile';              Code:56),
  (Text:'Columbia';           Code:57),
  (Text:'Venezuela';          Code:58),
  (Text:'Malaysia';           Code:60),
  (Text:'Australia';          Code:61),
  (Text:'Indonesia';          Code:62),
  (Text:'Philippines';        Code:63),
  (Text:'New Zealand';        Code:64),
  (Text:'Singapore';          Code:65),
  (Text:'Thailand';           Code:66),
  (Text:'Japan';              Code:81),
  (Text:'South Korea';        Code:82),
  (Text:'Vietnam';            Code:84),
  (Text:'China';              Code:86),
  (Text:'Turkey';             Code:90),
  (Text:'India';              Code:91),
  (Text:'Pakistan';           Code:92),
  (Text:'Sri Lanka';          Code:94),
  (Text:'Iran';               Code:98),
  (Text:'Canada';             Code:107),
  (Text:'Morocco';            Code:212),
  (Text:'Algeria';            Code:213),
  (Text:'Tunisia';            Code:216),
  (Text:'Libya';              Code:218),
  (Text:'Senegal';            Code:221),
  (Text:'Mali';               Code:223),
  (Text:'Ivory Coast';        Code:225),
  (Text:'Liberia';            Code:231),
  (Text:'Ghana';              Code:233),
  (Text:'Nigeria';            Code:234),
  (Text:'Cameroon';           Code:237),
  (Text:'Gabon';              Code:241),
  (Text:'Zaire';              Code:243),
  (Text:'Ethiopia';           Code:251),
  (Text:'Kenya';              Code:254),
  (Text:'Tanzania';           Code:255),
  (Text:'Zimbabwe';           Code:263),
  (Text:'Namibia';            Code:264),
  (Text:'Malawi';             Code:265),
  (Text:'Aruba';              Code:297),
  (Text:'Portugal';           Code:351),
  (Text:'Luxembourg';         Code:352),
  (Text:'Ireland';            Code:353),
  (Text:'Iceland';            Code:354),
  (Text:'Malta';              Code:356),
  (Text:'Cyprus';             Code:357),
  (Text:'Finland';            Code:358),
  (Text:'Bulgaria';           Code:359),
  (Text:'Ukraine';            Code:380),
  (Text:'Belize';             Code:501),
  (Text:'Guatemala';          Code:502),
  (Text:'El Salvador';        Code:503),
  (Text:'Honduras';           Code:504),
  (Text:'Nicaragua';          Code:505),
  (Text:'Costa Rice';         Code:506),
  (Text:'Panama';             Code:507),
  (Text:'Haiti';              Code:509),
  (Text:'Guadeloupe';         Code:590),
  (Text:'Bolivia';            Code:591),
  (Text:'Guyana';             Code:592),
  (Text:'Ecuador';            Code:593),
  (Text:'Paraguay';           Code:595),
  (Text:'French Antilles';    Code:596),
  (Text:'Suriname';           Code:597),
  (Text:'Uruguay';            Code:598),
  (Text:'Netherlands Antilles';Code:599),
  (Text:'Saipan';             Code:670),
  (Text:'Saipan';             Code:670),
  (Text:'Guam';               Code:671),
  (Text:'Papua New Guinea';   Code:675),
  (Text:'Fiji';               Code:679),
  (Text:'American Samoa';     Code:684),
  (Text:'New Caledonia';      Code:687),
  (Text:'French Polynesia';   Code:689),
  (Text:'Hong Kong';          Code:852),
  (Text:'Trinidad and Tobago';Code:868),
  (Text:'Bangladesh';         Code:880),
  (Text:'Taiwan';             Code:886),
  (Text:'Jordan';             Code:962),
  (Text:'Iraq';               Code:964),
  (Text:'Kuwait';             Code:965),
  (Text:'Saudia Arabia';      Code:966),
  (Text:'Yemen';              Code:967),
  (Text:'Oman';               Code:968),
  (Text:'United Arab Emirates';Code:971),
  (Text:'Israel';             Code:972),
  (Text:'Bahrain';            Code:973),
  (Text:'Qatar';              Code:974),
  (Text:'Nepal';              Code:977),
  (Text:'Slovak Republic';    Code:4201),
  (Text:'Not entered';        Code:$FFFF)
);


MetaOccupation : array[0..28] of TArrayType =
(
  (Text:'Not specified';      Code: 0),
  (Text:'Academic';           Code: 1),
  (Text:'Administrative';     Code: 2),
  (Text:'Art/Entertainment';  Code: 3),
  (Text:'College Student';    Code: 4),
  (Text:'Computers';          Code: 5),
  (Text:'Community & Social'; Code: 6),
  (Text:'Education';          Code: 7),
  (Text:'Engineering';        Code: 8),
  (Text:'Financial Services'; Code: 9),
  (Text:'Government';         Code: 10),
  (Text:'High School Student';Code: 11),
  (Text:'Home';               Code: 12),
  (Text:'ICQ - Providing Help';Code: 13),
  (Text:'Law';                Code: 14),
  (Text:'Managerial';         Code: 15),
  (Text:'Manufacturing';      Code: 16),
  (Text:'Medical/Health';     Code: 17),
  (Text:'Military';           Code: 18),
  (Text:'Non-Government Organization';Code: 19),
  (Text:'Professional';       Code: 20),
  (Text:'Retail';             Code: 21),
  (Text:'Retired';            Code: 22),
  (Text:'Science & Research'; Code: 23),
  (Text:'Sports';             Code: 24),
  (Text:'Technical';          Code: 25),
  (Text:'University Student'; Code: 26),
  (Text:'Web Building';       Code: 27),
  (Text:'Other Services';     Code: 99)
);

MetaPastBackgrounds : array[0..7] of TArrayType =
(
  (Text:'Elementary School';      Code: 300),
  (Text:'High School';            Code: 301),
  (Text:'College';                Code: 302),
  (Text:'University';             Code: 303),
  (Text:'Military';               Code: 304),
  (Text:'Past Work Place';        Code: 305),
  (Text:'Past Organization';      Code: 306),
  (Text:'Other';                  Code: 399)
);

MetaAffiliations : array[0..19] of TArrayType =
(
  (Text:'Alumni Org.';                 Code: 200),
  (Text:'Charity Org.';                Code: 201),
  (Text:'Club/Social Org.';            Code: 202),
  (Text:'Community Org.';              Code: 203),
  (Text:'Cultural Org.';               Code: 204),
  (Text:'Fan Clubs';                   Code: 205),
  (Text:'Fraternity/Sorority';         Code: 206),
  (Text:'Hobbyists Org.';              Code: 207),
  (Text:'International Org.';          Code: 208),
  (Text:'Nature and Environment Org.'; Code: 209),
  (Text:'Professional Org.';           Code: 210),
  (Text:'Scientific/Technical Org.';   Code: 211),
  (Text:'Self Improvement Group';      Code: 212),
  (Text:'Spiritual/Religious Org.';    Code: 213),
  (Text:'Sports Org.';                 Code: 214),
  (Text:'Support Org.';                Code: 215),
  (Text:'Trade and Business Org.';     Code: 216),
  (Text:'Union';                       Code: 217),
  (Text:'Voluntary Org.';              Code: 218),
  (Text:'Other';                       Code: 299)
);

MetaLanguages : array[0..67] of TArrayType =
(
  (Text:'Not Entered';                 Code: 0),
  (Text:'Arabic';                      Code: 1),
  (Text:'Bhojpuri';                    Code: 2),
  (Text:'Bulgarian';                   Code: 3),
  (Text:'Burmese';                     Code: 4),
  (Text:'Cantonese';                   Code: 5),
  (Text:'Catalan';                     Code: 6),
  (Text:'Chinese';                     Code: 7),
  (Text:'Croatian';                    Code: 8),
  (Text:'Czech';                       Code: 9),
  (Text:'Danish';                      Code: 10),
  (Text:'Dutch';                       Code: 11),
  (Text:'English';                     Code: 12),
  (Text:'Esperanto';                   Code: 13),
  (Text:'Estonian';                    Code: 14),
  (Text:'Farsi';                       Code: 15),
  (Text:'Finnish';                     Code: 16),
  (Text:'French';                      Code: 17),
  (Text:'Gaelic';                      Code: 18),
  (Text:'German';                      Code: 19),
  (Text:'Greek';                       Code: 20),
  (Text:'Hebrew';                      Code: 21),
  (Text:'Hindi';                       Code: 22),
  (Text:'Hungarian';                   Code: 23),
  (Text:'Icelandic';                   Code: 24),
  (Text:'Indonesian';                  Code: 25),
  (Text:'Italian';                     Code: 26),
  (Text:'Japanese';                    Code: 27),
  (Text:'Khmer';                       Code: 28),
  (Text:'Korean';                      Code: 29),
  (Text:'Lao';                         Code: 30),
  (Text:'Latvian';                     Code: 31),
  (Text:'Lithuanian';                  Code: 32),
  (Text:'Malay';                       Code: 33),
  (Text:'Norwegian';                   Code: 34),
  (Text:'Polish';                      Code: 35),
  (Text:'Portuguese';                  Code: 36),
  (Text:'Romanian';                    Code: 37),
  (Text:'Russian';                     Code: 38),
  (Text:'Serbian';                     Code: 39),
  (Text:'Slovak';                      Code: 40),
  (Text:'Slovenian';                   Code: 41),
  (Text:'Somali';                      Code: 42),
  (Text:'Spanish';                     Code: 43),
  (Text:'Swahili';                     Code: 44),
  (Text:'Swedish';                     Code: 45),
  (Text:'Tagalog';                     Code: 46),
  (Text:'Tatar';                       Code: 47),
  (Text:'Thai';                        Code: 48),
  (Text:'Turkish';                     Code: 49),
  (Text:'Ukrainian';                   Code: 50),
  (Text:'Urdu';                        Code: 51),
  (Text:'Vietnamese';                  Code: 52),
  (Text:'Yiddish';                     Code: 53),
  (Text:'Yoruba';                      Code: 54),
  (Text:'Afrikaans';                   Code: 55),
  (Text:'Bosnian';                     Code: 56),
  (Text:'Persian';                     Code: 57),
  (Text:'Albanian';                    Code: 58),
  (Text:'Armenian';                    Code: 59),
  (Text:'Punjabi';                     Code: 60),
  (Text:'Chamorro';                    Code: 61),
  (Text:'Mongolian';                   Code: 62),
  (Text:'Mandarin';                    Code: 63),
  (Text:'Taiwaness';                   Code: 64),
  (Text:'Macedonian';                  Code: 65),
  (Text:'Sindhi';                      Code: 66),
  (Text:'Welsh';                       Code: 67)
);

MetaMonth : array[0..12] of TArrayType =
(
  (Text:'January';     Code:1 ),
  (Text:'February';    Code:2 ),
  (Text:'March';       Code:3 ),
  (Text:'April';       Code:4 ),
  (Text:'May';         Code:5 ),
  (Text:'June';        Code:6 ),
  (Text:'July';        Code:7 ),
  (Text:'August';      Code:8 ),
  (Text:'September';   Code:9 ),
  (Text:'October';     Code:10),
  (Text:'Novemer';     Code:11),
  (Text:'December';    Code:12),
  (Text:'Not specified'; Code:$0)
);
function GetCountryByCode(Code:word):string;
function GetLanguageByCode(Code:word):string;
function GetMonthByCode(Code:word):string;


implementation

function GetCountryByCode(Code:word):string;
var i : integer;
begin
    Result := 'unknown';
    for i:=0 to 121 do
      if Countries[i].Code = Code then begin
        Result := Countries[i].Text;
        break;
      end;
end;

function GetLanguageByCode(Code:word):string;
var i : integer;
begin
    Result := 'unknown';
    for i:=0 to 67 do
      if MetaLanguages[i].Code = Code then begin
        Result := MetaLanguages[i].Text;
        break;
      end;
end;

function GetMonthByCode(Code:word):string;
var i : integer;
begin
    Result := 'unknown';
    for i:=0 to 11 do
      if MetaMonth[i].Code = Code then begin
        Result := MetaMonth[i].Text;
        break;
      end;
end;

end.