{if $field.attributes.id}
	{$fieldId = $field.attributes.id}
{else}
	{$fieldId = uniqid()}
{/if}
<input type="text" id="{$fieldId}"
	{foreach from=$field.attributes key=attributeName item=attributeValue}
		{if $attributeName} {$attributeName}="{$attributeValue}"{else} {$attributeValue} {/if}
	{/foreach}
/>

{if $field.autocomplete.autocompleteFieldValue &&  $field.autocomplete.autocompleteFieldValue!='this'}
	<input type="hidden" name="{$field.autocomplete.autocompleteFieldValue}" id="{$field.autocomplete.autocompleteFieldValue}" value="{$field.autocomplete.value}"  />
{/if}
{if $field.autocomplete.autocompleteFieldCode && $field.autocomplete.autocompleteFieldCode!='this'}
	<input type="hidden" name="{$field.autocomplete.autocompleteFieldCode}" id="{$field.autocomplete.autocompleteFieldCode}" value="{$field.autocomplete.code}"  />
{/if}

<script>
	new DCsAutocomplete(
		{ldelim}
			{if $field.autocomplete.autocompleteFieldValue}
				{if $field.autocomplete.autocompleteFieldValue=='this'}
					autocompleteFieldValue:"{$fieldId}",
				{else}
					autocompleteFieldValue:"{$field.autocomplete.autocompleteFieldValue}",
				{/if}
			{/if}
			{if $field.autocomplete.autocompleteFieldCode}
				{if $field.autocomplete.autocompleteFieldCode=='this'}
					autocompleteFieldCode:"{$fieldId}",
				{else}
					autocompleteFieldCode:"{$field.autocomplete.autocompleteFieldCode}",
				{/if}
			{/if}

			{if $field.autocomplete.onSelect} onSelect:'{$field.autocomplete.onSelect}', {/if}
			{if $field.autocomplete.onCancel} onCancel:'{$field.autocomplete.onCancel}', {/if}
			{if $field.autocomplete.clearOnSelect} clearOnSelect:true, {/if}
			{if $field.autocomplete.clearOnCancel} clearOnCancel:true, {/if}
			{if $field.autocomplete.debug} debug:true,{/if}
			{if $field.autocomplete.clearButton} clearButton:true,{/if}
			{if $field.autocomplete.extendedXML} extendedXML:true,{/if}
			highlight:true,
			{if $field.autocomplete.resultsPerPage} resultsPerPage:{$field.autocomplete.resultsPerPage+0}, {/if}
			{if $field.autocomplete.offsetX} offsetX:{$field.autocomplete.offsetX+0}, {/if}
			{if $field.autocomplete.offsetY} offsetY:{$field.autocomplete.offsetY+0}, {/if}
			{if $field.autocomplete.width} width:'{$field.autocomplete.width}px', {/if}
			{if $field.autocomplete.noResultsText} noResultsText:'{$field.autocomplete.noResultsText}', {/if}

			{if $field.autocomplete.extraFilters} extraFilters:'{$field.autocomplete.extraFilters}', {/if}
			{if $field.autocomplete.gatherExtraFilters} gatherExtraFilters:'{$field.autocomplete.gatherExtraFilters}', {/if}

			autocompleteField:"{$fieldId}",
			url:"{$field.autocomplete.url}"


		{rdelim}
	);
</script>

{if $field.details != ""}
	{$field.details}
{/if}
