// ========================================================================
// - [prefecture.js]
// - package：Prefecture functions
// - author：Yujiro Takahashi
// - modified：
// -      [2006/07/02] created
// - contact：    yujiro@rakuto.net
// -      Copyright (C) 2006 `rakuto.net'. All Rights Reserved.
// - =======================================================================

function set_local(json){
	var node = $('prefecture');
	var id = node[node.selectedIndex].value;

	new Ajax.Request(json + '?ref_prefecture=' + id, {
        onComplete : function (request) {
            var reslut = eval (request.responseText);
			node = $('local');

            node.length = reslut.length;
			node.selectedIndex = 0;
            for (var row=0; row<reslut.length; row++){
                node.options[row].value = reslut[row].label;
                node.options[row].text  = reslut[row].label;
                node.options[row].label = reslut[row].label;
			}
		}
    });
}

function set_homelocal(json){
	var node = $('hometown');
	var id = node[node.selectedIndex].value;

	new Ajax.Request(json + '?ref_prefecture=' + id, {
        onComplete : function (request) {
            var reslut = eval (request.responseText);
			node = $('homelocal');

            node.length = reslut.length;
			node.selectedIndex = 0;
            for (var row=0; row<reslut.length; row++){
                node.options[row].value = reslut[row].label;
                node.options[row].text  = reslut[row].label;
                node.options[row].label = reslut[row].label;
			}
		}
    });
}
