/* 
 * 	Load Words
 */

Dictionary = function()
{
	this.dictArr;
	this.getSuccess = 0;
	
	this.load = function()
	{		
		var currObj = this;		
		// get json response		
		
		$.getJSON("/dictionary/get/", "get=1", function(json)
		{				
			if(currObj.dictArr == undefined)
			{
				currObj.dictArr = new Array();
			}
			
			$response = eval(json);
			for($k in $response)
			{
				for ($sk in $response[$k])
				{
					currObj.dictArr[$sk] = $response[$k][$sk];	
				}
			}		
			
			currObj.getSuccess = 1;			
		});		
	}
	
	this.get = function($var)
	{		
		if (this.getSuccess == 1)
		{
			if (this.dictArr != undefined 
					&& this.dictArr[$var] != undefined)
			{
				return this.dictArr[$var];
			}
			else
			{
				return "{" + $var + "}";
			}			
		}
		else
		{
			return "{" + $var + "}";
		}
	}
}

$dictionary = new Dictionary();
$dictionary.load();
