﻿/*

 * Name:		SearchProject.js
 * Date:		04/17/2006
 * Author:		Atsushi Shimo
 * Email:		ashimo@worldbank.org

 Functions and properties used by project search UI.

 01/09/2007: (1)added 2007 to the year list, (2)changed display order of the endYearList
 04/04/2008: changed submit()
 06/19/2009: added 2009 to the year list
 06/30/2009: added "Development Policy Lending" to the finance list
*/


var url="http://ddp-ext.worldbank.org/ext/CSIDB/searchProjects";


var NonCountryNameList = new Array();
NonCountryNameList[0] = "Africa Multi-Country";
NonCountryNameList[1] = "Africa Regional";
NonCountryNameList[2] = "East Asia and Pacific Multi-Country";
NonCountryNameList[3] = "East Asia and Pacific Regional";
NonCountryNameList[4] = "Europe and Central Asia  Multi-Country";
NonCountryNameList[5] = "Europe and Central Asia Regional";
NonCountryNameList[6] = "Global";
NonCountryNameList[7] = "Latin America  and Caribbean Multi-Country";
NonCountryNameList[8] = "Latin America  and Caribbean Regional";
NonCountryNameList[9] = "Middle East and North Africa Multi-Country";
NonCountryNameList[10] = "Middle East and North Africa Regional";
NonCountryNameList[11] = "South Asia Multi-Country";
NonCountryNameList[12] = "South Asia Regional";
NonCountryNameList[13] = "Multi-Country";
NonCountryNameList[14] = "Multi-Region";
NonCountryNameList[15] = "Other";


var NonCountryIDList = new Array();
NonCountryIDList[0] = "M-AFR";
NonCountryIDList[1] = "R-AFR";
NonCountryIDList[2] = "M-EAP";
NonCountryIDList[3] = "R-EAP";
NonCountryIDList[4] = "M-ECA";
NonCountryIDList[5] = "R-ECA";
NonCountryIDList[6] = "GLOBAL";
NonCountryIDList[7] = "M-LAC";
NonCountryIDList[8] = "R-LAC";
NonCountryIDList[9] = "M-MENA";
NonCountryIDList[10] = "R-MENA";
NonCountryIDList[11] = "M-SA";
NonCountryIDList[12] = "R-SA";
NonCountryIDList[13] = "M-C";
NonCountryIDList[14] = "M-R";
NonCountryIDList[15] = "OTHER";


var NonCountryRegionList = new Array();
NonCountryRegionList[0] = "AFR";
NonCountryRegionList[1] = "AFR";
NonCountryRegionList[2] = "EAP";
NonCountryRegionList[3] = "EAP";
NonCountryRegionList[4] = "ECA";
NonCountryRegionList[5] = "ECA";
NonCountryRegionList[6] = "OTHR";
NonCountryRegionList[7] = "LAC";
NonCountryRegionList[8] = "LAC";
NonCountryRegionList[9] = "MENA";
NonCountryRegionList[10] = "MENA";
NonCountryRegionList[11] = "SA";
NonCountryRegionList[12] = "SA";
NonCountryRegionList[13] = "OTHR";
NonCountryRegionList[14] = "OTHR";
NonCountryRegionList[15] = "OTHR";


