﻿/*
 
 * Name:		Main.js
 * Date:		08/14/2006
 * Author:		Atsushi Shimo
 * Email:		ashimo@worldbank.org
 
 Functions and properties used by CSID main page.
 
*/

var url="http://ddp-ext.worldbank.org/ext/CSIDB/getCountryStatInfoXML";

//Updated country list: 10/08/2008
var CountryNameList = new Array();
CountryNameList[0] = "Afghanistan";
CountryNameList[1] = "Albania";
CountryNameList[2] = "Algeria";
CountryNameList[3] = "Angola";
CountryNameList[4] = "Antigua and Barbuda ";
CountryNameList[5] = "Argentina";
CountryNameList[6] = "Armenia";
CountryNameList[7] = "Azerbaijan";
CountryNameList[8] = "Bangladesh";
CountryNameList[9] = "Belarus";
CountryNameList[10] = "Belize";
CountryNameList[11] = "Benin";
CountryNameList[12] = "Bhutan";
CountryNameList[13] = "Bolivia";
CountryNameList[14] = "Bosnia and Herzegovina";
CountryNameList[15] = "Botswana";
CountryNameList[16] = "Brazil";
CountryNameList[17] = "Bulgaria";
CountryNameList[18] = "Burkina Faso";
CountryNameList[19] = "Burundi";
CountryNameList[20] = "Cambodia";
CountryNameList[21] = "Cameroon";
CountryNameList[22] = "Cape Verde";
CountryNameList[23] = "Central African Rep.";
CountryNameList[24] = "Chad";
CountryNameList[25] = "Chile";
CountryNameList[26] = "China";
CountryNameList[27] = "Colombia";
CountryNameList[28] = "Comoros";
CountryNameList[29] = "Congo, Dem. Rep.";
CountryNameList[30] = "Congo, Rep.";
CountryNameList[31] = "Costa Rica";
CountryNameList[32] = "Côte d'Ivoire";
CountryNameList[33] = "Croatia";
CountryNameList[34] = "Djibouti";
CountryNameList[35] = "Dominica";
CountryNameList[36] = "Dominican Rep.";
CountryNameList[37] = "Ecuador";
CountryNameList[38] = "Egypt, Arab Rep.";
CountryNameList[39] = "El Salvador";
CountryNameList[40] = "Equatorial Guinea";
CountryNameList[41] = "Eritrea";
CountryNameList[42] = "Estonia";
CountryNameList[43] = "Ethiopia";
CountryNameList[44] = "Fiji";
CountryNameList[45] = "Gabon";
CountryNameList[46] = "Gambia, The";
CountryNameList[47] = "Georgia";
CountryNameList[48] = "Ghana";
CountryNameList[49] = "Grenada";
CountryNameList[50] = "Guatemala";
CountryNameList[51] = "Guinea";
CountryNameList[52] = "Guinea-Bissau";
CountryNameList[53] = "Guyana";
CountryNameList[54] = "Haiti";
CountryNameList[55] = "Honduras";
CountryNameList[56] = "Hungary";
CountryNameList[57] = "India";
CountryNameList[58] = "Indonesia";
CountryNameList[59] = "Iran, Islamic Rep.";
CountryNameList[60] = "Iraq";
CountryNameList[61] = "Jamaica";
CountryNameList[62] = "Jordan";
CountryNameList[63] = "Kazakhstan";
CountryNameList[64] = "Kenya";
CountryNameList[65] = "Kiribati";
CountryNameList[66] = "Kyrgyz Rep.";
CountryNameList[67] = "Lao PDR";
CountryNameList[68] = "Latvia";
CountryNameList[69] = "Lebanon";
CountryNameList[70] = "Lesotho";
CountryNameList[71] = "Liberia";
CountryNameList[72] = "Libya";
CountryNameList[73] = "Lithuania";
CountryNameList[74] = "Macedonia, FYR";
CountryNameList[75] = "Madagascar";
CountryNameList[76] = "Malawi";
CountryNameList[77] = "Malaysia";
CountryNameList[78] = "Maldives";
CountryNameList[79] = "Mali";
CountryNameList[80] = "Marshall Islands";
CountryNameList[81] = "Mauritania";
CountryNameList[82] = "Mauritius";
CountryNameList[83] = "Mexico";
CountryNameList[84] = "Micronesia, Fed. Sts. of";
CountryNameList[85] = "Moldova";
CountryNameList[86] = "Mongolia";
CountryNameList[87] = "Montenegro";
CountryNameList[88] = "Morocco";
CountryNameList[89] = "Mozambique";
CountryNameList[90] = "Myanmar";
CountryNameList[91] = "Namibia";
CountryNameList[92] = "Nepal";
CountryNameList[93] = "Nicaragua";
CountryNameList[94] = "Niger";
CountryNameList[95] = "Nigeria";
CountryNameList[96] = "Pakistan";
CountryNameList[97] = "Palau ";
CountryNameList[98] = "Panama";
CountryNameList[99] = "Papua New Guinea";
CountryNameList[100] = "Paraguay";
CountryNameList[101] = "Peru";
CountryNameList[102] = "Philippines";
CountryNameList[103] = "Poland";
CountryNameList[104] = "Romania";
CountryNameList[105] = "Russian Federation";
CountryNameList[106] = "Rwanda";
CountryNameList[107] = "Samoa";
CountryNameList[108] = "Sao Tome and Principe";
CountryNameList[109] = "Senegal";
CountryNameList[110] = "Serbia";
CountryNameList[111] = "Seychelles";
CountryNameList[112] = "Sierra Leone";
CountryNameList[113] = "Slovak Rep.";
CountryNameList[114] = "Solomon Islands";
CountryNameList[115] = "Somalia";
CountryNameList[116] = "South Africa";
CountryNameList[117] = "Sri Lanka";
CountryNameList[118] = "St. Kitts and Nevis";
CountryNameList[119] = "St. Lucia";
CountryNameList[120] = "St. Vincent and the Grenadines";
CountryNameList[121] = "Sudan";
CountryNameList[122] = "Suriname";
CountryNameList[123] = "Swaziland";
CountryNameList[124] = "Syrian Arab Rep.";
CountryNameList[125] = "Tajikistan";
CountryNameList[126] = "Tanzania";
CountryNameList[127] = "Thailand";
CountryNameList[128] = "Timor-Leste";
CountryNameList[129] = "Togo";
CountryNameList[130] = "Tonga";
CountryNameList[131] = "Trinidad and Tobago";
CountryNameList[132] = "Tunisia";
CountryNameList[133] = "Turkey";
CountryNameList[134] = "Turkmenistan";
CountryNameList[135] = "Uganda";
CountryNameList[136] = "Ukraine";
CountryNameList[137] = "Uruguay";
CountryNameList[138] = "Uzbekistan";
CountryNameList[139] = "Vanuatu";
CountryNameList[140] = "Venezuela, R.B.";
CountryNameList[141] = "Vietnam";
CountryNameList[142] = "Yemen, Rep.";
CountryNameList[143] = "Zambia";
CountryNameList[144] = "Zimbabwe";


