document.write("<script language='javascript' type='text/javascript' src='http://as00.estara.com/as/InitiateCall2.php?accountid=200106280449&Template=406213&ClickID='></script>");

$(document).ready(function() {
    associateEvent();
});

function associateEvent() {
    document.getElementById("PhoneTop").onkeydown = defineEvent;
}

function defineEvent(e) {
    if (!e) {
        var e = window.event;
    }
    var code = e.keyCode;
    if (code == 13) {
        validate('406213', "PhoneTop");
        return false;
    }
}

var rxPhone = /^\d{1}?[- ]?\(?\d{3}\)?[- ]?\d{3}[- ]?\d{4}$/; 	//regex for phone
var rxPhone2 = /^\(?\d{3}\)?[- ]?\d{3}[- ]?\d{4}$/; 	//regex for phone2

function validate(templateID, strPhoneID) {
    var phone = document.getElementById(strPhoneID);
    if (!phone.value.match(rxPhone)) {
        if (!phone.value.match(rxPhone2)) {
            alert('Please enter a valid phone number.  Ex: 13015551212');
        } else {
            return webCallBack('Template=' + templateID, 'phone1=1' + phone.value, 'var4=');
        }
    } else {
        return webCallBack('Template=' + templateID, 'phone1=' + phone.value, 'var4=');
    }
}
function popUp(URL, width, height) {
    day = new Date();
    id = day.getTime();
    eval("page" + id + " = window.open('" + URL + "', '" + id + "', 'toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=0,width=" + width + ",height=" + height + ",left = 200,top = 200');");
}