var CountryNameList = new Array();
CountryNameList[0] = "Afghanistan";
CountryNameList[1] = "Albania";
CountryNameList[2] = "Algeria";
CountryNameList[3] = "Angola";
CountryNameList[4] = "Anguilla";
CountryNameList[5] = "Antigua and Barbuda";
CountryNameList[6] = "Argentina";
CountryNameList[7] = "Armenia";
CountryNameList[8] = "Aruba";
CountryNameList[9] = "Azerbaijan";
CountryNameList[10] = "Bahamas";
CountryNameList[11] = "Bahrain";
CountryNameList[12] = "Bangladesh";
CountryNameList[13] = "Barbados";
CountryNameList[14] = "Belarus";
CountryNameList[15] = "Belize";
CountryNameList[16] = "Benin";
CountryNameList[17] = "Bhutan";
CountryNameList[18] = "Bolivia";
CountryNameList[19] = "Bosnia-Herzegovina";
CountryNameList[20] = "Botswana";
CountryNameList[21] = "Brazil";
CountryNameList[22] = "Bulgaria";
CountryNameList[23] = "Burkina Faso";
CountryNameList[24] = "Burundi";
CountryNameList[25] = "Cambodia";
CountryNameList[26] = "Cameroon";
CountryNameList[27] = "Cape Verde";
CountryNameList[28] = "Central African Republic";
CountryNameList[29] = "Chad";
CountryNameList[30] = "Chile";
CountryNameList[31] = "China";
CountryNameList[32] = "Colombia";
CountryNameList[33] = "Comoros";
CountryNameList[34] = "Congo";
CountryNameList[35] = "Congo, DR";
CountryNameList[36] = "Costa Rica";
CountryNameList[37] = "Côte d'Ivoire";
CountryNameList[38] = "Croatia";
CountryNameList[39] = "Cyprus";
CountryNameList[40] = "Czech Republic";
CountryNameList[41] = "Djibouti";
CountryNameList[42] = "Dominica";
CountryNameList[43] = "Dominican Republic";
CountryNameList[44] = "East Timor";
CountryNameList[45] = "Ecuador";
CountryNameList[46] = "Egypt";
CountryNameList[47] = "El Salvador";
CountryNameList[48] = "Equatorial Guinea";
CountryNameList[49] = "Eritrea";
CountryNameList[50] = "Estonia";
CountryNameList[51] = "Ethiopia";
CountryNameList[52] = "Fiji";
CountryNameList[53] = "Gabon";
CountryNameList[54] = "Gambia, The";
CountryNameList[55] = "Georgia";
CountryNameList[56] = "Ghana";
CountryNameList[57] = "Grenada";
CountryNameList[58] = "Guatemala";
CountryNameList[59] = "Guinea";
CountryNameList[60] = "Guinea-Bissau";
CountryNameList[61] = "Guyana";
CountryNameList[62] = "Haiti";
CountryNameList[63] = "Honduras";
CountryNameList[64] = "Hungary";
CountryNameList[65] = "India";
CountryNameList[66] = "Indonesia";
CountryNameList[67] = "Iran";
CountryNameList[68] = "Iraq";
CountryNameList[69] = "Jamaica";
CountryNameList[70] = "Jordan";
CountryNameList[71] = "Kazakhstan";
CountryNameList[72] = "Kenya";
CountryNameList[73] = "Kiribati";
CountryNameList[74] = "Korea, Republic";
CountryNameList[75] = "Kosovo";
CountryNameList[76] = "Kuwait";
CountryNameList[77] = "Kyrgyzstan";
CountryNameList[78] = "Lao People's Democratic Republic";
CountryNameList[79] = "Latvia";
CountryNameList[80] = "Lebanon";
CountryNameList[81] = "Lesotho";
CountryNameList[82] = "Liberia";
CountryNameList[83] = "Libyan Arab Jamahiriya";
CountryNameList[84] = "Lithuania";
CountryNameList[85] = "Macedonia";
CountryNameList[86] = "Madagascar";
CountryNameList[87] = "Malawi";
CountryNameList[88] = "Malaysia";
CountryNameList[89] = "Maldives";
CountryNameList[90] = "Mali";
CountryNameList[91] = "Malta";
CountryNameList[92] = "Marshall Islands";
CountryNameList[93] = "Mauritania";
CountryNameList[94] = "Mauritius";
CountryNameList[95] = "Mexico";
CountryNameList[96] = "Micronesia";
CountryNameList[97] = "Moldova";
CountryNameList[98] = "Mongolia";
CountryNameList[99] = "Morocco";
CountryNameList[100] = "Mozambique";
CountryNameList[101] = "Myanmar";
CountryNameList[102] = "Namibia";
CountryNameList[103] = "Nepal";
CountryNameList[104] = "Nicaragua";
CountryNameList[105] = "Niger";
CountryNameList[106] = "Nigeria";
CountryNameList[107] = "Oman";
CountryNameList[108] = "Pakistan";
CountryNameList[109] = "Panama";
CountryNameList[110] = "Papua New Guinea";
CountryNameList[111] = "Paraguay";
CountryNameList[112] = "Peru";
CountryNameList[113] = "Philippines";
CountryNameList[114] = "Poland";
CountryNameList[115] = "Portugal";
CountryNameList[116] = "Qatar";
CountryNameList[117] = "Romania";
CountryNameList[118] = "Russian Federation";
CountryNameList[119] = "Rwanda";
CountryNameList[120] = "Saint Kitts and Nevis";
CountryNameList[121] = "Saint Lucia";
CountryNameList[122] = "Samoa";
CountryNameList[123] = "Sao Tome and Pr";
CountryNameList[124] = "Senegal";
CountryNameList[125] = "Serbia and Montenegro";
CountryNameList[126] = "Seychelles";
CountryNameList[127] = "Sierra Leone";
CountryNameList[128] = "Slovakia";
CountryNameList[129] = "Slovenia";
CountryNameList[130] = "Solomon Islands";
CountryNameList[131] = "Somalia";
CountryNameList[132] = "South Africa";
CountryNameList[133] = "Sri Lanka";
CountryNameList[134] = "Sudan";
CountryNameList[135] = "Surinam";
CountryNameList[136] = "Swaziland";
CountryNameList[137] = "Syrian Arab Republic";
CountryNameList[138] = "Tajikistan";
CountryNameList[139] = "Tanzania";
CountryNameList[140] = "Thailand";
CountryNameList[141] = "Togo";
CountryNameList[142] = "Tonga";
CountryNameList[143] = "Trinidad and Tobago";
CountryNameList[144] = "Tunisia";
CountryNameList[145] = "Turkey";
CountryNameList[146] = "Turkmenistan";
CountryNameList[147] = "Uganda";
CountryNameList[148] = "Ukraine";
CountryNameList[149] = "United Arab Emirates";
CountryNameList[150] = "Uruguay";
CountryNameList[151] = "Uzbekistan";
CountryNameList[152] = "Vanuatu";
CountryNameList[153] = "Venezuela";
CountryNameList[154] = "Vietnam";
CountryNameList[155] = "West Bank & Gaza";
CountryNameList[156] = "Yemen";
CountryNameList[157] = "Zambia";
CountryNameList[158] = "Zimbabwe";


