var Dictionary = function()
{
    this.dict = null;
    this.getDictionary = getDictionary;
    this.setDictionary = setDictionary;
    this.getArtist = getArtist;
    this.getAlbum = getAlbum;
	this.getArtistId = getArtistId;
    this.getAlbumId = getAlbumId;

    function setDictionary(dict)
    {
        this.dict = dict;
    }

    //TODO:get dict with ajax
    function getDictionary()
    {
        return this.dict;
    }

    function getArtist(id)
    {
       return this.dict['artists'][id];
    }

    function getAlbum(id)
    {
       return this.dict['albums'][id];
    }
	
	function getArtistId(artistName)
    {
	   for (i in this.dict['artists'])
		{
			if (this.dict['artists'][i] == artistName)
			{
				return i;
			}
		}
 
       return 0;
    }

    function getAlbumId(albumName)
    {
	   for (i in this.dict['albums'])
		{
			if (this.dict['albums'][i] == albumName)
			{
				return i;
			}
		}
 
       return 0;
    }
}


