/*
 * D2JS
 * Copyright (C) SatisKia. All rights reserved.
 */
var _json_str;
function jsonInit()
{
	_json_str = "";
}
function jsonAddInteger( key, value )
{
	if( _json_str.length > 0 )
	{
		_json_str += ',';
	}
	_json_str += "\"" + key + "\":\"" + value + "\"";
}
function jsonAddString( key, value )
{
	if( _json_str.length > 0 )
	{
		_json_str += ',';
	}
	_json_str += "\"" + key + "\":\"" + encodeURIComponent( value ) + "\"";
}
function jsonOut()
{
	return "{" + _json_str + "}";
}
var _json_array;
function jsonResponse( data )
{
	_json_array = eval( "(" + data + ")" );
}
function jsonGetSize()
{
	if( _json_array.length != undefined )
	{
		return _json_array.length;
	}
	return 0;
}
function jsonGetString( index, key, defString )
{
	if( _json_array.length != undefined )
	{
		return decodeURIComponent( (key in _json_array[index]) ? _json_array[index][key] : defString );
	}
	return decodeURIComponent( (key in _json_array) ? _json_array[key] : defString );
}
function jsonGetInteger( index, key, defInteger )
{
	return parseInt( jsonGetString( index, key, "" + defInteger ) );
}