var CountryIDList = new Array();
CountryIDList[0] = "AFG";
CountryIDList[1] = "ALB";
CountryIDList[2] = "DZA";
CountryIDList[3] = "AGO";
CountryIDList[4] = "AIA";
CountryIDList[5] = "ATG";
CountryIDList[6] = "ARG";
CountryIDList[7] = "ARM";
CountryIDList[8] = "ABW";
CountryIDList[9] = "AZE";
CountryIDList[10] = "BHS";
CountryIDList[11] = "BHR";
CountryIDList[12] = "BGD";
CountryIDList[13] = "BRB";
CountryIDList[14] = "BLR";
CountryIDList[15] = "BLZ";
CountryIDList[16] = "BEN";
CountryIDList[17] = "BTN";
CountryIDList[18] = "BOL";
CountryIDList[19] = "BIH";
CountryIDList[20] = "BWA";
CountryIDList[21] = "BRA";
CountryIDList[22] = "BGR";
CountryIDList[23] = "BFA";
CountryIDList[24] = "BDI";
CountryIDList[25] = "KHM";
CountryIDList[26] = "CMR";
CountryIDList[27] = "CPV";
CountryIDList[28] = "CAF";
CountryIDList[29] = "TCD";
CountryIDList[30] = "CHL";
CountryIDList[31] = "CHN";
CountryIDList[32] = "COL";
CountryIDList[33] = "COM";
CountryIDList[34] = "COG";
CountryIDList[35] = "COD";
CountryIDList[36] = "CRI";
CountryIDList[37] = "CIV";
CountryIDList[38] = "HRV";
CountryIDList[39] = "CYP";
CountryIDList[40] = "CZE";
CountryIDList[41] = "DJI";
CountryIDList[42] = "DMA";
CountryIDList[43] = "DOM";
CountryIDList[44] = "TMP";
CountryIDList[45] = "ECU";
CountryIDList[46] = "EGY";
CountryIDList[47] = "SLV";
CountryIDList[48] = "GNQ";
CountryIDList[49] = "ERI";
CountryIDList[50] = "EST";
CountryIDList[51] = "ETH";
CountryIDList[52] = "FJI";
CountryIDList[53] = "GAB";
CountryIDList[54] = "GMB";
CountryIDList[55] = "GEO";
CountryIDList[56] = "GHA";
CountryIDList[57] = "GRD";
CountryIDList[58] = "GTM";
CountryIDList[59] = "GIN";
CountryIDList[60] = "GNB";
CountryIDList[61] = "GUY";
CountryIDList[62] = "HTI";
CountryIDList[63] = "HND";
CountryIDList[64] = "HUN";
CountryIDList[65] = "IND";
CountryIDList[66] = "IDN";
CountryIDList[67] = "IRN";
CountryIDList[68] = "IRQ";
CountryIDList[69] = "JAM";
CountryIDList[70] = "JOR";
CountryIDList[71] = "KAZ";
CountryIDList[72] = "KEN";
CountryIDList[73] = "KIR";
CountryIDList[74] = "KOR";
CountryIDList[75] = "KOS";
CountryIDList[76] = "KWT";
CountryIDList[77] = "KGZ";
CountryIDList[78] = "LAO";
CountryIDList[79] = "LVA";
CountryIDList[80] = "LBN";
CountryIDList[81] = "LSO";
CountryIDList[82] = "LBR";
CountryIDList[83] = "LBY";
CountryIDList[84] = "LTU";
CountryIDList[85] = "MKD";
CountryIDList[86] = "MDG";
CountryIDList[87] = "MWI";
CountryIDList[88] = "MYS";
CountryIDList[89] = "MDV";
CountryIDList[90] = "MLI";
CountryIDList[91] = "MLT";
CountryIDList[92] = "MHL";
CountryIDList[93] = "MRT";
CountryIDList[94] = "MUS";
CountryIDList[95] = "MEX";
CountryIDList[96] = "FSM";
CountryIDList[97] = "MDA";
CountryIDList[98] = "MNG";
CountryIDList[99] = "MAR";
CountryIDList[100] = "MOZ";
CountryIDList[101] = "MMR";
CountryIDList[102] = "NAM";
CountryIDList[103] = "NPL";
CountryIDList[104] = "NIC";
CountryIDList[105] = "NER";
CountryIDList[106] = "NGA";
CountryIDList[107] = "OMN";
CountryIDList[108] = "PAK";
CountryIDList[109] = "PAN";
CountryIDList[110] = "PNG";
CountryIDList[111] = "PRY";
CountryIDList[112] = "PER";
CountryIDList[113] = "PHL";
CountryIDList[114] = "POL";
CountryIDList[115] = "PRT";
CountryIDList[116] = "QAT";
CountryIDList[117] = "ROM";
CountryIDList[118] = "RUS";
CountryIDList[119] = "RWA";
CountryIDList[120] = "KNA";
CountryIDList[121] = "LCA";
CountryIDList[122] = "WSM";
CountryIDList[123] = "STP";
CountryIDList[124] = "SEN";
CountryIDList[125] = "YUG";
CountryIDList[126] = "SYC";
CountryIDList[127] = "SLE";
CountryIDList[128] = "SVK";
CountryIDList[129] = "SVN";
CountryIDList[130] = "SLB";
CountryIDList[131] = "SOM";
CountryIDList[132] = "ZAF";
CountryIDList[133] = "LKA";
CountryIDList[134] = "SDN";
CountryIDList[135] = "SUR";
CountryIDList[136] = "SWZ";
CountryIDList[137] = "SYR";
CountryIDList[138] = "TJK";
CountryIDList[139] = "TZA";
CountryIDList[140] = "THA";
CountryIDList[141] = "TGO";
CountryIDList[142] = "TON";
CountryIDList[143] = "TTO";
CountryIDList[144] = "TUN";
CountryIDList[145] = "TUR";
CountryIDList[146] = "TKM";
CountryIDList[147] = "UGA";
CountryIDList[148] = "UKR";
CountryIDList[149] = "ARE";
CountryIDList[150] = "URY";
CountryIDList[151] = "UZB";
CountryIDList[152] = "VUT";
CountryIDList[153] = "VEN";
CountryIDList[154] = "VNM";
CountryIDList[155] = "WBG";
CountryIDList[156] = "YEM";
CountryIDList[157] = "ZMB";
CountryIDList[158] = "ZWE";


