|
Server : Apache/2.2.22 (Unix) mod_ssl/2.2.22 OpenSSL/1.0.0-fips mod_auth_passthrough/2.1 mod_bwlimited/1.4 System : Linux server.jackjohnson.com 2.6.32-279.5.2.el6.x86_64 #1 SMP Fri Aug 24 01:07:11 UTC 2012 x86_64 User : jackjohn ( 502) PHP Version : 5.3.17 Disable Function : NONE Directory : /home/jackjohn/www/shopsite-images/en-GB/javascript/shipping/ |
Upload File : |
function checkRegistrationInfo()
{
var required_fields = new Array('contact_name', 'title', 'company_name', 'street_address',
'city', 'phone_number', 'company_url', 'email_address');
var field, value;
var country, state;
var digits = "0123456789";
var digit_count;
var digit;
var i, j;
// check for required info in text fields
for (i = 0, j = 0; i < required_fields.length; i++)
{
field = document.getElementById(required_fields[i]);
if (field.value.length == 0)
{
if (j == 0)
field.focus();
field.style.borderColor = 'red';
j++;
}
}
if (j > 0)
{
alert(fill_in_msg);
return false;
}
country = document.getElementById('country');
state = document.getElementById('state_province');
if (country.selectedIndex < 0)
{
alert_msg(country, country_msg);
return false;
}
if (state.selectedIndex < 0)
{
alert_msg(state, state_msg);
return false;
}
// postal code required for US and Canada
i = country.selectedIndex;
value = country.options[i].value;
if (value == "US" || value == "CA")
{
postal_code = document.getElementById('postal_code');
if (postal_code.value.length == 0)
{
alert_msg(postal_code, postal_code_msg);
return false;
}
}
// check for state or province if country is US or CA
i = country.selectedIndex;
value = country.options[i].value;
if (value == "US" || value == "CA")
{
if (state.selectedIndex == 0)
{
alert_msg(state, state_msg);
return false;
}
}
else
{
state.selectedIndex = 0;
// document.getElementById('postal_code').value = "";
}
// validate the email address
field = document.getElementById('email_address');
value = field.value;
if (value.length > 0 && (value.indexOf('@', 0) == -1 || value.indexOf('.', 0) == -1))
{
alert_msg(field, email_msg);
return false;
}
// validate the phone number
field = document.getElementById('phone_number');
value = field.value;
if (value.length > 0)
{
digit_count = 0;
for (i = 0; i < value.length; i++)
{
digit = value.substring(i, i + 1);
if (digits.indexOf(digit) != -1)
digit_count++;
}
if (digit_count < 10 || digit_count > 14)
{
alert_msg(field, phone_msg);
return false;
}
}
// validate the fax number
field = document.getElementById('fax_number');
value = field.value;
if (value.length > 0)
{
digit_count = 0;
for (i = 0; i < value.length; i++)
{
digit = value.substring(i, i + 1);
if (digits.indexOf(digit) != -1)
digit_count++;
}
if (digit_count < 10 || digit_count > 14)
{
alert_msg(field, fax_msg);
return false;
}
}
return true;
}
function checkInvoiceInfo()
{
var invoice_number = document.getElementById('invoice_number');
var invoice_amount = document.getElementById('invoice_amount');
var invoice_date = document.getElementById('invoice_date');
var control_id = document.getElementById('control_id');
if (invoice_number.value.length == 0)
{
alert_msg(invoice_number, enter_invoice_number);
return false;
}
if (invoice_date.value.length > 0)
{
if (check_date(invoice_date) == false)
return false;
}
else
{
alert_msg(invoice_date, enter_invoice_date);
return false;
}
if (invoice_amount.value.length == 0)
{
alert_msg(invoice_amount, enter_invoice_amount);
return false;
}
if (control_id.value.length == 0)
{
alert_msg(control_id, enter_control_id);
return false;
}
return true;
}
function checkUserInfo()
{
var userid = document.getElementById('userid');
var password = document.getElementById('password');
if (userid.value.length == 0)
{
alert_msg(userid, userid_msg);
return false;
}
if (password.value.length == 0)
{
alert_msg(password, password_msg);
return false;
}
if (password.value.length < 8)
{
alert_msg(password, length_msg);
return false;
}
return true;
}
function alert_msg(field, msg)
{
alert(msg);
field.style.borderColor = 'red';
field.focus();
}