

/*
작업 지침 

AjaxRequest.get(
  {
    'onLoading':function() { alert("Loading"); }
    ,'onLoaded':function() { alert("Loaded"); }
    ,'onInteractive':function() { alert("Interactive"); }
    ,'onComplete':function() { alert("Complete"); }
    ,'onSuccess':function() { alert("Success"); }
  }
);

*/

function get_request_search_select(branch){
 
	var sel,pv1,pars,obj_sel;

    var xmlDoc;
    var xml_data = new Array(); 
    var xml_tmp  = '';    

	var next_process  = 1; // 다음 단계 실행 관련해서 
	var f = document.forms['f_detail_search']; // 기본 폼 스크립트 


    switch (branch)
	{
        case "st_state"   : 
			// 국가 구분에 따를 스크립트 

	        sel      = f.st_nation;
	        pv1      = sel.options[sel.selectedIndex].value;
	        pars     = '?pin=list_state&pv1=' + pv1;
	        obj_sel  = f.st_state;



			if(pv1 == 'KR') {
				$('#nation_state').css('display','');
				$('#st_state').css('display','');
				$('#st_area').css('display','none');
				$('#st_kr').attr('checked', true);
				$('#st_nation_message').css('display','none');
			} else if(pv1 == 'US' || pv1 == 'JP' || pv1 == 'CN' || pv1 == 'RU' || pv1 == 'AU' || pv1 == 'BR' || pv1 == 'CA' || pv1 == 'FR' || pv1 == 'DE' || pv1 == 'IN' || pv1 == 'UK' || pv1 == 'ID' || pv1 == 'UA' || pv1 == 'KZ' || pv1 == 'MX' || pv1 == 'IT' || pv1 == 'CL') {
				$('#nation_state').css('display','');
				$('#st_state').css('display','');
				$('#st_area').css('display','none');
				$('#st_kr').attr('checked', false);
				$('#st_nation_message').css('display','none');
			} else if (pv1 == '') {
				$('#nation_state').css('display','');
				$('#st_state').css('display','none');
				$('#st_area').css('display','none');
				$('#st_kr').attr('checked', false);
				$('#st_nation_message').css('display','');
		    } else {
				$('#nation_state').css('display','none');
				$('#st_state').css('display','none');
				$('#st_area').css('display','none');
				$('#st_kr').attr('checked', false);
				$('#st_nation_message').css('display','none');
		    }

            obj_sel.options.length = 0;
	        obj_sel.options[obj_sel.options.length] = new Option('지역전체','0');

			break;

       case "st_area" : 
		    // 지역 구분에 따른 스크립트 
	        var nation_sel = f.st_nation;
	        var nation_pv1 = nation_sel.options[nation_sel.selectedIndex].value;
	        
	        if (nation_pv1 == 'KR') {
//		        $('#st_area').css('display','');
	        	pv1 = $("#list_box_area input[type=checkbox]:checked").not('[name=st_state_all]').val();
		        pars     = '?pin=list_area&pv1=' + pv1;
		        obj_sel  = f.st_area;
				
	            obj_sel.options.length = 0;
		        obj_sel.options[obj_sel.options.length] = new Option('세부지역 선택','0');
	        } else {
	        	return;
	        }
	        
		    break;	

       default :
	       return;
		   break;
	}

	//alert('1: 프로그램 실행 에러');

	// 실행중단 부분 
	if(next_process == 0) return false;

	AjaxRequest.get(
	  {
		'url':'./xml_process.php'+pars
	    ,
		'onSuccess':
		function(req)
		{ 
			if(req.responseXml) 
				xmlDoc = req.responseXml;	   
			else
				xmlDoc = req.responseXML;

			xml_data = xmlparser_obj(xmlDoc,'item');
			xml_size = xml_data.length;

			//alert(xmlDoc);
			//alert(xml_size);
			//alert(req.responseText);

			for(var i=0; i<xml_size; i++) {
				try {
			        obj_sel.options[obj_sel.options.length] = new Option(xml_data[i].xml_value,xml_data[i].xml_key);
				} catch(e) {
					;
				}		
			}
			//f.result.value = req.url; 
		}
		,
		'onError':
		function(req)
		{ 
			alert('프로그램 실행 에러');
		}
	  }
	);
		
}


