/* 
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

//function getLocal()
//{
////都道府県
//    var prefectureNm = $F('prefecture_id');
//    var ajax = new Ajax.Request(
//        'libs/mkLocal.php',
//        {
//            method: 'gett',
//            parameters: 'prefecture_id=' + prefectureNm,
//            requestHeaders: ['charset', 'ISO-8858-1'],
//            onComplete: mkLocal
//        }
//    );
//}
function getLocal()
{
var prefectureNm = $('#prefecture_id').attr('value');
$.ajax({
   type: "GET",
   url: "libs/mkLocal.php",
   data: 'prefecture_id=' + prefectureNm,
   success: function(msg){
    localGovernments = eval(msg);
    $('#city_id').length = 0;
    $('#city_id')[0] = new Option('選択してください', '');
    i = 1;
//    localGovernments.each( function(government){
//$("#city_id").empty();
    $.each( localGovernments,function(government){
//        $('#city_id')[i] = new Option(this.local_nm, this.local_id);
        var elem = document.createElement("option");
        elem.text = this.local_nm;
        elem.value = this.local_id;

        $("#city_id").append(elem);

        this.prefecture_id;
        i++;
    });
   }
 });
}
//function mkLocal(xhr)
//{
////都道府県
//
//    localGovernments = eval(xhr.responseText);
//    $('city_id').length = 0;
//    $('city_id')[0] = new Option('選択してください', '');
//    i = 1;
//    localGovernments.each( function(government){
//        $('city_id')[i] = new Option(government['local_nm'], government['local_id']);
//        i++;
//    });
//}