var CountryRegionList = new Array();
CountryRegionList[0] = "SA";
CountryRegionList[1] = "ECA";
CountryRegionList[2] = "MENA";
CountryRegionList[3] = "AFR";
CountryRegionList[4] = "LAC";
CountryRegionList[5] = "LAC";
CountryRegionList[6] = "LAC";
CountryRegionList[7] = "ECA";
CountryRegionList[8] = "LAC";
CountryRegionList[9] = "ECA";
CountryRegionList[10] = "LAC";
CountryRegionList[11] = "MENA";
CountryRegionList[12] = "SA";
CountryRegionList[13] = "LAC";
CountryRegionList[14] = "ECA";
CountryRegionList[15] = "LAC";
CountryRegionList[16] = "AFR";
CountryRegionList[17] = "SA";
CountryRegionList[18] = "LAC";
CountryRegionList[19] = "ECA";
CountryRegionList[20] = "AFR";
CountryRegionList[21] = "LAC";
CountryRegionList[22] = "ECA";
CountryRegionList[23] = "AFR";
CountryRegionList[24] = "AFR";
CountryRegionList[25] = "EAP";
CountryRegionList[26] = "AFR";
CountryRegionList[27] = "AFR";
CountryRegionList[28] = "AFR";
CountryRegionList[29] = "AFR";
CountryRegionList[30] = "LAC";
CountryRegionList[31] = "EAP";
CountryRegionList[32] = "LAC";
CountryRegionList[33] = "AFR";
CountryRegionList[34] = "AFR";
CountryRegionList[35] = "AFR";
CountryRegionList[36] = "LAC";
CountryRegionList[37] = "AFR";
CountryRegionList[38] = "ECA";
CountryRegionList[39] = "ECA";
CountryRegionList[40] = "ECA";
CountryRegionList[41] = "MENA";
CountryRegionList[42] = "LAC";
CountryRegionList[43] = "LAC";
CountryRegionList[44] = "EAP";
CountryRegionList[45] = "LAC";
CountryRegionList[46] = "MENA";
CountryRegionList[47] = "LAC";
CountryRegionList[48] = "AFR";
CountryRegionList[49] = "AFR";
CountryRegionList[50] = "ECA";
CountryRegionList[51] = "AFR";
CountryRegionList[52] = "EAP";
CountryRegionList[53] = "AFR";
CountryRegionList[54] = "AFR";
CountryRegionList[55] = "ECA";
CountryRegionList[56] = "AFR";
CountryRegionList[57] = "LAC";
CountryRegionList[58] = "LAC";
CountryRegionList[59] = "AFR";
CountryRegionList[60] = "AFR";
CountryRegionList[61] = "LAC";
CountryRegionList[62] = "LAC";
CountryRegionList[63] = "LAC";
CountryRegionList[64] = "ECA";
CountryRegionList[65] = "SA";
CountryRegionList[66] = "EAP";
CountryRegionList[67] = "MENA";
CountryRegionList[68] = "MENA";
CountryRegionList[69] = "LAC";
CountryRegionList[70] = "MENA";
CountryRegionList[71] = "ECA";
CountryRegionList[72] = "AFR";
CountryRegionList[73] = "EAP";
CountryRegionList[74] = "EAP";
CountryRegionList[75] = "ECA";
CountryRegionList[76] = "MENA";
CountryRegionList[77] = "ECA";
CountryRegionList[78] = "EAP";
CountryRegionList[79] = "ECA";
CountryRegionList[80] = "MENA";
CountryRegionList[81] = "AFR";
CountryRegionList[82] = "AFR";
CountryRegionList[83] = "MENA";
CountryRegionList[84] = "ECA";
CountryRegionList[85] = "ECA";
CountryRegionList[86] = "AFR";
CountryRegionList[87] = "AFR";
CountryRegionList[88] = "EAP";
CountryRegionList[89] = "SA";
CountryRegionList[90] = "AFR";
CountryRegionList[91] = "MENA";
CountryRegionList[92] = "EAP";
CountryRegionList[93] = "AFR";
CountryRegionList[94] = "AFR";
CountryRegionList[95] = "LAC";
CountryRegionList[96] = "EAP";
CountryRegionList[97] = "ECA";
CountryRegionList[98] = "EAP";
CountryRegionList[99] = "MENA";
CountryRegionList[100] = "AFR";
CountryRegionList[101] = "EAP";
CountryRegionList[102] = "AFR";
CountryRegionList[103] = "SA";
CountryRegionList[104] = "LAC";
CountryRegionList[105] = "AFR";
CountryRegionList[106] = "AFR";
CountryRegionList[107] = "MENA";
CountryRegionList[108] = "SA";
CountryRegionList[109] = "LAC";
CountryRegionList[110] = "EAP";
CountryRegionList[111] = "LAC";
CountryRegionList[112] = "LAC";
CountryRegionList[113] = "EAP";
CountryRegionList[114] = "ECA";
CountryRegionList[115] = "ECA";
CountryRegionList[116] = "MENA";
CountryRegionList[117] = "ECA";
CountryRegionList[118] = "ECA";
CountryRegionList[119] = "AFR";
CountryRegionList[120] = "LAC";
CountryRegionList[121] = "LAC";
CountryRegionList[122] = "EAP";
CountryRegionList[123] = "AFR";
CountryRegionList[124] = "AFR";
CountryRegionList[125] = "ECA";
CountryRegionList[126] = "AFR";
CountryRegionList[127] = "AFR";
CountryRegionList[128] = "ECA";
CountryRegionList[129] = "ECA";
CountryRegionList[130] = "EAP";
CountryRegionList[131] = "AFR";
CountryRegionList[132] = "AFR";
CountryRegionList[133] = "SA";
CountryRegionList[134] = "AFR";
CountryRegionList[135] = "LAC";
CountryRegionList[136] = "AFR";
CountryRegionList[137] = "MENA";
CountryRegionList[138] = "ECA";
CountryRegionList[139] = "AFR";
CountryRegionList[140] = "EAP";
CountryRegionList[141] = "AFR";
CountryRegionList[142] = "EAP";
CountryRegionList[143] = "LAC";
CountryRegionList[144] = "MENA";
CountryRegionList[145] = "ECA";
CountryRegionList[146] = "ECA";
CountryRegionList[147] = "AFR";
CountryRegionList[148] = "ECA";
CountryRegionList[149] = "MENA";
CountryRegionList[150] = "LAC";
CountryRegionList[151] = "ECA";
CountryRegionList[152] = "EAP";
CountryRegionList[153] = "LAC";
CountryRegionList[154] = "EAP";
CountryRegionList[155] = "MENA";
CountryRegionList[156] = "MENA";
CountryRegionList[157] = "AFR";
CountryRegionList[158] = "AFR";


var yearList = new Array();
yearList[0] = "1993";
yearList[1] = "1994";
yearList[2] = "1995";
yearList[3] = "1996";
yearList[4] = "1997";
yearList[5] = "1998";
yearList[6] = "1999";
yearList[7] = "2000";
yearList[8] = "2001";
yearList[9] = "2002";
yearList[10] = "2003";
yearList[11] = "2004";
yearList[12] = "2005";
yearList[13] = "2006";
yearList[14] = "2007";
yearList[15] = "2008";
yearList[16] = "2009";