var CountryIDList = new Array();
CountryIDList[0] = "4";
CountryIDList[1] = "8";
CountryIDList[2] = "12";
CountryIDList[3] = "24";
CountryIDList[4] = "28";
CountryIDList[5] = "32";
CountryIDList[6] = "51";
CountryIDList[7] = "31";
CountryIDList[8] = "50";
CountryIDList[9] = "112";
CountryIDList[10] = "84";
CountryIDList[11] = "204";
CountryIDList[12] = "64";
CountryIDList[13] = "68";
CountryIDList[14] = "70";
CountryIDList[15] = "72";
CountryIDList[16] = "76";
CountryIDList[17] = "100";
CountryIDList[18] = "854";
CountryIDList[19] = "108";
CountryIDList[20] = "116";
CountryIDList[21] = "120";
CountryIDList[22] = "132";
CountryIDList[23] = "140";
CountryIDList[24] = "148";
CountryIDList[25] = "152";
CountryIDList[26] = "156";
CountryIDList[27] = "170";
CountryIDList[28] = "174";
CountryIDList[29] = "180";
CountryIDList[30] = "178";
CountryIDList[31] = "188";
CountryIDList[32] = "384";
CountryIDList[33] = "191";
CountryIDList[34] = "262";
CountryIDList[35] = "212";
CountryIDList[36] = "214";
CountryIDList[37] = "218";
CountryIDList[38] = "818";
CountryIDList[39] = "222";
CountryIDList[40] = "226";
CountryIDList[41] = "232";
CountryIDList[42] = "233";
CountryIDList[43] = "231";
CountryIDList[44] = "242";
CountryIDList[45] = "266";
CountryIDList[46] = "270";
CountryIDList[47] = "268";
CountryIDList[48] = "288";
CountryIDList[49] = "308";
CountryIDList[50] = "320";
CountryIDList[51] = "324";
CountryIDList[52] = "624";
CountryIDList[53] = "328";
CountryIDList[54] = "332";
CountryIDList[55] = "340";
CountryIDList[56] = "348";
CountryIDList[57] = "356";
CountryIDList[58] = "360";
CountryIDList[59] = "364";
CountryIDList[60] = "368";
CountryIDList[61] = "388";
CountryIDList[62] = "400";
CountryIDList[63] = "398";
CountryIDList[64] = "404";
CountryIDList[65] = "296";
CountryIDList[66] = "417";
CountryIDList[67] = "418";
CountryIDList[68] = "428";
CountryIDList[69] = "422";
CountryIDList[70] = "426";
CountryIDList[71] = "430";
CountryIDList[72] = "434";
CountryIDList[73] = "440";
CountryIDList[74] = "807";
CountryIDList[75] = "450";
CountryIDList[76] = "454";
CountryIDList[77] = "458";
CountryIDList[78] = "462";
CountryIDList[79] = "466";
CountryIDList[80] = "584";
CountryIDList[81] = "478";
CountryIDList[82] = "480";
CountryIDList[83] = "484";
CountryIDList[84] = "583";
CountryIDList[85] = "498";
CountryIDList[86] = "496";
CountryIDList[87] = "499";
CountryIDList[88] = "504";
CountryIDList[89] = "508";
CountryIDList[90] = "104";
CountryIDList[91] = "516";
CountryIDList[92] = "524";
CountryIDList[93] = "558";
CountryIDList[94] = "562";
CountryIDList[95] = "566";
CountryIDList[96] = "586";
CountryIDList[97] = "585";
CountryIDList[98] = "591";
CountryIDList[99] = "598";
CountryIDList[100] = "600";
CountryIDList[101] = "604";
CountryIDList[102] = "608";
CountryIDList[103] = "616";
CountryIDList[104] = "642";
CountryIDList[105] = "643";
CountryIDList[106] = "646";
CountryIDList[107] = "882";
CountryIDList[108] = "678";
CountryIDList[109] = "686";
CountryIDList[110] = "891";
CountryIDList[111] = "690";
CountryIDList[112] = "694";
CountryIDList[113] = "703";
CountryIDList[114] = "90";
CountryIDList[115] = "706";
CountryIDList[116] = "710";
CountryIDList[117] = "144";
CountryIDList[118] = "659";
CountryIDList[119] = "662";
CountryIDList[120] = "670";
CountryIDList[121] = "736";
CountryIDList[122] = "740";
CountryIDList[123] = "748";
CountryIDList[124] = "760";
CountryIDList[125] = "762";
CountryIDList[126] = "834";
CountryIDList[127] = "764";
CountryIDList[128] = "626";
CountryIDList[129] = "768";
CountryIDList[130] = "776";
CountryIDList[131] = "780";
CountryIDList[132] = "788";
CountryIDList[133] = "792";
CountryIDList[134] = "795";
CountryIDList[135] = "800";
CountryIDList[136] = "804";
CountryIDList[137] = "858";
CountryIDList[138] = "860";
CountryIDList[139] = "548";
CountryIDList[140] = "862";
CountryIDList[141] = "704";
CountryIDList[142] = "887";
CountryIDList[143] = "894";
CountryIDList[144] = "716";


