/* SVN FILE: $Id: city.js 164 2008-04-23 00:36:15Z bb_yujiro $ */
/**
 * 市区町村データの出力
 *
 * JavaScript
 *
 *      Hitsuji : Social Network Service <http://rakuto.net/rktSNS/>
 *      Copyright (c) 2007 Yujiro Takahashi
 *
 * Licensed under The MIT License
 * Redistributions of files must retain the above copyright notice.
 *
 * @filesource
 * @package         Hitsuji
 * @copyright       Copyright (c) 2007 Yujiro Takahashi
 * @link            http://rakuto.net/rktSNS/
 * @author          Yujiro Takahashi <yujiro@rakuto.net>
 * @version         $Revision: 164 $
 * @modifiedby      $LastChangedBy: bb_yujiro $
 * @lastmodified    $Date: 2008-04-23 09:36:15 +0900 (水, 23 4 2008) $
 * @license         http://opensource.org/licenses/mit-license.php The MIT License
 */

function setCity(sUrl, node, target){
	var id = node[node.selectedIndex].value;
	sUrl = sUrl + id + '/';

	var callback =
	{
		success: function(o) {
			var reslut = YAHOO.lang.JSON.parse (o.responseText);
			var city  = YAHOO.util.Dom.get(o.argument[0]);

			city.length = reslut.length;
			city.selectedIndex = 0;
			for (var row=0; row<reslut.length; row++){
				city.options[row].value = reslut[row].id;
				city.options[row].text  = reslut[row].city;
				city.options[row].label = reslut[row].city;
			}
		},
		failure: function(o) {
		},
		argument: [target]
	}
	YAHOO.util.Connect.asyncRequest('GET', sUrl, callback);
}
