﻿function fnTrapKD(btn) 
{
    if (document.all) {
        if (event.keyCode == 13) {
            event.returnValue = false;
            event.cancel = true;
            btn.click();
        }
    }
}

function autoComplete_itemSelected(sender, e) 
{
    var text = e.get_text();
    var targetElement = sender.get_element();
    targetElement.value = text;
}

function FormatPhone(Phone) 
{
    Phone += "";
    var n = Phone.replace(/[^\d]/g, "");
    if (n.length != 10) return Phone;
    else return n.substring(0, 3) + "-" + n.substring(3, 6) + "-" + n.substring(6);
}