DataSource = function(sourceUrl, type)
{
    this.sourceUrl = sourceUrl;
    this.type = type;
}

DataSource.prototype = 
{
    sourceUrl: null,
    type: null,
    
    dataOnSuccess: function(ajaxObj)
    {
        var response = ajaxObj.parseJSON();
        ajaxObj.callbackFunction(response.items);
    },
    
	query: function(phrase, callbackFunction)
	{
        if(phrase == "")
        {
            callbackFunction(new Array());
            return;
        }
        
        var ajax = new AjaxClient();
        ajax.addParam("phrase", phrase);
        ajax.addParam("type", this.type);
        ajax.onSuccess = this.dataOnSuccess.handler(this);
        ajax.callbackFunction = callbackFunction;
        ajax.post(this.sourceUrl);
     }
}