var myBrowser;

	function InitLists() {

		CheckBrowser();

		if(myBrowser == "GOOD"){
			InitRegion();
			InitCountry();
			InitFinance();
			InitCategory();
			InitYear();
			InitSubmit();
		}
		else{
			document.write(
				"<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0 Transitional//EN\">" +
				"<html>" +
					"<head>" +
						"<title>Sorry</title>" +
						"<meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\">" +
						"<style>" +
							".label_text {color: #204E84; font-size: 11px; font-style: normal; font-weight: bold; text-decoration: none;}" +
						"</style>" +
					"</head>" +
					"<body>" +
					"<TABLE style=\"WIDTH: 100%; HEIGHT: 100%\" cellSpacing=\"0\" cellPadding=\"0\" border=\"0\" align=\"center\">" +
						"<TR valign=\"top\">" +
							"<TD>" +
								"<div class=\"label_text\">" +
									"<br/><br/>" +
									"Sorry, your browser may not support DHTML used by this site." +
									"<br/>" +
									"Please try with the most up-to-date version of Internet Explorer, Netscape Navigator, or Firefox " +
									"(this site has been tested with Internet Explorer 6.0 and Firefox 1.5)." +
								"</div>" +
							"</TD>" +
						"</TR>" +
					"</TABLE>" +
				"</body>" +
			"</html>");
		}
	}


	function CheckBrowser(){
		var goodBrowser = document.getElementById; // IE5/6, NN6(Firefox1.5 is OK)
		//var IE4 = document.all;            // IE4
		//var NN4 = document.layers;         // NN4

		if (goodBrowser){
			myBrowser="GOOD"; // good browser
		}
		else {
			myBrowser="BAD"; //  bad browser
		}
	}
//#########################################################################################################
	function InitRegion(){
		document.getElementById("td11").innerHTML =
			"<DIV class=\"label_text\">Region</DIV>";

		document.getElementById("td12").innerHTML =
			"<SELECT class=\"listbox_text selectCSIDB\" id=\"regionList\" onchange=\"SetCountryList()\" multiple size=\"5\" name=\"regionList\">" +
				"<option>----------test----------</option>" +
			"</SELECT>";

		SetRegionList();
	}


	function SetRegionList(){
		var regionList = document.searchForm.regionList;
		regionList.options.length = 0;

		regionList.options[regionList.options.length] = new Option("-All-","ALL",false,true);
		regionList.options[regionList.options.length] = new Option("Africa","AFR");
		regionList.options[regionList.options.length] = new Option("East Asia and Pacific","EAP");
		regionList.options[regionList.options.length] = new Option("Europe and Central Asia","ECA");
		regionList.options[regionList.options.length] = new Option("Latin America and Caribbean","LAC");
		regionList.options[regionList.options.length] = new Option("Middle East and North Africa","MENA");
		regionList.options[regionList.options.length] = new Option("South Asia","SA");
		regionList.options[regionList.options.length] = new Option("Other","OTHR");
	}

//#########################################################################################################
	function InitCountry(){
		document.getElementById("td21").innerHTML =
		"<FONT class=\"label_text\">Country</FONT>";

		document.getElementById("td22").innerHTML =
			"<table height=\"100%\" cellSpacing=\"0\" cellPadding=\"0\" border=\"0\">" +
				"<tr>" +
					"<td>" +
						"<SELECT class=\"listbox_text selectCSIDB\" id=\"countryList\" multiple size=\"7\" name=\"countryList\" onchange=\"CheckCountrySelection()\">" +
							"<option>--------------------</option>" +
						"</SELECT>" +
					"</td>" +
					"<td align=\"left\">" +
						"<table height=\"100%\" width=\"100%\" cellSpacing=\"4\" cellPadding=\"4\" border=\"0\">" +
							"<tr>" +
								"<td>" +
									"<div id=\"div_countrySort\">" +
										"<INPUT id=\"cbxSort\" type=\"checkbox\" name=\"cbxSort\" onclick=\"SetSorting(this)\">" +
										"<FONT class=\"radio_text\">Sort by region</FONT>" +
									"</div>" +
								"</td>" +
							"</tr>" +
							"<tr height=\"60%\">" +
								"<td>&#160;&#160;</td>" +
							"</tr>" +
							"<tr>" +
								"<td>" +
									"<div class=\"label_bule_text\" id=\"div_countryCounter\">???</div>" +
								"</td>" +
							"</tr>" +
						"</table>" +
					"</td>" +
				"</tr>" +
			"</table>";

		SetCountryList();
	}


	function SetCountryList() {
		var regionList = document.searchForm.regionList;
		var div_countrySort = document.getElementById("div_countrySort");

		CheckListSelection(regionList);

		if(CountElement(regionList)>1 || regionList.options[0].selected){

			div_countrySort.style.visibility = "visible";
		}
		else
		{
			div_countrySort.style.visibility = "hidden";
		}


		var cbxSort = document.searchForm.cbxSort;
		cbxSort.checked = false;
		SortCountryList(false);
		CheckCountrySelection();
	}


	function SetSorting(cbx){
		var ts = document.getElementById("ts");

		if(cbx.checked){
			SortCountryList(true);
		}
		else{
			SortCountryList(false);
		}
		CheckCountrySelection();
	}


	function SortCountryList(sort){
		var regionList = document.searchForm.regionList;
		var countryList = document.searchForm.countryList;

		countryList.options.length = 0;

		if(sort){

			countryList.options[countryList.options.length] = new Option("-All-","ALL",false,true);

			if (regionList.options[0].selected){
				for(i = 1; i < regionList.options.length; i++){
					var region = regionList.options[i].value;
					var regionName = regionList.options[i].text;

					countryList.options[countryList.options.length] = new Option(regionName,"header");
					countryList.options[countryList.options.length-1].className ="listbox_header";

	//*********************************************************************************************
					for(x = 0; x < NonCountryRegionList.length; x++){
						var countryName = NonCountryNameList[x];
						var countryID = NonCountryIDList[x];

						if (region == NonCountryRegionList[x]){

							countryList.options[countryList.options.length] = new Option(countryName,countryID);
							countryList.options[countryList.options.length-1].className = "listbox_region";

						} //if region
					} //for CountryRegionList
	//*********************************************************************************************

					for(j = 0; j < CountryRegionList.length; j++){
						var countryName = CountryNameList[j];
						var countryID = CountryIDList[j];

						if (region == CountryRegionList[j]){

							countryList.options[countryList.options.length] = new Option(countryName,countryID);

						} //if region
					} //for CountryRegionList
				} //for regionList
			} //if
			else{
				for(i = 1; i < regionList.options.length; i++){

					if (regionList.options[i].selected){

						var region = regionList.options[i].value;
						var regionName = regionList.options[i].text;

						countryList.options[countryList.options.length] = new Option(regionName,"header");
						countryList.options[countryList.options.length-1].className ="listbox_header";

	//*********************************************************************************************
					for(x = 0; x < NonCountryRegionList.length; x++){
						var countryName = NonCountryNameList[x];
						var countryID = NonCountryIDList[x];

						if (region == NonCountryRegionList[x]){

							countryList.options[countryList.options.length] = new Option(countryName,countryID);
							countryList.options[countryList.options.length-1].className = "listbox_region";
						} //if region
					} //for CountryRegionList
	//*********************************************************************************************

						for(j = 0; j < CountryRegionList.length; j++){
							var countryName = CountryNameList[j];
							var countryID = CountryIDList[j];

							if (region == CountryRegionList[j]){

								countryList.options[countryList.options.length] = new Option(countryName,countryID);

							} //if region
						} //for CountryRegionList
					} //if regionList.options[i].selecte
				} //for regionList
			}//else
		} //if boo
		else{
			countryList.options[countryList.options.length] = new Option("-All-","ALL",false,true);

	//*********************************************************************************************
			for(x = 0; x < NonCountryRegionList.length; x++){
				for(z = 0; z < regionList.options.length; z++){

					if (regionList.options[z].selected){
						var region = regionList.options[z].value;
						var countryName = NonCountryNameList[x];
						var countryID = NonCountryIDList[x];

						if (region == NonCountryRegionList[x]){

							countryList.options[countryList.options.length] = new Option(countryName,countryID);
							countryList.options[countryList.options.length-1].className = "listbox_region";
						} //if region
						else if (region=="ALL")	{
							countryList.options[countryList.options.length] = new Option(countryName,countryID);
							countryList.options[countryList.options.length-1].className = "listbox_region";
						}
					} //if regionList
				} //for
			} //for
	//*********************************************************************************************

			for(i = 0; i < CountryRegionList.length; i++){

				for(j = 0; j < regionList.options.length; j++){

					if (regionList.options[j].selected){

						var region = regionList.options[j].value;
						var countryName = CountryNameList[i];
						var countryID = CountryIDList[i];


						if (region == CountryRegionList[i]){

							countryList.options[countryList.options.length] = new Option(countryName,countryID);

						} //if region
						else if (region=="ALL")	{
							countryList.options[countryList.options.length] = new Option(countryName,countryID);
						}
					} //if regionList
				} //for
			} //for
		}
	}


	function CheckCountrySelection() {
		var countryList = document.searchForm.countryList;
		var country;

		if(countryList.options.length != 0){

			if (!countryList.options[0].selected){
				for(i = 1; i < countryList.options.length; i++){
					country = countryList.options[i].value;
					if (country == "header" & countryList.options[i].selected){
						countryList.selectedIndex = i + 1;
					}
				}
			}

			if (countryList.options[0].selected || countryList.options.selectedIndex == -1){
				CheckListSelection(countryList);
				document.getElementById('div_countryCounter').innerHTML = "All countries are selected";
			}
			else {
				if (CountElement(countryList) == 1){
					document.getElementById('div_countryCounter').innerHTML = CountElement(countryList) + " country is selected";
				}
				else if (CountElement(countryList) > 1){
	 				document.getElementById('div_countryCounter').innerHTML = CountElement(countryList) + " countries are selected";
				}
			}
		}
		else{
			//this will not be executed
		}
	}

