%@page session="true"%><%@ taglib uri="http://www.e-deal.com/taglib/fl" prefix="fl" %><%
response.setContentType("application/x-javascript");
%>
var eraseFaxOnSubmit = false;
function doOnLoad() {
var f = window.document.forms[0];
if (f) {
if (f.LocZip) {
f.LocZip.onchange = doZipChange;
}
if (f.LocCtrID) {
f.LocCtrID.onchange = doCountryChange;
}
if (f.LocPhone) {
f.LocPhone.onchange = doPhoneChange;
}
if (f.LocFax) {
f.LocFax.onchange = doFaxChange;
}
}
}
function matchCode() {
var countryID = document.forms[0].LocCtrID.options[document.forms[0].LocCtrID.selectedIndex].value;
var phone = doEpurePhone(document.forms[0].LocPhone.value);
var result = countryID;
result += '#' + phone.substring(0, phone.length - 3) ;
return result;
}
function doSubmit() {
if (eraseFaxOnSubmit) {
document.forms[0].LocFax.value = '';
}
return true;
}
function doZipChange() {
var f = document.forms[0];
retrieveCity(f.LocCtrID.options[f.LocCtrID.selectedIndex].value, f.LocZip.value, 'LocCity');
}
function doCountryChange() {
var f = document.forms[0];
var field = f.LocCtrID;
var oldCountry = f.country;
retrieveCity(field.options[field.selectedIndex].value, f.LocZip.value, 'LocCity');
doEpureTel(f.LocPhone, f.LocPhone, oldCountry);
doEpureTel(f.LocFax, f.LocFax, oldCountry);
//oldCountry.value = field.options[field.selectedIndex].value;
doFormatTel(f.LocPhone, ' :', field);
doFormatTel(f.LocFax, ' :', field);
}
function doPhoneChange() {
var f = document.forms[0];
var phoneField = f.LocPhone;
var faxField = f.LocFax;
var countryField = f.LocCtrID;
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.LocFax;
var countryField = f.LocCtrID;
doFormatTel(faxField, ' :', countryField);
eraseFaxOnSubmit = false;
}
function doChangeSector() {
var strActID = document.forms[0].LocActID.value;
if (strActID != '') {
window.open('/select_sector.fl?id=' + strActID + '&field=LocSector', 'ChoixSecteur', 'menubar=no,status=no,toolbar=no,scrollbars=yes,resizable=yes,width=500,height=250');
} else {
window.alert('');
}
}