%@page session="true"%><%@ taglib uri="http://www.e-deal.com/taglib/fl" prefix="fl" %><%
response.setContentType("application/x-javascript");
%>
function doOnLoad() {
var f = window.document.forms[0];
if (f) {
if (f.SitZip) {
f.SitZip.onchange = doZipChange;
}
if (f.SitCtrID) {
f.SitCtrID.onchange = doCountryChange;
}
if (f.SitPhone) {
f.SitPhone.onchange = doPhoneChange;
}
if (f.SitFax) {
f.SitFax.onchange = doFaxChange;
}
}
}
function matchCode() {
var countryID = document.forms[0].SitCtrID.options[document.forms[0].SitCtrID.selectedIndex].value;
var phone = doEpurePhone(document.forms[0].SitPhone.value);
var result = countryID;
result += '#' + phone.substring(0, phone.length - 3) ;
return result;
}
function doSubmit() {
var f = document.forms[0];
f.SitMatchCode.value = matchCode();
return true;
}
function doZipChange() {
var f = document.forms[0];
retrieveCity(f.SitCtrID.options[f.SitCtrID.selectedIndex].value, f.SitZip.value, 'SitCity');
}
function doCountryChange() {
var f = document.forms[0];
var field = f.SitCtrID;
var oldCountry = f.country;
retrieveCity(field.options[field.selectedIndex].value, f.SitZip.value, 'SitCity');
doEpureTel(f.SitPhone, f.SitPhone, oldCountry);
doEpureTel(f.SitFax, f.SitFax, oldCountry);
doFormatTel(f.SitPhone, ' :', field);
doFormatTel(f.SitFax, ' :', field);
}
function doPhoneChange() {
var f = document.forms[0];
var phoneField = f.SitPhone;
var faxField = f.SitFax;
var countryField = f.SitCtrID;
if (faxField.value == '' && phoneField.value.length > 3) {
faxField.value = phoneField.value.substring(0, phoneField.value.length - 3);
}
doFormatTel(phoneField, ' :', countryField);
}
function doFaxChange() {
var f = document.forms[0];
var faxField = f.SitFax;
var countryField = f.SitCtrID;
doFormatTel(faxField, ' :', countryField);
}