/*
 * jQuery UI vt_Autocomplete 1.0
 *
 * Copyright 2011, AUTHORS: Vanzotech
 * Dual licensed under the MIT or GPL Version 2 licenses. 
 * 
 * Depends:
 *	jquery.ui.autocomplete.js
 */

(function( $, undefined ){
	$.fn.vt_autocomplete = function(config){
		
		var $support = $(config.id);
		
		$(config.id+"_DECODED").autocomplete({
			source: 'index.php?stoplayout=true&fuseaction=jqAjax.'+config.source,
			minLength: 2,
			select: function( event, ui )
			{
				$support.val(ui.item.id);
			}
		}).blur(function(){
			if (this.value == "") $support.val("");
			if ($support.val() == "") $(this).val("");
		}).keypress(function(){
			$support.val("");
		});
	}
}( jQuery ));
