		// document object
		var XMLdoc=new ActiveXObject("Microsoft.XMLDOM");
		// document element object
		var xmlObj;				
											
		/************ Server Variables *****************/
		
		// contain defaut component(1st & 2nd)        
		var strDefaultComponent="";
		// To set the CL_Generic's Values.
		var genericList="";
		// contain OA List.
		var OAList="";
		// contain All Area's ID & name
		var AreaIDName="";		
		// OAID + LongName + slogan + Notes
		var fullinfo="";
		// Admin
		//var Admin='<%=admin %>';
		// OAListHTML
		var OAlisthtml="";
		// Dropdownlist
		var ddlOAList="";
		
		var specialGenericKeyList="";
		var specialGenericKeyArr = [];
		

								
		function loadXML(filename)
		{				
			specialGenericKeyList = "def_slogan|pg_title|map_caption|oa_list_caption|pg_title_bc|bc_select_oa|export_epi_title_pdf|export_country_statement1";
			specialGenericKeyList += "|export_country_statement2|oa2_g1_estimated_hiv_prevalence_15-49~percent~low_estimate|oa2_g1_people_living_with_hiv~number~low_estimate";
			specialGenericKeyList += "|oa2_g1_hiv_incidence_15-49~rate~low_estimate|oa2_g1_estimated_new_hiv_infections_all_ages~number~low_estimate";
			specialGenericKeyList += "|oa2_g1_annual_number_aids_deaths~number~low_estimate|oa2_g1_estimated_art_coverage_cd4_200~percent~low_estimate";
			specialGenericKeyList += "|oa2_g1_estimated_art_coverage_cd4_350~percent~low_estimate|oa2_g1_estimated_pwlhiv_received_arv_for_pmtct~percent~low_estimate";
			specialGenericKeyList += "|hiv_spending_total~us$~main|hiv_spending_public_international~us$~main|hiv_spending_public_international~us$~international";
			specialGenericKeyList += "|hiv_spending_international_funding_sources~us$~main|hiv_spending_international_funding_sources~us$~bilateral";
			specialGenericKeyList += "|hiv_spending_international_funding_sources~us$~multilateral|hiv_spending_international_funding_sources~us$~global";
			specialGenericKeyList += "|hiv_spending_international_funding_sources~us$~other|hiv_spending_prog_area~us$~main|hiv_spending_prog_area~us$~children";
			specialGenericKeyList += "|hiv_spending_prog_area~us$~management|hiv_spending_prog_area~us$~other|export_cfs_title_pdf|export_footnotes";
			specialGenericKeyList += "|export_generating_pdf|export_download_title|export_download_options|export_download_opt1_selections|export_download_opt2_full_cfs";
			specialGenericKeyList += "|export_download_opt3_epi|unaids_priority_title";
			specialGenericKeyArr = specialGenericKeyList.split( "|" );		
			

			if(navigator.appName=="Microsoft Internet Explorer")
			{			
				this.XMLdoc.async="false";
				this.XMLdoc.onreadystatechange=this.verify;
				this.XMLdoc.load(filename);			
			}
			else
			{					
				var xmlhttp = new window.XMLHttpRequest();
				xmlhttp.open("GET",filename,false);
				xmlhttp.send(null);
				this.XMLdoc = xmlhttp.responseXML.documentElement;
				verify();
			}
		}
		
		function verify()
		{
			if(navigator.appName=="Microsoft Internet Explorer")
			{
				// 0 Object is not initialized
				// 1 Loading object is loading data
				// 2 Loaded object has loaded data
				// 3 Data from object can be worked with
				// 4 Object completely initialized
				if (this.XMLdoc.readyState == 4)
				{
					this.xmlObj=this.XMLdoc.documentElement;
					// Read the data from XML file
					this.readXML();					
					this.OAlistTable();
					this.createDropdown();
					setGenericValues();
					if(this.pageName=="factsheet")
					{
						displayOAList('divOAList');	
						startloading(false);
					}
					else(this.pageName=="CompareCountry")
					{
						displayOAList('divddl');					
						setTimeout("loadCharts('"+this.Flashfilepath+"/bubbleview.swf');",2000);
					}
				}
				else
				{
				   return false;
				}
			}
			else
			{				
				this.readXMLforChrome_FF();				
				this.OAlistTable();
				this.createDropdown();
				this.setGenericValues();
				if(this.pageName=="factsheet")
				{
					this.displayOAList('divOAList');					
					this.startloading(false);
				}
				else(this.pageName=="CompareCountry")
				{
					this.displayOAList('divddl');					
					setTimeout("loadCharts('"+this.Flashfilepath+"/bubbleview.swf');",2000);
				}
			}
		}
				
		// Read OA_Metadata file to get the all required information
		function readXML()
		{						
			var childlen= this.xmlObj.childNodes.length;	
			for(var i=0;i<childlen;i++)
			{
				var childNode=this.xmlObj.childNodes(i);				
				var len=childNode.childNodes.length;	
				for(var l=0;l<len;l++)
				{
					var OAObj=childNode.childNodes(l);						
					if(OAObj.getAttribute("id").toLowerCase()=="cl_outcomeareas")
					{	
						// get CL_ Outcome areas from OA_Metadata
						if(OAObj.childNodes(0).text.toLowerCase()=="outcome areas")
						{																	
							var Obj=OAObj.childNodes.length;	
							for(var c=0;c<Obj;c++)
							{
								var sOAid="";
								var slongname="";
								var sslogan="";
								var snotes="";
								// OAid
								sOAid =OAObj.childNodes(c+1).getAttribute('value');								
								var details=OAObj.childNodes(c+1).childNodes(1);
								var detailsLen=details.childNodes.length;
								for(var j=0;j<detailsLen;j++)								
								{				
									// Long Name
									if(details.childNodes(j).childNodes(0).text.toLowerCase()=="longname")
									{										
										slongname=details.childNodes(j).childNodes(1).text;
									}
									// Slogan
									else if(details.childNodes(j).childNodes(0).text.toLowerCase()=="slogan")
									{										
										sslogan=details.childNodes(j).childNodes(1).text;										
									}
									// Notes
									else if(details.childNodes(j).childNodes(0).text.toLowerCase()=="notes")
									{									
										snotes=details.childNodes(j).childNodes(1).text;
									}
								}
								if(sOAid=="OA1")
								{
									this.strDefaultComponent+=sOAid+"{}"+slongname+"{}"+sslogan+"{}"+snotes+"|";
								}
								this.OAList +=sOAid+"{}"+slongname+"|";
								this.fullinfo += sOAid+"{}"+slongname+"{}"+sslogan+"{}"+snotes+"|";
								if(sOAid=="OA13")
								{
									break;							
								}
							}
							
							//document.write(this.strOAList);							
						}
					}
					// get CL_ Generic from OA_Metadata
					else if(OAObj.getAttribute("id").toLowerCase()=="cl_generic")
					{							
						var genericObjLen=OAObj.childNodes.length;
						for(var m=1;m<genericObjLen;m++)
						{
							var genericdetail=OAObj.childNodes(m);
								var Generic_Key=genericdetail.getAttribute("value").toLowerCase();
								
								
								if($.inArray(Generic_Key, specialGenericKeyArr)>0)  
								{
									this.genericList += genericdetail.getAttribute("value")+"{}"+genericdetail.childNodes(0).text+"|";
								}
						}						
					}
					// get CL_ Area from OA_Metadata
					else if(OAObj.getAttribute("id").toLowerCase()=="cl_area")
					{						
						var areaObjLen=OAObj.childNodes.length;
						for(var k=1;k<areaObjLen;k++)
						{
							var areadetail=OAObj.childNodes(k);
							if(areadetail.getAttribute("parentCode").length>0)
							{
								this.AreaIDName += areadetail.getAttribute("value")+"{}"+areadetail.childNodes(0).text+"|";
							}
						}	
					}
				}
			}			
		}
		
		
		function readXMLforChrome_FF()
		{
			try
			{				
				var IsCL_Area=false;
				var IsCL_Generic=false;
				var IsCL_OA=false;
				var codeListLen=this.XMLdoc.childNodes.length;	
				for(var i=0;i<codeListLen;i++)
				{						
					var codeListsObj=this.XMLdoc.childNodes[i];				
					if(codeListsObj.nodeName.toLowerCase()=="message:codelists")
					{						
						var codeListsLen=codeListsObj.childNodes.length;						
						for(var j=0;j<codeListsLen;j++)
						{
							var codeList=codeListsObj.childNodes[j];								
							if(codeList.nodeName.toLowerCase()=="structure:codelist" && codeList.attributes["id"].nodeValue.toLowerCase()=="cl_generic")
							{									
								var codeListLen=codeList.childNodes.length;							
								for(var k=0;k<codeListLen;k++)
								{
									var structureCodeObj=codeList.childNodes[k];								
									if(structureCodeObj.nodeName.toLowerCase()=="structure:code")
									{
										var Generic_Key=structureCodeObj.attributes["value"].nodeValue.toLowerCase();										
										if($.inArray(Generic_Key, specialGenericKeyArr)>0) 
										{									
									
											var descriptionObjLen=structureCodeObj.childNodes.length;										
											for(var l=0;l<descriptionObjLen;l++)
											{
											
												var descriptionObj=structureCodeObj.childNodes[l];
												
												if(descriptionObj.nodeName.toLowerCase()=="structure:description")
												{	
													this.genericList += Generic_Key+"{}"+descriptionObj.textContent+"|";
												}
											}
										}
									}
								}						
								this.genericList=this.genericList.replace("undefined","");								
								IsCL_Generic=true;
							}
							else if(codeList.nodeName.toLowerCase()=="structure:codelist" && codeList.attributes["id"].nodeValue.toLowerCase()=="cl_area")
							{								
								var codeListLen=codeList.childNodes.length;							
								for(var k=0;k<codeListLen;k++)
								{
									var structureCodeObj=codeList.childNodes[k];								
									if(structureCodeObj.nodeName.toLowerCase()=="structure:code")
									{
										var structureValue=structureCodeObj.attributes["value"].nodeValue;
										var parentValue=structureCodeObj.attributes["parentCode"].nodeValue;
										if(parentValue.length>0)
										{
											var descriptionObjLen=structureCodeObj.childNodes.length;										
											for(var l=0;l<descriptionObjLen;l++)
											{
												var descriptionObj=structureCodeObj.childNodes[l];
												if(descriptionObj.nodeName.toLowerCase()=="structure:description")
												{											
													this.AreaIDName += structureValue+"{}"+descriptionObj.textContent+"|";
												}
											}
										}										
									}
								}
								this.AreaIDName=this.AreaIDName.replace("undefined","");
								IsCL_Area=true;
							}
							else if(codeList.nodeName.toLowerCase()=="structure:codelist" && codeList.attributes["id"].nodeValue.toLowerCase()=="cl_outcomeareas")
							{								
								var sOA="";
								var sinfo="OA1";
								var codeListLen=codeList.childNodes.length;							
								for(var k=0;k<codeListLen;k++)
								{
									var structureCodeObj=codeList.childNodes[k];								
									if(structureCodeObj.nodeName.toLowerCase()=="structure:code")
									{
										var structureValue=structureCodeObj.attributes["value"].nodeValue;									
										// OAid
										var sOAid =structureValue;
										this.fullinfo+=sOAid+"{}";
										this.OAList+=sOAid+"{}";
										var descriptionObjLen=structureCodeObj.childNodes.length;										
										for(var l=0;l<descriptionObjLen;l++)
										{
											var descriptionObj=structureCodeObj.childNodes[l];
											if(descriptionObj.nodeName.toLowerCase()=="structure:annotations")
											{									
												var structureAnnotaionsObjLen=descriptionObj.childNodes.length;
												for(var c=0;c<structureAnnotaionsObjLen;c++)
												{
													var structureAnnotaionObj=descriptionObj.childNodes[c];
													var structureAnnotaionLen=structureAnnotaionObj.childNodes.length;
													var status=false;
													var Isslogan=false;
													for(var m=0;m<structureAnnotaionLen;m++)
													{													
														var commanAnnotation=structureAnnotaionObj.childNodes[m];																										
														if(commanAnnotation.nodeName.toLowerCase()=="common:annotationtitle" && commanAnnotation.textContent.toLowerCase()=="longname" ||
														commanAnnotation.textContent.toLowerCase()=="slogan" || commanAnnotation.textContent.toLowerCase()=="notes")
														{														
															status=true;
															if(commanAnnotation.textContent.toLowerCase()=="slogan")
															{
																Isslogan=true;
															}
														}
														else if(commanAnnotation.nodeName.toLowerCase()=="common:annotationtext")
														{
															if(status)
															{														
																this.fullinfo +=commanAnnotation.textContent+"{}"
																if(Isslogan)
																{
																	this.OAList+=commanAnnotation.textContent+"|"
																}															
																if(sOAid.toLowerCase()=="oa1")
																{
																	sinfo+= "{}"+commanAnnotation.textContent;																
																}
																break;
															}
														}												
													}												
												}
												
											}										
										}										
									}
									//this.OAList += "|"sOAid+"{}"+slongname+"|";
									this.fullinfo+="|";									
								}
								this.strDefaultComponent=sOA+sinfo+"|";
								this.fullinfo=this.fullinfo.replace("undefined|||","");							
								this.OAList=this.OAList.replace("undefined","");								
								IsCL_OA=true;
							}
							if(this.IsCL_Area==true && this.IsCL_Generic==true && IsCL_OA==true)
							{							
							break;
						}
							}						
					}				
				}	
			}
			catch(ex){}
		}
		
		// TODO replace by a decent css, tableless design, obscure scripting solution (not in this run)
		function OAlistTable()
		{				
			this.OAlisthtml+="<TABLE style=\"width:100%;margin:0px;padding:0px;\" cellspacing=\"0\" cellpadding=\"0\">";
			var tempinfo=this.fullinfo+"ALL{}Select All|";			
			var listArray=tempinfo.split("|");
			
			if(listArray.length>0)
			{			
				for(var len=0;len<listArray.length;len++)
				{	
					if(listArray[len].length>0)
					{
						var OAItem=listArray[len].split("{}");												
						// Special handling of OA1 and OA2
						var sClassName = "menu2";
						// If Title contain ' charachter to handle function
						var modifyTitle = OAItem[1].replace("'","#");
						if (OAItem[0] == "OA1" || OAItem[0] == "OA2")
						{
							sClassName = "menu1";
						}						
						// Build the OA Item HTML List

						this.OAlisthtml += "<tr>";
						if (OAItem[0] != "ALL")
						{
							this.OAlisthtml += "<td id='td_" + OAItem[0] + "' class='" + sClassName + "' align='left' onmouseout=\"outClass('td_" + OAItem[0] + "');\">";
						}
						else
						{
							this.OAlisthtml +="<td id='td_" + OAItem[0] + "' class='" + sClassName + "' style='text-transform: none;' align='left' onmouseout=\"outClass('td_" + OAItem[0] + "');\">";
						}						
						this.OAlisthtml +="<table style='width:100%;margin:0px;padding:0px;border:0px;' cellspacing='0px' cellpadding='0px'>";
						this.OAlisthtml +="<tr>";						
						this.OAlisthtml +="<td  style='width:89%;padding:0px;padding-left:22px;font-family:Arial;font-size:10px;' onclick='javascript:ShowHideOA(\"S\",\"" + OAItem[0] + "\",\"" + modifyTitle + "\")'><span>";
						if(OAItem[1].length<30)
						{
							this.OAlisthtml +=OAItem[1] + "</span></td>";
						}
						else
						{
							this.OAlisthtml +=OAItem[1].substr(0,27) + "...</span></td>";
						}
						this.OAlisthtml +="<td style='width:11%;padding:0px;font-family:Arial;font-size:10px;' align='center'>";
						this.OAlisthtml +="<img id='imgClose_" + OAItem[0] + "' style='display:none;' onclick=\"javascript:ShowHideOA('H','" + OAItem[0] + "')\" alt='close' src='" + this.ImageFolder + "butt-menu-close.png' /></td>";
						this.OAlisthtml +="</tr></table>";
						this.OAlisthtml +="</td></tr>";
						this.OAlisthtml +="<tr><td style='padding:0px;font-family:Arial;font-size:10px;' height='1px' bgcolor='#FFFFFF'></td></tr>";	
					}
				}	
			}	
			this.OAlisthtml +="</TABLE>";
			this.OAlisthtml=this.OAlisthtml.replace("undefined","");
			
			
		//	document.getElementById('divOAList').innerHTML=this.OAlisthtml;			
		}
		// Put the hover effect on dropdown list
		function ToggleCssClass(Ishover,ctrlId)
		{
			var controlObj=document.getElementById(ctrlId);
			if(ctrlId=="td_Selected")
			{
				if(Ishover=="t")
				{
					controlObj.className="ddlmenu_hover";
				}
				else
				{
					controlObj.className="ddlmenu_selected";
				}
			}
			else
			{
				if(Ishover=="t")
				{
					controlObj.className="ddlmenu_hover";
				}
				else
				{
					controlObj.className="ddlmenu";
				}
			}
		}
		
	// Create dropdown for comaparecountries	
	function createDropdown()
	{				
		var ddldefaultstring = this.returnGenericValue("bc_select_oa");		
		this.ddlOAList = "<table id='list1' cellpadding='0' cellspacing='0' style='position:absolute;'>";
        this.ddlOAList += "<tr><td id='td_Selected' valign='middle' class='ddlmenu_selected' onmouseout=\"ToggleCssClass('f','td_Selected')\""+
		" onmouseover=\"ToggleCssClass('t','td_Selected')\"><table cellpadding='0' cellspacing='0'><tr><td id='innertd1' width='662'>"+ddldefaultstring+
                "</td><td id='innertd2' width='20' align='right'><img id='ddlimg' src='" + this.ImageFolder + 
                "arrow.png' ></td></tr></table></td></tr><tr><td height='1' style='background-color:#ffffff;'></td></tr>";								
		var OAinfo=null; 
		var OAListitem = fullinfo.split('|');
		for (var cc=0;cc<OAListitem.length;cc++)
		{
			if (OAListitem[cc].toString().length > 0)
			{
				OAInfo = OAListitem[cc].split('{}');
				if(OAInfo[0]!="OA1")
				{
					this.ddlOAList += "<tr><td id='td_" + OAInfo[0] + 
					"' class='ddlmenu' onmouseout=\"ToggleCssClass('f','td_"+OAInfo[0]+"')\" onmouseover=\"ToggleCssClass('t','td_"+OAInfo[0]+
					"')\" style='display:none;' onclick=\"selectedValue('" + OAInfo[0] + "')\">" + OAInfo[1] + "</td></tr>";
					this.ddlOAList += "<tr><td height='1' style='background-color:#ffffff;'></td></tr>";
				}
			}
		} 		
        this.ddlOAList += "</table>";		
	}
        
