var LabelSuggest = Class.create(TextSuggest, {
    
    callAjax: function() {
        new Ajax.Request('/ajax.php',
                     {
                       method:'post',
                       parameters: {
                                    request: this.id,
                                    id: this.id,
                                    pars0: this.lastRequestString,
                                    pars1: this.options.matchAnywhere,
                                    pars2: this.options.count,
                                    jetztclass: 'Labels',
                                    jetztfunction: 'searchLabelsTextcount'},                  
                       onSuccess: this.ajaxUpdate.bind(this)
                     }
                    );
        
    },

    createSuggestions: function(ajaxResponse) {
        this.suggestions = [];

        if (ajaxResponse.getElementsByTagName("data")[0].hasChildNodes() && 
            ajaxResponse.getElementsByTagName("data")[0].getElementsByTagName("success")[0].childNodes[0].nodeValue=='1' && 
            ajaxResponse.getElementsByTagName("data")[0].getElementsByTagName("labels")[0].hasChildNodes()) {
            
            var text = '';
            var value = '';
            
            for (var i=0;i<ajaxResponse.getElementsByTagName("row").length;i++) {
                text  = ajaxResponse.getElementsByTagName("row")[i].getElementsByTagName("name")[0].childNodes[0].nodeValue;
                value = ajaxResponse.getElementsByTagName("row")[i].getElementsByTagName("textcount")[0].childNodes[0].nodeValue;
                this.suggestions.push({ text: text, value:  value});
            }
        }
   }
});
