	var httpCountryListReq = null;

	function getCountryListInstance()
	{
		var httpCountryListReq = null;

		try
		{
			httpCountryListReq = new ActiveXObject("Msxml2.XMLHTTP");
		}
		catch(Ex)
		{
			try
			{
				httpCountryListReq = new ActiveXObject("Microsoft.XMLHTTP");
			}
			catch(Ex2)
			{
				httpCountryListReq = null;
			}
		}

		return httpCountryListReq;
	}


	function OnSearchCountryList(strValue, lang, area, text_id, search_list_id, country_list_layer_id, country_num_id, country_Mini_id, mode, selected_country)
	{

		if(window.ActiveXObject)		//익스플로러
		{
			httpCountryListReq = getCountryListInstance();
		}
		else if(window.XMLHttpRequest)	// 파이어폭스 넷스케이프
		{
			httpCountryListReq = new XMLHttpRequest();
		}
		
		if(lang == undefined || lang == "")
		  lang = "0";

		if(area == undefined)
		  area = "";

		if(country_num_id == undefined || country_num_id == "")
		  country_num_id = "";

		if(country_Mini_id == undefined || country_Mini_id == "")
		  country_Mini_id = "";
		  
		if(mode == undefined || mode == "")
		  mode = "0";

		if(selected_country == undefined || selected_country == "")
		  selected_country = "";

		var strURL = "";
	  strURL = "../reservation/country_data.php?search="+strValue+"&lang="+lang+"&mode="+mode+"&area="+area+"&text_id="+text_id+"&search_list_id="+search_list_id+"&country_list_layer_id="+country_list_layer_id+"&country_num_id="+country_num_id+"&country_Mini_id="+country_Mini_id+"&selected_country="+selected_country;
//document.write(strURL);
//return;

		httpCountryListReq.open("POST", strURL, true);

		httpCountryListReq.onreadystatechange = handleStateCountryList;

		httpCountryListReq.send();
	}

	function handleStateCountryList()
	{
		if(httpCountryListReq.readyState == 4)
		{
			if(httpCountryListReq.status == 200) 
			{
				if(window.ActiveXObject)		//익스플로러
				{
					xmlDocument = new ActiveXObject('Microsoft.XMLDOM');
					xmlDocument.async = false;
					xmlDocument.loadXML(httpCountryListReq.responseText);
				}
				else if(window.XMLHttpRequest)	// 파이어폭스 넷스케이프
				{
					xmlParser = new DOMParser();
					xmlDocument = xmlParser.parseFromString(httpCountryListReq.responseText, 'text/xml');
				}
				else
				{
					return null;
				}

				var mode = "";
				var text_id = "";
				var search_list_id = "";
				var lang = "";
				var country_list_layer_id = "";
				var country_num_id = "";
				var country_Mini_id = "";
				var selected_country = "";

				var BaseInfoList = xmlDocument.getElementsByTagName("TotalList")[0];
				if(BaseInfoList != null)
				{
					var BaseInfo = BaseInfoList.childNodes[0];

					for(i=0;i<BaseInfoList.childNodes.length;i++)
					{
							
						BaseInfo = BaseInfoList.childNodes[i];
	  
						//mode
						if(BaseInfo.getElementsByTagName("mode")[0].childNodes[0] != null)
							mode = BaseInfo.getElementsByTagName("mode")[0].childNodes[0].nodeValue;						
						//text_id
						if(BaseInfo.getElementsByTagName("text_id")[0].childNodes[0] != null)
							text_id = BaseInfo.getElementsByTagName("text_id")[0].childNodes[0].nodeValue;	  
						//search_list_id
						if(BaseInfo.getElementsByTagName("search_list_id")[0].childNodes[0] != null)
							search_list_id = BaseInfo.getElementsByTagName("search_list_id")[0].childNodes[0].nodeValue;	  
						//lang
						if(BaseInfo.getElementsByTagName("lang")[0].childNodes[0] != null)
							lang = BaseInfo.getElementsByTagName("lang")[0].childNodes[0].nodeValue;							
						//country_list_layer_id
						if(BaseInfo.getElementsByTagName("country_list_layer_id")[0].childNodes[0] != null)
							country_list_layer_id = BaseInfo.getElementsByTagName("country_list_layer_id")[0].childNodes[0].nodeValue;				
						if(BaseInfo.getElementsByTagName("country_num_id")[0].childNodes[0] != null)
							country_num_id = BaseInfo.getElementsByTagName("country_num_id")[0].childNodes[0].nodeValue;
						if(BaseInfo.getElementsByTagName("country_Mini_id")[0].childNodes[0] != null)
							country_Mini_id = BaseInfo.getElementsByTagName("country_Mini_id")[0].childNodes[0].nodeValue;
						if(BaseInfo.getElementsByTagName("selected_country")[0].childNodes[0] != null)
							selected_country = BaseInfo.getElementsByTagName("selected_country")[0].childNodes[0].nodeValue;
						
					}
				}

				var personList = xmlDocument.getElementsByTagName("TotalList")[1];
				if(personList != null)
				{
  				var person = personList.childNodes[0];
  
  
  				var country_num = "";
  				var area = "";
  				var mini = "";
  				var kor = "";
  				var eng = "";
  				var chn = "";
  				var jpn = "";
  				var strValue = "";
  				var strName = "";
  				
  
				var listStr = "";
  				
				  var nRow = 0;

          
				  if(mode == "0") // 검색시
				  {
					listStr += "<table bgcolor='#FFFFFF' cellpadding='2' cellspacing='4' border='0'>";
					listStr += "<tr>"
							listStr += "<td align='right'><img src='../reservation/image/close-mirazi9.gif' border='0' style='cursor:hand' onclick=\"document.getElementById('country_Search_list_layer').style.display='none';\"></td>";					
					listStr += "</tr>"
				  }
				  else
				  {
							listStr += "<select class='select_blue' id='country_list' name='country_list' onchange=\"javascript:OnSelCountryList(this.value, '"+text_id+"', '"+search_list_id+"', '"+country_num_id+"', '"+country_Mini_id+"'  );\" >";
							listStr += "<option value=''> -------------- </option>";         
				  }
        
					for(i=0;i<personList.childNodes.length;i++)
					{
							
						person = personList.childNodes[i];
	  
						
						//country_num
						if(person.getElementsByTagName("country_num")[0].childNodes[0] != null)
							country_num = person.getElementsByTagName("country_num")[0].childNodes[0].nodeValue;
	  
						//area
						if(person.getElementsByTagName("area")[0].childNodes[0] != null)
							area = person.getElementsByTagName("area")[0].childNodes[0].nodeValue;
	  
						//mini
						if(person.getElementsByTagName("mini")[0].childNodes[0] != null)
							mini = person.getElementsByTagName("mini")[0].childNodes[0].nodeValue;
	  
						//kor
						if(person.getElementsByTagName("kor")[0].childNodes[0] != null)
							kor = person.getElementsByTagName("kor")[0].childNodes[0].nodeValue;
	  
						//eng
						if(person.getElementsByTagName("eng")[0].childNodes[0] != null)
							eng = person.getElementsByTagName("eng")[0].childNodes[0].nodeValue;
	  
						//chn
						if(person.getElementsByTagName("chn")[0].childNodes[0] != null)
							chn = person.getElementsByTagName("chn")[0].childNodes[0].nodeValue;
	  
						//jpn
						if(person.getElementsByTagName("jpn")[0].childNodes[0] != null)
							jpn = person.getElementsByTagName("jpn")[0].childNodes[0].nodeValue;
	  
						strValue = country_num+"^"+area+"^"+mini+"^"+kor+"^"+eng+"^"+chn+"^"+jpn;
						if(lang == "0")       //kor
						  strName = kor;
						else if(lang == "1")  //eng
						  strName = eng;
						else if(lang == "2")  //chn
						  strName = chn;
						else if(lang == "3")  //jpn
						  strName = jpn;
						
						if(mode == "0") // 검색시
						{
						  listStr += "<tr>"
									listStr += "<td width='183' onmouseover=this.style.backgroundColor='#C5D5FC' onmouseout=this.style.backgroundColor='' style='cursor:pointer' onclick=\"javascript:OnSelCountryList('"+strValue+"', '"+text_id+"', '"+search_list_id+"', '"+country_num_id+"', '"+country_Mini_id+"');\">"+strName+"</td>";
						  listStr += "</tr>"
						}
						else
						{
							var strSelected = "";
							if(selected_country != "" && country_num == selected_country)
								strSelected = "selected";

							listStr += "<option value='"+strValue+"' "+strSelected+">"+strName+"</option>";            
						}
			  
						country_num = "";
						area = "";
						mini = "";
						kor = "";
						eng = "";
						chn = "";
						jpn = "";
						strName = "";
						strValue = "";
						
						nRow = parseInt(nRow)+1;
					
					}

				  if(mode == "0") // 검색시
				  {

						if(parseInt(nRow) <= 0)
						{
							  listStr += "<tr>"
										listStr += "<td width='183' onmouseover=this.style.backgroundColor='#C5D5FC' onmouseout=this.style.backgroundColor='' style='cursor:hand' onclick=\"javascript:OnSelCountryList('', '"+text_id+"', '"+search_list_id+"', '"+country_num_id+"', '"+country_Mini_id+"');\">검색 결과 없음</td>";					
							  listStr += "</tr>"				  
							  listStr += "</table>"
							  
							  nRow = "1";
						}
						listStr += "</table>"	
						document.getElementById(search_list_id).innerHTML = listStr;
							
						OnShowCountryList(nRow, text_id, search_list_id, country_num_id, country_Mini_id);
       			
				  }
				  else
				  {
							//listStr += "<option value='기타'>기타</option>";
							listStr += "</select>";

							if(document.getElementById(country_list_layer_id) != null)
								document.getElementById(country_list_layer_id).innerHTML = listStr;
							
							OnRadioCountry();


					
				  }
			  }

			}

		}
		else
		{
//			alert(httpCountryListReq.readyState);
		}
	}




  

  function  change_CountryArea(strValue, lang, obj, text_id, search_list_id, country_list_layer_id, country_num_id, country_Mini_id, mode, selected_country)
  {
	  var str = "";
	  var area = strValue;
	  var mode = "1"; //리스트 가져오기
 	  OnSearchCountryList(str, lang, area, text_id, search_list_id, country_list_layer_id, country_num_id, country_Mini_id, mode, selected_country);  
  }
  
  
  
  function  OnSearchCountryEnterKey(e, lang, text_id, search_list_id, country_list_layer_id, country_num_id, country_Mini_id)
  {

		if( e.keyCode == 13)
		{
			OnSearchCountry(lang, text_id, search_list_id, country_list_layer_id, country_num_id, country_Mini_id);
			e.returnValue = false;
		}
  }
  
  function  OnSearchCountry(lang, text_id, search_list_id, country_list_layer_id, country_num_id, country_Mini_id)
  {
	  var str = document.getElementById(text_id).value;
	  var area = "";
	  var mode = "0"; //검색하기
	  
	  OnSearchCountryList(str, lang, area, text_id, search_list_id, country_list_layer_id, country_num_id, country_Mini_id, mode);  
  }
  
  
	function	OnShowCountryList(nCount, text_id, search_list_id, country_num_id, country_Mini_id)
	{
		if(parseInt(nCount) <= 0)
		{
			OnSelCountryList('', text_id, search_list_id, country_num_id, country_Mini_id);
		}
		else
		{
			var obj = document.getElementById(text_id);
			var newX = findPosX(obj);
			var newY = findPosY(obj);

			document.getElementById(search_list_id).style.top = parseInt(newY) + parseInt(obj.style.height) + 2 + 2;
			document.getElementById(search_list_id).style.left = parseInt(newX) + 2;// + parseInt(obj.style.width) + 2;
			document.getElementById(search_list_id).style.display = "block";
		}
	}	
	
	function  OnSelCountryList(strValue, text_id, country_Search_list_layer, country_num_id, country_Mini_id)
	{
	    if(strValue == "" || strValue == undefined)
	    {
  			document.getElementById(text_id).value = "";	    
  			document.getElementById(country_num_id).value = "";
  			document.getElementById(country_Mini_id).value = "";
	    }
	    else
	    {
			  var array = strValue.split('^');
  			document.getElementById(text_id).value = array[3]; //kor
			document.getElementById(text_id).select();
  			document.getElementById(country_num_id).value = array[0]; //country_num
 			document.getElementById(country_Mini_id).value = array[2]; //country_mini name
		}


		document.getElementById(country_Search_list_layer).style.display = "none";
	}

	
		
  



