// JavaScript Document
var promoCode = QueryString.params['Promotion_Code'];
function chkFields(frm) {
	_hbLink("Check Availability (loop qual) Clicked");
	var curFrm = frm;
	var	txtareaCode = document.getElementById('area').value;
	var	txtPrefix = document.getElementById('frst_half').value;
	var	txtPhoneNumber = document.getElementById('last_half').value;
	
	if (txtareaCode == "" || txtPrefix == "" || txtPhoneNumber == "") {
		alert("Please enter in your phone number.");
		return false;
	} else {
		if (promoCode != "" && promoCode != "undefined" && promoCode != null && promoCode != " ") {
			curFrm.action ="https://www22.verizon.com/ForyourHome/GoFlow/MyVerizon/RegistrationBridge.aspx?Client=VZSA&FlowRoute=VZSA-NDSL&txtAreaCode="+txtareaCode+"&txtPrefix="+txtPrefix+"&txtPhoneNumber="+txtPhoneNumber+"&Promotion_Code="+promoCode;
			//curFrm.area.name = "txtareaCode";
			//curFrm.frst_half.name = "txtPrefix";
			//curFrm.last_half.name = "txtPhoneNumber";
			//curFrm.hidden.value = promoCode;
			//curFrm.hidden.name = "Promotion_Code";
		} else {
			curFrm.action ="https://www22.verizon.com/ForyourHome/GoFlow/MyVerizon/RegistrationBridge.aspx?Client=VZSA&FlowRoute=VZSA-NDSL&txtAreaCode="+txtareaCode+"&txtPrefix="+txtPrefix+"&txtPhoneNumber="+txtPhoneNumber;
			//curFrm.area.name = "txtareaCode";
			//curFrm.frst_half.name = "txtPrefix";
			//curFrm.last_half.name = "txtPhoneNumber";
		}
		curFrm.method = "POST";
		curFrm.submit();
		return true;
	}
}
function autoTab(e,tab) {
	var maxLen = e.getAttribute("maxlength");
	var curLen = e.value.length;
	var tb = tab;
	if (curLen == maxLen) {
		document.getElementById(tb).focus();
	}
}