//#########################################################################################################
	function InitFinance(){
		document.getElementById("td31").innerHTML =
			"<FONT class=\"label_text\">Financial Instrument</FONT>";

		document.getElementById("td32").innerHTML =
			"<SELECT class=\"listbox_text selectCSIDB\" id=\"financeList\" onchange=\"CheckListSelection(this)\" multiple size=\"7\" name=\"financeList\">" +
				"<option>--------------------</option>" +
			"</SELECT>";

		SetFinanceList();
	}

	//if this list is updated => may also need to update CheckListSelection(list)
	function SetFinanceList(){
		var financeList = document.searchForm.financeList;
		financeList.options.length = 0;
		financeList.options[financeList.options.length] = new Option("-All-","ALL",false,true);
		financeList.options[financeList.options.length] = new Option("IBRD/IDA","IBRDIDA");
		financeList.options[financeList.options.length-1].className ="listbox_header";
		financeList.options[financeList.options.length] = new Option("-- STATCAP","STAT");
		financeList.options[financeList.options.length] = new Option("-- System-Wide","IBRS");
		financeList.options[financeList.options.length] = new Option("-- Sector-Specific","IBRD");
		financeList.options[financeList.options.length] = new Option("-- Development Policy Lending","DPL");
		financeList.options[financeList.options.length] = new Option("TFSCB","TFSC");
		financeList.options[financeList.options.length-1].className ="listbox_header";
	}
