var xHttp;
var valu1;
function selectedcountry(Country,valu)
{
                            
valu1 = valu;
xmlHttp=GetXmlHttpObject();
	if (xmlHttp==null)
  {
  alert ("Your browser does not support AJAX!");
  return;
  } 

var url="Country.asp";
url=url+"?Country="+Country;
xmlHttp.onreadystatechange=stateChanged;
xmlHttp.open("GET",url,true);
xmlHttp.send(null);
}

 
function GetXmlHttpObject()
{
var xmlHttp=null;
try
  {

  xmlHttp=new XMLHttpRequest();
  }
catch (e)
  {

  try
    {
    xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
    }
  catch (e)
    {
    xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
    }
  }
return xmlHttp;
}

function stateChanged() 
{ 

	if(xmlHttp.readyState == 4)
	{
		if(xmlHttp.status == 200)
		{		
		   DestinationCodeWite(xmlHttp.responseText);
		}
		else
		{
			//alert("shdjkfhsjkdhf");
			alert("There was a problem retrieving data from the server." );
		}
	}


}

function DestinationCodeWite(countryNode)
{
	var rss=countryNode.split("^|");
	var i;
	if(rss.length-1>0)
	{
	str1="<table border=\"0\" cellspacing=\"0\" cellpadding=\"0\">";
	str1=str1 + "<tr class=text><td><select id=\"Destination\" name=\"Destination\" class=selectbox>"
	//str1=str1 + "<option value='0' selected> Select a Destination </option>"
	if (valu1=="0")
	{
	str1=str1 + "<option value='0' selected> Select a Destination </option>"
	}
		for(i=0;i<rss.length-1;i++)
		{
			var field;
			var j;
				field=rss[i].split("*");
					//str1=str1 + "<option value=\""+field[0] + "\">" + field[1] + "</option>"
					if (valu1=="1")
					{
							if (field[0]=="LON")
							{
								str1=str1 + "<option value=\""+field[0] + "\" selected>" + field[1] + "</option>"
							}
							else
							{
								str1=str1 + "<option value=\""+field[0] + "\">" + field[1] + "</option>"
							}
					}
					else
					{
						str1=str1 + "<option value=\""+field[0] + "\">" + field[1] + "</option>"
					}
		}
	str1=str1+"</table>";
	document.getElementById('DestinationField').innerHTML=str1;
	}
	else
	{
		document.getElementById('DestinationField').innerHTML="";
	}
	
}

function DestinationCodeDef()
{
	str1="<table border=\"0\" cellspacing=\"0\" cellpadding=\"0\">";
	str1=str1 + "<tr class=text><td><select id=\"Destination\" name=\"Destination\" class=selectbox >"
	str1=str1 + "<option value='0' selected> Select a Destination </option>"
	str1=str1+"</table>";
	document.getElementById('DestinationField').innerHTML=str1;
}
