document.write("<script language='javascript' type='text/javascript' src='http://as00.estara.com/as/InitiateCall2.php?accountid=200106280449&Template=224303&ClickID='></script>");

$(document).ready(function(){
	strPhoneNumber = "{tvn|Phone|(866) 681-0476}";
	strClickID = "";
	strEStaraTemplateID = "224303";
	associateEvent();
	SetSomeVariables();
});

function associateEvent() {
	var PhoneTop = $("#" + strPhoneTopID);
	PhoneTop.keydown(function(event){
		var code = event.keyCode;
		if (code == 13) {
        		// Cancel the keystroke completely
        		//window.event.returnValue = false;
        		//window.event.cancel = true;
        		validate(strEStaraTemplateID, PhoneTop, strClickID);
			// Cancel the keystroke completely
			//alert(code);
			return false;
		}
		//alert(code);
		return true;
	});
	var eStaraButton = $("input[fieldname='eStaraButton']");
	eStaraButton.click(function(){
		validate(strEStaraTemplateID, PhoneTop, strClickID);
		return false;
	});
}
 


function checksizes(){
	var browser = BrowserDetect.browser

	if(bContentChange){
		if(browser == 'Explorer'){
			document.getElementById("area").style.height='1225px';
		}else{
			document.getElementById("area").style.height='1125px';
		}
	}
}

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,PhoneElement,strClickID){
	//alert("In validation " + strPhoneTopID);
	var sPhoneNumber = PhoneElement.val();
	if(!sPhoneNumber.match(rxPhone)){
		//alert("doesn't match!");
		if(!sPhoneNumber.match(rxPhone2)){
			alert('Please enter a valid phone number.  Ex: 13015551212');
		}else{
			webCallBack('Template=' + templateID, 'phone1=1' + sPhoneNumber, 'var4=' + strClickID);
		}
	}else{
		//alert("Matches!");
		webCallBack('Template=' + templateID, 'phone1=' + sPhoneNumber, 'var4=' + strClickID);
	}
}