//#########################################################################################################
	function InitCategory(){
		document.getElementById("td41").innerHTML =
			"<FONT class=\"label_text\">Statistical Category</FONT>";

		document.getElementById("td42").innerHTML =
			"<SELECT class=\"listbox_text selectLong\" id=\"categoryList\" onchange=\"CheckListSelection(this)\" multiple size=\"7\" name=\"categoryList\">" +
				"<option>--------------------</option>" +
			"</SELECT>";

		SetCategoryList();
	}


	function SetCategoryList(){
		var categoryList = document.searchForm.categoryList;
		categoryList.options.length = 0;
		categoryList.options[categoryList.options.length] = new Option("-All-","ALL",false,true);
		categoryList.options[categoryList.options.length] = new Option("Development of plans and strategies (NSDS)","01PLAN");
		categoryList.options[categoryList.options.length] = new Option("Development of plans and strategies (exc. NSDS)","01PLAN2");
		categoryList.options[categoryList.options.length] = new Option("Legal framework","02LEGAL");
		categoryList.options[categoryList.options.length] = new Option("Management and organization","03MGMT");
		categoryList.options[categoryList.options.length] = new Option("Institutional framework","04INST");
		categoryList.options[categoryList.options.length] = new Option("Human resources (incl. Training)","11HR");
		categoryList.options[categoryList.options.length] = new Option("Infrastructure","12INF");
		categoryList.options[categoryList.options.length] = new Option("Statistical methodologies","21SMETH");
		categoryList.options[categoryList.options.length] = new Option("Data processing/management method","22DMETH");
		categoryList.options[categoryList.options.length] = new Option("Design/collection of administrative data","31ADMIN");
		categoryList.options[categoryList.options.length] = new Option("Design/implementation of censuses","32CENSUS");
		categoryList.options[categoryList.options.length] = new Option("Design/implementation of household surveys","33SURVEY");
		categoryList.options[categoryList.options.length] = new Option("Design/implementation of surveys (exc. HH surveys)","34OTHERSV");
		categoryList.options[categoryList.options.length] = new Option("Agricultural data","41AGRI");
		categoryList.options[categoryList.options.length] = new Option("National Accounts","42NA");
		categoryList.options[categoryList.options.length] = new Option("Real sector data (exc. NA, Agri)","43REAL");
		categoryList.options[categoryList.options.length] = new Option("Fiscal sector data","44FISCAL");
		categoryList.options[categoryList.options.length] = new Option("Financial sector data","45FIN");
		categoryList.options[categoryList.options.length] = new Option("External sector data","46EXT");
		categoryList.options[categoryList.options.length] = new Option("Social and demographic data","47SOC");
		categoryList.options[categoryList.options.length] = new Option("Environmental data","48ENV");
		categoryList.options[categoryList.options.length] = new Option("Other data","49OTHERD");
		categoryList.options[categoryList.options.length] = new Option("Data analysis/use","51ANALYSIS");
		categoryList.options[categoryList.options.length] = new Option("Data dissemination","52DISSEM");
		categoryList.options[categoryList.options.length] = new Option("Other","99OTHER");
	}

//#########################################################################################################
	function InitYear(){
		document.getElementById("td51").innerHTML =
			"<FONT class=\"label_text\">Project Year</FONT>";

		document.getElementById("td52").innerHTML =
			"<table cellpadding=\"4\" cellspacing=\"4\" border=\"0\" class=\"projectYear_table\">" +
				"<tr>" +
					"<td>" +
						"<FONT class=\"label_text\">I want to find projects which were</FONT>" +
						"<INPUT id=\"Radio1\" type=\"radio\" CHECKED value=\"1\" name=\"statusGroup\">" +
						"<FONT class=\"radio_text\">Approved</FONT>" +
						"<INPUT id=\"Radio2\" type=\"radio\" value=\"2\" name=\"statusGroup\">" +
						"<FONT class=\"radio_text\">Active</FONT>" +
						"<INPUT id=\"Radio3\" type=\"radio\" value=\"3\" name=\"statusGroup\">" +
						"<FONT class=\"radio_text\">Closed</FONT>" +
					"</td>" +
				"</tr>" +
				"<tr>" +
					"<td align=\"right\">" +
						"<FONT class=\"label_text\">between&nbsp;</FONT>" +
						"<SELECT class=\"listbox_text\" id=\"startYearList\" name=\"startYearList\">" +
							"<option>---</option>" +
						"</SELECT>" +
						"<FONT class=\"label_text\">&nbsp;and&nbsp;</FONT>" +
						"<SELECT class=\"listbox_text\" id=\"endYearList\" name=\"endYearList\">" +
							"<option>---</option>" +
						"</SELECT>" +
						"<FONT class=\"label_text\">&nbsp;in</FONT>" +
						"<INPUT id=\"Radio4\" type=\"radio\" CHECKED value=\"1\" name=\"calendarGroup\">" +
						"<FONT class=\"radio_text\">Calendar year</FONT>" +
						"<INPUT id=\"Radio5\" type=\"radio\" value=\"2\" name=\"calendarGroup\">" +
						"<FONT class=\"radio_text\">Fiscal year</FONT>" +
					"</td>" +
				"</tr>" +
			"</table>";

		SetYearLists();
	}


	function SetYearLists(){
		var startYearList = document.searchForm.startYearList;
		startYearList.options.length = 0;
		var endYearList = document.searchForm.endYearList;
		endYearList.options.length = 0;

		startYearList.options[startYearList.options.length] = new Option("-All-","0",false,true);
		for(i = 0; i < yearList.length; i++){
			var year = yearList[i];
			startYearList.options[startYearList.options.length] = new Option(year,year);
		}

		endYearList.options[endYearList.options.length] = new Option("-All-","0",false,true);
		//for(i = yearList.length-1; i>=0; i--){
		for(i = 0; i < yearList.length; i++){
			var year = yearList[i];
			endYearList.options[endYearList.options.length] = new Option(year,year);
		}

	}


//#########################################################################################################

	function InitSubmit(){
		document.getElementById("td61").innerHTML =
			"<INPUT id=\"from_html\" type=\"text\" name=\"from_html\" size=\"1\" value=\"html\" style=\"VISIBILITY: hidden\">";

		document.getElementById("td62").innerHTML =
			"<INPUT class=\"text\" id=\"btnSubmit\" onclick=\"Submit()\" type=\"button\" value=\"Search\" name=\"btnSubmit\" style=\"VERTICAL-ALIGN: baseline; TEXT-ALIGN: center\" />";
	}


