%@page session="true"%><%@ taglib uri="http://www.e-deal.com/taglib/fl" prefix="fl" %><%
response.setContentType("application/x-javascript");
%>
var eraseFaxOnSubmit = false;
var erasePerFaxOnSubmit = false;
function doOnLoad(e) {
var f = window.document.forms[0];
if (f) {
if (f.JouProZip) {
f.JouProZip.onchange = doZipChange;
}
if (f.JouProCtrID) {
f.JouProCtrID.onchange = doCountryChange;
}
if (f.JouProPhone) {
f.JouProPhone.onchange = doPhoneChange;
}
if (f.JouProFax) {
f.JouProFax.onchange = doFaxChange;
}
if (f.JouPerZip) {
f.JouPerZip.onchange = doZipChangePer;
}
if (f.JouPerCtrID) {
f.JouPerCtrID.onchange = doCountryChangePer;
}
if (f.JouPerPhone) {
f.JouPerPhone.onchange = doPhoneChangePer;
}
if (f.JouPerFax) {
f.JouPerFax.onchange = doFaxChangePer;
}
if (f.JouPerMobile) {
f.JouPerMobile.onchange = doMobileChangePer;
}
if (f.JouProMobile) {
f.JouProMobile.onchange = doMobileChange;
}
}
}
function matchCode() {
return result;
}
function doSubmit() {
var f = document.forms[0];
if (eraseFaxOnSubmit) {
f.JouProFax.value = '';
}
if (erasePerFaxOnSubmit) {
f.JouPerFax.value = '';
}
return true;
}
function doZipChange() {
var f = document.forms[0];
retrieveCity(f.JouProCtrID.options[f.JouProCtrID.selectedIndex].value, f.JouProZip.value, 'JouProCity');
}
function doCountryChange() {
var f = document.forms[0];
var field = f.JouProCtrID;
var oldCountry = f.country;
retrieveCity(field.options[field.selectedIndex].value, f.JouProZip.value, 'JouProCity');
doEpureTel(f.JouProPhone, f.JouProPhone, oldCountry);
doEpureTel(f.JouProFax, f.JouProFax, oldCountry);
doFormatTel(f.JouProPhone, ' :', field);
doFormatTel(f.JouProFax, ' :', field);
}
function doPhoneChange() {
var f = document.forms[0];
var phoneField = f.JouProPhone;
var faxField = f.JouProFax;
var countryField = f.JouProCtrID;
if (faxField.value == '' && phoneField.value.length > 3) {
faxField.value = phoneField.value.substring(0, phoneField.value.length - 3);
eraseFaxOnSubmit = true;
}
doFormatTel(phoneField, ' :', countryField);
}
function doFaxChange() {
var f = document.forms[0];
var faxField = f.JouProFax;
var countryField = f.JouProCtrID;
doFormatTel(faxField, ' :', countryField);
eraseFaxOnSubmit = false;
}
function doZipChangePer() {
var f = document.forms[0];
retrieveCity(f.JouPerCtrID.options[f.JouPerCtrID.selectedIndex].value, f.JouPerZip.value, 'JouPerCity');
}
function doCountryChangePer() {
var f = document.forms[0];
var field = f.JouPerCtrID;
var oldCountry = f.country;
retrieveCity(field.options[field.selectedIndex].value, f.JouPerZip.value, 'JouPerCity');
doEpureTel(f.JouPerPhone, f.JouPerPhone, oldCountry);
doEpureTel(f.JouPerFax, f.JouPerFax, oldCountry);
doFormatTel(f.JouPerPhone, ' :', field);
doFormatTel(f.JouPerFax, ' :', field);
}
function doPhoneChangePer() {
var f = document.forms[0];
var phoneField = f.JouPerPhone;
var faxField = f.JouPerFax;
var countryField = f.JouPerCtrID;
if (faxField.value == '' && phoneField.value.length > 3) {
faxField.value = phoneField.value.substring(0, phoneField.value.length - 3);
erasePerFaxOnSubmit = true;
}
doFormatTel(phoneField, ' :', countryField);
}
function doFaxChangePer() {
var f = document.forms[0];
var faxField = f.JouPerFax;
var countryField = f.JouPerCtrID;
doFormatTel(faxField, ' :', countryField);
erasePerFaxOnSubmit = false;
}
function doMobileChangePer() {
var f = document.forms[0];
var phoneField = f.JouPerMobile;
var countryField = f.JouPerCtrID;
doFormatTel(phoneField, ' :', countryField);
}
function doMobileChange() {
var f = document.forms[0];
var phoneField = f.JouProMobile;
var countryField = f.JouProCtrID;
doFormatTel(phoneField, ' :', countryField);
}