function getDestination(){
	if(document.getElementById("destcountry").options.length <2){
	
		var loaderphp = "fetchCountry.php";
		var xmlHttp;
		if (navigator.plugins && navigator.mimeTypes && navigator.mimeTypes.length)
		{
			// Firefox, Opera 8.0+, Safari
			xmlHttp=new XMLHttpRequest();
		}
	    else if (window.ActiveXObject)
		{
			try{
				xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
			}catch(e){
				try{
					xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
				}catch(e)
				{
					alert("Your browser does not support AJAX!");
					return false;
				}
			}
		}
		xmlHttp.onreadystatechange=function()
		{
			if(xmlHttp.readyState==4)
			{
				var newresponse=xmlHttp.responseText.substring(0,(xmlHttp.responseText.length));
				var values=newresponse.split('#');
				if(values.length>0)
				{
					for(var i=0;i<values.length;i++)
					{
						var splitvalues=values[i].split('@');
						var splitvalue=splitvalues[0];
						var splitname=splitvalues[1];
						var opt1 = document.createElement("option");
						document.getElementById("destcountry").options.add(opt1);
						opt1.text = splitname;
						opt1.value = splitvalue;
					}
				}
			}
		}
		//Outbound Rates for Pay as You Go
		xmlHttp.open("GET", loaderphp,true);
		xmlHttp.send(null);
		
	}	
}


function getInfo(ID1,ID2,Param)
{
	var loaderphp = "fetchData.php";
	var xmlHttp;
	if (navigator.plugins && navigator.mimeTypes && navigator.mimeTypes.length)
	{
		// Firefox, Opera 8.0+, Safari
		xmlHttp=new XMLHttpRequest();
	}
    else if (window.ActiveXObject)
	{
		try{
			xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
		}catch(e){
			try{
				xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
			}catch(e)
			{
				alert("Your browser does not support AJAX!");
				return false;
			}
		}
	}
	xmlHttp.onreadystatechange=function()
	{
		if(xmlHttp.readyState==4)
		{
			if(ID1=="destcountry")//Outbound Rates for Pay as You Go
			{
				document.getElementById(ID2).options.length = 0;
				var opt = document.createElement("option");
				document.getElementById(ID2).options.add(opt);
				opt.text = "Please Select";
				opt.value = "";
				var newresponse=xmlHttp.responseText.substring(0,(xmlHttp.responseText.length));
				var values=newresponse.split('#');
				if(values.length>0)
				{
					for(var i=0;i<values.length;i++)
					{
						var splitvalues=values[i].split('@');
						var splitvalue=splitvalues[0];
						var splitname=splitvalues[1];
						var opt1 = document.createElement("option");
						document.getElementById(ID2).options.add(opt1);
						opt1.value = splitvalue;
						if(splitvalue == -1){
							splitvalue = '';
						}
						opt1.text = Param + splitvalue+" - "+splitname;
						
					}
				}
			}
			else if(ID1=="destcountry1")
			{
				var newresponse=xmlHttp.responseText.substring(0,(xmlHttp.responseText.length));
				if(newresponse.length>0)
				{
					document.getElementById(ID2).innerHTML="<span class='run'>Rate per Minute:&nbsp;&nbsp;</span><span class='txtblue c1'><strong>$&nbsp;"+newresponse+"</strong</span>";
				}
			}
			else if(ID1=="destcountry2")//Outbound Rates for Hosted
			{
				document.getElementById(ID2).options.length = 0;
				var opt = document.createElement("option");
				document.getElementById(ID2).options.add(opt);
				opt.text = "Please Select";
				opt.value = "";
				var newresponse=xmlHttp.responseText.substring(0,(xmlHttp.responseText.length));
				var values=newresponse.split('#');
				if(values.length>0)
				{
					for(var i=0;i<values.length;i++)
					{
						var splitvalues=values[i].split('@');
						var splitvalue=splitvalues[0];
						var splitname=splitvalues[1];
						var opt1 = document.createElement("option");
						document.getElementById(ID2).options.add(opt1);
						opt1.text = splitvalue+" - "+splitname;
						opt1.value = splitvalue;
					}
				}
			}
			else if(ID1=="destcountry3")//Outbound Rates for Hosted
			{
				var newresponse=xmlHttp.responseText.substring(0,(xmlHttp.responseText.length));
				if(newresponse.length>0)
				{
					document.getElementById(ID2).innerHTML="<span class='run'>Rate per Minute:&nbsp;&nbsp;</span><span class='txtblue c1'><strong>$&nbsp;"+newresponse+"</strong</span>";
				}
			}
			
		}
	}
	//Outbound Rates for Pay as You Go
	if(ID1=="destcountry")
	{
		xmlHttp.open("GET", loaderphp+"?Param="+Param+"&Mode=Destination",true);
	}
	else if(ID1=="destcountry1")
	{
		var CountryCode = document.getElementById("destcountry").value;
		xmlHttp.open("GET", loaderphp+"?Param="+CountryCode+"&Mode=Prefix&CityCode="+Param,true);
	}
	else if(ID1=="destcountry2")//Outbound Rates for Hosted
	{
		xmlHttp.open("GET", loaderphp+"?Param="+Param+"&Mode=Destination2",true);
	}
	
	else if(ID1=="destcountry3")
	{
		xmlHttp.open("GET", loaderphp+"?Param="+Param+"&Mode=Prefix2",true);
	}
	xmlHttp.send(null);
}
