﻿function cityResult1()
{			   
    var city=document.getElementById("ctl00_ContentPlaceHolder1_city");
    getcity.iGetarea(city.value,iGetarea_Result_CallBack);
}		

function iGetarea_Result_CallBack(response)
{
    if(response.value!=null)
    {
      var area_v=document.getElementById("ctl00_ContentPlaceHolder1_area");
      area_v.options.length=0;        
      
      var ds=response.value;
      if(ds!=null && typeof(ds)=="object" && ds.Tables!=null)
      {
         area_v.options.add(new Option("- 地區 -",""));
         for(var i=0; i<ds.Tables[0].Rows.length; i++)
         {
            var name=ds.Tables[0].Rows[i].area;
            var id=ds.Tables[0].Rows[i].area;
            area_v.options.add(new Option(name,id));
         }
     }
     
     // 業務分區
     var operation_v = document.getElementById("ctl00_ContentPlaceHolder1_operation");

     if (operation_v != null) {
         operation_v.options.length = 0;

         var ds = response.value;
         if (document.getElementById("ctl00_ContentPlaceHolder1_city").value == "台北市") {
             operation_v.options.add(new Option("-業務分區-", ""));
             operation_v.options.add(new Option("中區", "中區"));
             operation_v.options.add(new Option("西區", "西區"));
             operation_v.options.add(new Option("東區", "東區"));
         }
     }
     
      
    }
}


// 沒有框架頁使用
function cityResult2()
{			   
    var city=document.getElementById("city");
    getcity.iGetarea(city.value,iGetarea_Result_CallBack2);
}		

function iGetarea_Result_CallBack2(response)
{
    if(response.value!=null)
    {
      var area_v=document.getElementById("area");
      area_v.options.length=0;        
      
      var ds=response.value;
      if(ds!=null && typeof(ds)=="object" && ds.Tables!=null)
      {
         area_v.options.add(new Option("- 地區 -",""));
         for(var i=0; i<ds.Tables[0].Rows.length; i++)
         {
            var name=ds.Tables[0].Rows[i].area;
            var id=ds.Tables[0].Rows[i].area;
            area_v.options.add(new Option(name,id));
         }
      }
    }
}