var win = null;

	function Submit(){
		CloseWin();
		win = window.open("about:blank","CSIDB","top=1,left=1,width=700,height=500,resizable=yes,menubar=yes,status=yes,scrollbars=yes,dependent=yes");
		//PleaseWait(win);
		//win.focus();
		//setTimeout("SubmitForm()",1000);
		SubmitForm();
		return false;
	}

	function SubmitForm(){
		document.searchForm.action = url;
		document.searchForm.target = "CSIDB"
		document.searchForm.submit();
	}

	function CloseWin(){
		if (win && !win.closed){
			win.close();
		}
	}

	function PleaseWait(win){
		win.document.write(
			"<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0 Transitional//EN\">" +
			"<html>" +
				"<head>" +
					"<title>Please Wait...</title>" +
					"<meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\">" +
					"<meta http-equiv=\"Pragma\" content=\"no-cache\">" +
					"<meta http-equiv=\"Cache-Control\" content=\"no-cache\">" +
					"<meta http-equiv=\"Expires\" content=\"Sat, 24 Dec 2005 12:00:00 GMT\">" +
					"<style>" +
						".on {background-color:orange; font-size:7px; cursor:wait;}" +
						".off {background-color:gray;  font-size:7px; cursor:wait;}" +
						".wait_normal { color: gray; font-size: 14px; font-style: normal; font-weight: bold; text-decoration: none;}" +
						".wait_orange { color: orange; font-size: 14px; font-style: normal; font-weight: bold; text-decoration: none;}" +
					"</style>" +
					"<script language='JavaScript' type='text/javascript'>" +
						"var myTimer = 0;" +
						"var counter;" +
						"var min = 1;" +
						"var max = 20;" +
						"var isForward;" +
						"function Start(){" +
							"counter = min;" +
							"isForward = true;" +
							"myTimer = setInterval(\"Move()\",100);" +
						"}" +
						"function Stop(){" +
							"clearInterval(myTimer);" +
						"}" +
						"function Move(){" +
							"if(isForward){" +
								"if(counter<=max){" +
									"if(counter==max){" +
										"document.getElementById(\"td_wait\").className = \"wait_orange\";" +
									"}" +
									"else{" +
										"document.getElementById(\"td_wait\").className = \"wait_normal\";" +
									"}" +
									"document.getElementById(counter).className = \"on\";" +
									"counter+=1;" +
								"}" +
								"if(counter>max){" +
									"counter = max;" +
									"isForward = false;" +
								"}" +
							"}" +
							"else{" +
								"if(counter>=min){" +
									"if(counter==min){" +
										"document.getElementById(\"td_wait\").className = \"wait_orange\";" +
									"}" +
									"else{" +
										"document.getElementById(\"td_wait\").className = \"wait_normal\";" +
									"}" +
									"document.getElementById(counter).className = \"off\";" +
									"counter-=1;" +
								"} " +
								"if(counter<min){" +
									"counter = min;" +
									"isForward = true;" +
								"}" +
							"}" +
						"}" +
					"</script>" +
				"</head>" +
				"<body onunload=\"Stop();\">" +
					"<table width=\"100%\" height=\"100%\" align=\"center\" bgcolor=\"#f0f0f0\" cellpadding=\"0\" cellspacing=\"0\" border=\"0\">" +
						"<tr>" +
							"<td valign=\"middle\">" +
								"<table width=\"25%\" align=\"center\" bgcolor=\"#E0E0E0\" cellSpacing=\"8\" cellPadding=\"8\" border=\"0\">" +
									"<tr valign=\"middle\">" +
										"<td>" +
											"<table width=\"100%\" align=\"center\" cellSpacing=\"1\" cellPadding=\"1\" border=\"0\">" +
												"<tr>" +
													"<td colspan=\"21\" id=\"td_wait\" class=\"wait_normal\" align=\"center\" nowrap>Loading, please wait...</td>" +
												"</tr>" +
												"<tr>" +
													"<td id=\"1\" class=\"off\">&#160;&#160;&#160;&#160;&#160;</td>" +
													"<td id=\"2\" class=\"off\">&#160;&#160;&#160;&#160;&#160;</td>" +
													"<td id=\"3\" class=\"off\">&#160;&#160;&#160;&#160;&#160;</td>" +
													"<td id=\"4\" class=\"off\">&#160;&#160;&#160;&#160;&#160;</td>" +
													"<td id=\"5\" class=\"off\">&#160;&#160;&#160;&#160;&#160;</td>" +
													"<td id=\"6\" class=\"off\">&#160;&#160;&#160;&#160;&#160;</td>" +
													"<td id=\"7\" class=\"off\">&#160;&#160;&#160;&#160;&#160;</td>" +
													"<td id=\"8\" class=\"off\">&#160;&#160;&#160;&#160;&#160;</td>" +
													"<td id=\"9\" class=\"off\">&#160;&#160;&#160;&#160;&#160;</td>" +
													"<td id=\"10\" class=\"off\">&#160;&#160;&#160;&#160;&#160;</td>" +
													"<td id=\"11\" class=\"off\">&#160;&#160;&#160;&#160;&#160;</td>" +
													"<td id=\"12\" class=\"off\">&#160;&#160;&#160;&#160;&#160;</td>" +
													"<td id=\"13\" class=\"off\">&#160;&#160;&#160;&#160;&#160;</td>" +
													"<td id=\"14\" class=\"off\">&#160;&#160;&#160;&#160;&#160;</td>" +
													"<td id=\"15\" class=\"off\">&#160;&#160;&#160;&#160;&#160;</td>" +
													"<td id=\"16\" class=\"off\">&#160;&#160;&#160;&#160;&#160;</td>" +
													"<td id=\"17\" class=\"off\">&#160;&#160;&#160;&#160;&#160;</td>" +
													"<td id=\"18\" class=\"off\">&#160;&#160;&#160;&#160;&#160;</td>" +
													"<td id=\"19\" class=\"off\">&#160;&#160;&#160;&#160;&#160;</td>" +
													"<td id=\"20\" class=\"off\">&#160;&#160;&#160;&#160;&#160;</td>" +
												"</tr>" +
											"</table>" +
										"</td>" +
									"</tr>" +
								"</table>" +
							"</td>" +
						"</tr>" +
					"</table>" +
					"<script language='JavaScript' type='text/javascript'>Start();</script>" +
				"</body>" +
			"</html>");
	}


//#########################################################################################################


	function CheckListSelection(list) {

		if (list.options[0].selected){

			for(i = 1; i < list.options.length; i++){
				list.options[i].selected=false;
			}
		}
		else{
			if(list.options.selectedIndex == -1){
				list.options[0].selected=true;
			}
			else{
				//this can be done by loop but keep it simple for now.
				if(list == document.searchForm.financeList){ //
					if(list.options[1].selected){
						list.options[1].selected=false;
						list.options[2].selected=true;
						list.options[3].selected=true;
						list.options[4].selected=true;
						list.options[5].selected=true;
					}
				}
			}
		}
	}


	function CountElement(list) {
		var counter = 0;

		for(i = 0; i < list.options.length; i++)
		{
			if (list.options[i].selected){
				counter += 1
			}
		}
		return counter;
	}

