var url = "dwr/autocomplete/getAutocomplete"

jQuery(document).ready(function() {
	jQuery("input#suggest13").autocomplete({
		appendTo:"body div#texts_show",
		source: function( request, response ) {					
					AutocompleteBean.getAutocomplete(request.term, function (data) 
					{
						if(data != null){
							response(
								$.map(data, function (item) 
									{							
										return {
											label: item,
											value: item
										}
									}
								)
							);
						}
					}
				);
					//alert (response);
			}
	});
});




/*$(document).ready(function() {
	$("input#selectSource").autocomplete({
		source: 'http://172.27.200.162/portal/comboDestinoToXML_JSON.do',
        parse: parseDestinoXML
    });
	function parseDestinoXML(xml){
		alert("Destination : ");
        var results = [];
        $(xml).find('destino').each(function() {
            var text = $.trim($(this).find('name').text());
            alert("Destination : "+text);
            results[results.length] = { 'data': { text: text},
                'result': text
            };
        });
        return results;
	}
});*/

$(document).ready(function() {
	var isFieldExists = $("input#selectSource").length;
	if(isFieldExists != 0){
		$("input#selectSource").autocomplete({
			source:destDataArr,
			//data:destDataArr
	        zIndex: 9999
		});
	}
});
	
