// This code blurs and then refocuses our field.
// This is needed if we bind an AJAX call to the
// field and want ther act of selecting an
// auto-suggestion to trigger the AJAX call.
// However, this code may cause the screen to jump.

// Test before using!

// Remove focus from element causing an onblur.
// Set the [0] to the index of an element that's not the auto-suggest field.
// For example, if our auto-suggest field is the first form field, then set it to be: [1]
document.getElementsByTagName('input')[0].focus();


// Now return focus to element, causing an onblur event.
// 'as_field' comes from the appliation, and is convinience
// variable so you do not have to hard code the field name.
document.getElementById(as_field).focus(); 