function matchFieldSelect (field, select, value) 
{
 // var property = value ? 'value' : 'text';
 var found = false;
  
  //Loop through the array (select[]) checking if the field value is contained in text
  //within the arrray  
  for (var i = 0; i < select.length; i++)
    
   //this will set found to true if the item has been found and break this loop
	if ((select[i].toLowerCase().indexOf(field.value.toLowerCase())==0)||(select[i].toUpperCase().indexOf(field.value.toUpperCase())==0))
	{
		found = true;
		break;
	}
    
    //Dynamic HTML (createTextRange)
	if (field.createTextRange)
	{
		//cursorKeys are a set of special characters that can be used in a search, i.e *
		var cursorKeys ="8;46;37;38;39;40;33;34;35;36;45;";
		//if key that was pressed is not a special key
		if (cursorKeys.indexOf(event.keyCode+";") == -1) 
		{
			//create text range object for old text
			var OldTextRange = field.createTextRange();
			//extract old value (Bit that is not selected)
			var oldValue = OldTextRange.text;
			//get the new value (the value found in the array)
			var newValue = found ? select[i] : oldValue;
			//if they are exactly equal do nothing
			if (newValue != field.value) 
			{
				//we want to select the text they havnt writtent themselves (autocomplete)
				//so create text range object, move to position where our auto text starts
				//amd select that part.
				field.value = newValue;
				var NewTextRange = field.createTextRange();
				NewTextRange.moveStart('character', oldValue.length);
				NewTextRange.select();
			}
		}
	}
}
