var store = new _AC_SimpleStore([],
	function(find,callback) {		
		var url = 'my/ajax/tagsdata';
		if (typeof Gallery.contextPath != "undefined"){
			url = Gallery.contextPath + url;
		}	
		AjaxRequest.post({
			'url':url,
			'generateUniqueUrl': false,
			'parameters': {'find':find},
			'onSuccess': function(req) {
							callback(eval("(" + req.responseText + ")"));
			},
			'onError': function (req) {
							callback([]);
			}
		});
	}
);

function initTagsAutocomplete(contextPath) {
	Gallery.contextPath = contextPath;
	_auto_complete_setup();
	_auto_complete_suggestion_add( 
		function(node, keyEvent) {
			return (node.id=="tagNames") ? store:null;
	    }
	);
}