//#########################################################################################################
var myBrowser; 	
	
	function InitContents() {
		CheckBrowser();
		
		if(myBrowser == "GOOD"){
			InitDescription();
			InitCountry();
		}
		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 InitDescription(){
		document.getElementById("description").innerHTML = 
			"<p>" +
				"<font face=\"Arial, Helvetica\">" +
				
					"The Country Statistical Information Database provides " +
					"information on national statistical systems useful for assessing statistical " +
					"capacity and monitoring progress in statistical development in over 140 " +
					"developing countries. The database contains information encompassing various " +
					"aspects of national statistical systems and operations, such as statistical " +
					"law, national statistical strategy, statistical practice, data collection " +
					"activities, national statistical institutions and publications, and World Bank " +
					"statistical projects. It also includes a country-level composite statistical " +
					"capacity indicator based on evaluation of countries against a set of criteria " +
					"consistent with international recommendations. In addition, the database " +
					"provides useful web links to get further information from national and " +
					"international sources. For more information, please " +
					"<a href=\"http://web.worldbank.org/WBSITE/EXTERNAL/DATASTATISTICS/0,,contentMDK:20559596~menuPK:1192714~pagePK:64133150~piPK:64133175~theSitePK:239419,00.html\">click here</a>." + 
					"<br/><br/>If you would like to provide feedback on this database, please email us at: " +
					"<a href=\"mailto:data@worldbank.org\"><font color=\"#004080\">data@worldbank.org</font></a>" +
				"</font>" + 
			"</p>";
	
	}

//#########################################################################################################

	function InitCountry(){
		document.getElementById("td11").innerHTML = 
			"<SELECT id=\"countryList\" size=\"1\" name=\"countryList\">" +
			"</SELECT>" +
			"&nbsp;" +
			"<INPUT id=\"btnSubmit\" onclick=\"Submit()\" type=\"button\" value=\"Go\" name=\"btnSubmit\" style=\"vertical-align: baseline; text-align: center\" />";

		 SetCountryList();
	}
		
	function SetCountryList() {
		var countryName = "";
		var countryID = "";
		var countryList = document.mainForm.countryList;
		
		for(i = 0; i < CountryNameList.length; i++){ 
			countryName = CountryNameList[i];
			countryID = url + "?id=" + CountryIDList[i] + "&format=CSIDB";
			countryList.options[countryList.options.length] = new Option(countryName,countryID);
		}

	}
	
//#########################################################################################################

	
	function Submit(){
		var countryList =  document.mainForm.countryList;
		window.open(countryList[countryList.selectedIndex].value, "_blank","top=1,left=1,width=700,height=500,resizable=yes,menubar=yes,status=yes,scrollbars=yes,dependent=yes");	
		return false;
	}

	