
// this is the common file for the Lakeside Global Website

 
// check content of form, the full name, e-mail address and
// phone number and url, etc
function register_verified(da_reg_form) {
	
  var form_process = 2;
  var language_entered = 1;

	
  var register_req_array = new Array();
  register_req_array[0] = da_reg_form.register_name.value;
  register_req_array[1] = da_reg_form.register_surname.value;
  register_req_array[2] = da_reg_form.register_area_code.value;
  register_req_array[3] = da_reg_form.register_area_phone.value;
  register_req_array[4] = da_reg_form.register_local_num.value;
  register_req_array[5] = da_reg_form.register_email.value;
  register_req_array[6] = da_reg_form.register_address.value;


  for (i = 0; i < register_req_array.length; i++) {
    if (register_req_array[i] == "") {
      alert('You have not filled in all the required fields, Name, Surname, Address, Phone Number, E-Mail, have to be filled, please check and rekey.');
	  document.lakeside_registration.register_name.focus();	      
	  return false;
    }
  }
  
  
    // recheck to make sure that the e-mail is correctly formated
  var this_valid_email = checkEMail(da_reg_form.register_email.value, form_process, language_entered);
  if (!this_valid_email){
    return false;
  }


  // recheck the phone number to see if any error are still there
  var this_valid_area_code = checkPhone(da_reg_form.register_area_code.value, form_process);
  if (!this_valid_area_code) {
	return false;  
  }

  // recheck the phone number to see if any error are still there
  var this_valid_phone = checkPhone(da_reg_form.register_area_phone.value, form_process);
  if (!this_valid_phone) {
	return false;  
  }

  // recheck the phone number to see if any error are still there
  var this_postal_code = checkPostal(da_reg_form.register_postal_code.value, da_reg_form.register_country.value, form_process);
  if (!this_postal_code) {
	return false;  
  }

  // recheck the phone number to see if any error are still there
  var this_valid_phone_local = checkPhoneLocal(da_reg_form.register_local_num.value);
  if (!this_valid_phone_local) {
	return false;  
  }

  // recheck to see that they have not entered specific database commands in some fields
  var this_valid_text_entry = checkTextData(da_reg_form.register_name.value.toUpperCase());
  if (!this_valid_text_entry) {
	return false;  
  }

  // recheck to see that they have not entered specific database commands in some fields
  var this_valid_text_entry = checkTextData(da_reg_form.register_address.value.toUpperCase());
  if (!this_valid_text_entry) {
	return false;  
  }
 
 // recheck to see that they have not entered specific database commands in some fields
  var this_valid_text_entry = checkTextData(da_reg_form.register_city.value.toUpperCase());
  if (!this_valid_text_entry) {
	return false;  
  }
  

}


// check content of form, the full name, e-mail address and
// phone number and url, etc from the customer request
function cust_request_verified(da_cust_form) {


  var form_process = 1;
  var language_processed = 1;
  var process_area = 1;
	
  var customer_req_array = new Array();
  customer_req_array[0] = da_cust_form.cust_comp_name.value;
  customer_req_array[1] = da_cust_form.cust_surname.value;
  customer_req_array[2] = da_cust_form.cust_phone_full_number.value;
  customer_req_array[3] = da_cust_form.cust_email.value;
  customer_req_array[4] = da_cust_form.cust_address.value;

  for (i = 0; i < customer_req_array.length; i++) {
    if (customer_req_array[i] == "") {
      alert('You have not filled in all the required fields, Company Name, Surname, Address, Phone Number, E-Mail, have to be filled, please check and rekey.');
	  document.cust_request.cust_comp_name.focus();	      
	  return false;
    }
  }
  
  // load the values of the checkboxes into an array
  var checkbox_selected = 0;

  var customer_req_array_checked = new Array();
  customer_req_array_checked[0] = da_cust_form.mustard_brown;
  customer_req_array_checked[1] = da_cust_form.mustard_oriental;
  customer_req_array_checked[2] = da_cust_form.mustard_yellow;
  customer_req_array_checked[3] = da_cust_form.peas_green;
  customer_req_array_checked[4] = da_cust_form.peas_yellow;
  customer_req_array_checked[5] = da_cust_form.red_lentils_small;
  customer_req_array_checked[6] = da_cust_form.red_lentils_xsmall;
  customer_req_array_checked[7] = da_cust_form.green_lentils_large;
  customer_req_array_checked[8] = da_cust_form.green_lentils_med;
  customer_req_array_checked[9] = da_cust_form.green_lentils_small;
  customer_req_array_checked[10] = da_cust_form.flaxseed_brown;
  customer_req_array_checked[11] = da_cust_form.flaxseed_yellow;
  customer_req_array_checked[12] = da_cust_form.canary_seed;
  customer_req_array_checked[13] = da_cust_form.coriander;
  customer_req_array_checked[14] = da_cust_form.caraway;
  customer_req_array_checked[15] = da_cust_form.other;

  for (i = 0; i < customer_req_array_checked.length; i++) {
    if (customer_req_array_checked[i].checked) {
      checkbox_selected = 1;
    }
  }


  // if no checkbox was selected
  if (checkbox_selected == 0) {
      alert('You have not filled in one of the checkboxes, please check and rekey.');
	  document.cust_request.mustard_brown.focus();	      
	  return false;	  
  }
  
  
  
  
    // recheck to make sure that the e-mail is correctly formated
  var this_valid_email = checkEMail(da_cust_form.cust_email.value, form_process, language_processed);
  if (!this_valid_email){
    return false;
  }


  // recheck the phone number to see if any error are still there
  var this_valid_area_code = checkFullPhone(da_cust_form.cust_phone_full_number.value, language_processed);
  if (!this_valid_area_code) {
	return false;  
  }
  
  if (da_cust_form.cust_cell_full_number.value != null) {
  // recheck the phone number to see if any error are still there
    var this_valid_area_code = checkFullPhone(da_cust_form.cust_cell_full_number.value, language_processed);
    if (!this_valid_area_code) {
	  return false;  
    }

  }
  
  if (da_cust_form.cust_fax_full_number.value != null) {
  // recheck the phone number to see if any error are still there
    var this_valid_area_code = checkFullPhone(da_cust_form.cust_fax_full_number.value, language_processed);
    if (!this_valid_area_code) {
	  return false;  
    }

  }

/*  
  // recheck the phone number to see if any error are still there
  var this_valid_area_code = checkPhone(da_cust_form.cust_area_code.value, form_process);
  if (!this_valid_area_code) {
	return false;  
  }

  // recheck the phone number to see if any error are still there
  var this_valid_phone = checkPhone(da_cust_form.cust_area_phone.value, form_process);
  if (!this_valid_phone) {
	return false;  
  }
*/
  // recheck the phone number to see if any error are still there
  var this_postal_code = checkPostal(da_cust_form.cust_postal_zip.value, da_cust_form.cust_country.value, form_process);
  if (!this_postal_code) {
	return false;  
  }
/*
  // recheck the phone number to see if any error are still there
  var this_valid_phone_local = checkPhoneLocal(da_cust_form.cust_local_num.value);
  if (!this_valid_phone_local) {
	return false;  
  }
*/


 // recheck to see that they have not entered specific database commands in some fields
  var this_valid_text_entry = checkSpecialTextData(da_cust_form.cust_first_name.value.toUpperCase(), process_area);
  if (!this_valid_text_entry) {
	return false;  
  }



 // recheck to see that they have not entered specific database commands in some fields
  var this_valid_text_entry = checkSpecialTextData(da_cust_form.cust_address.value.toUpperCase(), process_area);
  if (!this_valid_text_entry) {
	return false;  
  } 

 // recheck to see that they have not entered specific database commands in some fields
  var this_valid_text_entry = checkSpecialTextData(da_cust_form.cust_city.value.toUpperCase(), process_area);
  if (!this_valid_text_entry) {
	return false;  
  } 


 // recheck to see that they have not entered specific database commands in some fields
  var this_valid_text_entry = checkSpecialTextData(da_cust_form.cust_comments_info.value.toUpperCase(), process_area);
  if (!this_valid_text_entry) {
	return false;  
  } 

 // recheck to see that they have not entered specific database commands in some fields
  var this_valid_text_entry = checkSpecialTextData(da_cust_form.cust_comp_name.value.toUpperCase(), process_area);
  if (!this_valid_text_entry) {
	return false;  
  } 
  
}





// check french content content of form, the full name, e-mail address and
// phone number and url, etc from the customer request
function cust_fr_request_verified(da_cust_form) {


  var form_process = 1;
  var language_processed = 2;
  var process_area = 1;
	
  var customer_req_array = new Array();
  customer_req_array[0] = da_cust_form.cust_comp_name.value;
  customer_req_array[1] = da_cust_form.cust_surname.value;
  customer_req_array[2] = da_cust_form.cust_phone_full_number.value;
  customer_req_array[3] = da_cust_form.cust_email.value;
  customer_req_array[4] = da_cust_form.cust_address.value;

  for (i = 0; i < customer_req_array.length; i++) {
    if (customer_req_array[i] == "") {
      alert('Vous navez pas complété tous les champs priés, nom de compagnie, nom de famille, adresse, numéro de téléphone, email, devez être rempli, svp pour vérifier et réintroduire.');
	  document.cust_request.cust_comp_name.focus();	      
	  return false;
    }
  }
  
  // load the values of the checkboxes into an array
  var checkbox_selected = 0;

  var customer_req_array_checked = new Array();
  customer_req_array_checked[0] = da_cust_form.mustard_brown;
  customer_req_array_checked[1] = da_cust_form.mustard_oriental;
  customer_req_array_checked[2] = da_cust_form.mustard_yellow;
  customer_req_array_checked[3] = da_cust_form.peas_green;
  customer_req_array_checked[4] = da_cust_form.peas_yellow;
  customer_req_array_checked[5] = da_cust_form.red_lentils_small;
  customer_req_array_checked[6] = da_cust_form.red_lentils_xsmall;
  customer_req_array_checked[7] = da_cust_form.green_lentils_large;
  customer_req_array_checked[8] = da_cust_form.green_lentils_med;
  customer_req_array_checked[9] = da_cust_form.green_lentils_small;
  customer_req_array_checked[10] = da_cust_form.flaxseed_brown;
  customer_req_array_checked[11] = da_cust_form.flaxseed_yellow;
  customer_req_array_checked[12] = da_cust_form.canary_seed;
  customer_req_array_checked[13] = da_cust_form.coriander;
  customer_req_array_checked[14] = da_cust_form.caraway;
  customer_req_array_checked[15] = da_cust_form.other;

  for (i = 0; i < customer_req_array_checked.length; i++) {
    if (customer_req_array_checked[i].checked) {
      checkbox_selected = 1;
    }
  }


  // if no checkbox was selected
  if (checkbox_selected == 0) {
      alert('Vous n\'avez pas complété un des checkboxes, svp vérifiez et réintroduisez.');
	  document.cust_request.mustard_brown.focus();	      
	  return false;	  
  }
  
 
  // recheck the phone number to see if any error are still there
  var this_valid_area_code = checkFullPhone(da_cust_form.cust_phone_full_number.value, language_processed);
  if (!this_valid_area_code) {
	return false;  
  }    


  if (da_cust_form.cust_cell_full_number.value != null) {
  // recheck the phone number to see if any error are still there
    var this_valid_area_code = checkFullPhone(da_cust_form.cust_cell_full_number.value, language_processed);
    if (!this_valid_area_code) {
	  return false;  
    }

  }


  if (da_cust_form.cust_fax_full_number.value != null) {
  // recheck the phone number to see if any error are still there
    var this_valid_area_code = checkFullPhone(da_cust_form.cust_fax_full_number.value, language_processed);
    if (!this_valid_area_code) {
	  return false;  
    }

  }


    // recheck to make sure that the e-mail is correctly formated
  var this_valid_email = checkEMail(da_cust_form.cust_email.value, form_process, language_processed);
  if (!this_valid_email){
    return false;
  }

/*
  // recheck the phone number to see if any error are still there
  var this_valid_area_code = checkPhone(da_cust_form.cust_area_code.value, form_process);
  if (!this_valid_area_code) {
	return false;  
  }

  // recheck the phone number to see if any error are still there
  var this_valid_phone = checkPhone(da_cust_form.cust_area_phone.value, form_process);
  if (!this_valid_phone) {
	return false;  
  }
*/


  // recheck the phone number to see if any error are still there
  var this_postal_code = checkPostal(da_cust_form.cust_postal_zip.value, da_cust_form.cust_country.value, form_process);
  if (!this_postal_code) {
	return false;  
  }


/*
  // recheck the phone number to see if any error are still there
  var this_valid_phone_local = checkPhoneLocal(da_cust_form.cust_local_num.value);
  if (!this_valid_phone_local) {
	return false;  
  }
*/


 // recheck to see that they have not entered specific database commands in some fields
  var this_valid_text_entry = checkSpecialTextData(da_cust_form.cust_first_name.value.toUpperCase(), process_area);
  if (!this_valid_text_entry) {
	return false;  
  }



 // recheck to see that they have not entered specific database commands in some fields
  var this_valid_text_entry = checkSpecialTextData(da_cust_form.cust_address.value.toUpperCase(), process_area);
  if (!this_valid_text_entry) {
	return false;  
  } 


 // recheck to see that they have not entered specific database commands in some fields
  var this_valid_text_entry = checkSpecialTextData(da_cust_form.cust_city.value.toUpperCase(), process_area);
  if (!this_valid_text_entry) {
	return false;  
  } 


 // recheck to see that they have not entered specific database commands in some fields
  var this_valid_text_entry = checkSpecialTextData(da_cust_form.cust_comments_info.value.toUpperCase(), process_area);
  if (!this_valid_text_entry) {
	return false;  
  } 

 // recheck to see that they have not entered specific database commands in some fields
  var this_valid_text_entry = checkSpecialTextData(da_cust_form.cust_comp_name.value.toUpperCase(), process_area);
  if (!this_valid_text_entry) {
	return false;  
  } 
  
}






// check spanish content content of form, the full name, e-mail address and
// phone number and url, etc from the customer request
function cust_spn_request_verified(da_cust_form) {


  var form_process = 1;
  var language_processed = 3;
  var process_area = 1;
	
  var customer_req_array = new Array();
  customer_req_array[0] = da_cust_form.cust_comp_name.value;
  customer_req_array[1] = da_cust_form.cust_surname.value;
  customer_req_array[2] = da_cust_form.cust_phone_full_number.value;
  customer_req_array[3] = da_cust_form.cust_email.value;
  customer_req_array[4] = da_cust_form.cust_address.value;

  for (i = 0; i < customer_req_array.length; i++) {
    if (customer_req_array[i] == "") {
      alert('Usted no ha completado todos los campos requeridos, nombre de compañía, apellido, dirección, número de teléfono, email, tiene que ser llenado, para comprobar y para reintroducir por favor.');
	  document.cust_request.cust_comp_name.focus();	      
	  return false;
    }
  }
  
  // load the values of the checkboxes into an array
  var checkbox_selected = 0;

  var customer_req_array_checked = new Array();
  customer_req_array_checked[0] = da_cust_form.mustard_brown;
  customer_req_array_checked[1] = da_cust_form.mustard_oriental;
  customer_req_array_checked[2] = da_cust_form.mustard_yellow;
  customer_req_array_checked[3] = da_cust_form.peas_green;
  customer_req_array_checked[4] = da_cust_form.peas_yellow;
  customer_req_array_checked[5] = da_cust_form.red_lentils_small;
  customer_req_array_checked[6] = da_cust_form.red_lentils_xsmall;
  customer_req_array_checked[7] = da_cust_form.green_lentils_large;
  customer_req_array_checked[8] = da_cust_form.green_lentils_med;
  customer_req_array_checked[9] = da_cust_form.green_lentils_small;
  customer_req_array_checked[10] = da_cust_form.flaxseed_brown;
  customer_req_array_checked[11] = da_cust_form.flaxseed_yellow;
  customer_req_array_checked[12] = da_cust_form.canary_seed;
  customer_req_array_checked[13] = da_cust_form.coriander;
  customer_req_array_checked[14] = da_cust_form.caraway;
  customer_req_array_checked[15] = da_cust_form.other;

  for (i = 0; i < customer_req_array_checked.length; i++) {
    if (customer_req_array_checked[i].checked) {
      checkbox_selected = 1;
    }
  }


  // if no checkbox was selected
  if (checkbox_selected == 0) {
      alert('Usted no ha completado uno de los checkboxes, por favor comprueba y lo reintroduce.');
	  document.cust_request.mustard_brown.focus();	      
	  return false;	  
  }
  
   

  // recheck the phone number to see if any error are still there
  var this_valid_area_code = checkFullPhone(da_cust_form.cust_phone_full_number.value, language_processed);
  if (!this_valid_area_code) {
	return false;  
  }  

  if (da_cust_form.cust_cell_full_number.value != null) {
  // recheck the phone number to see if any error are still there
    var this_valid_area_code = checkFullPhone(da_cust_form.cust_cell_full_number.value, language_processed);
    if (!this_valid_area_code) {
	  return false;  
    }

  }
  
  if (da_cust_form.cust_fax_full_number.value != null) {
  // recheck the phone number to see if any error are still there
    var this_valid_area_code = checkFullPhone(da_cust_form.cust_fax_full_number.value, language_processed);
    if (!this_valid_area_code) {
	  return false;  
    }

  }



    // recheck to make sure that the e-mail is correctly formated
  var this_valid_email = checkEMail(da_cust_form.cust_email.value, form_process, language_processed);
  if (!this_valid_email){
    return false;
  }

/*
  // recheck the phone number to see if any error are still there
  var this_valid_area_code = checkPhone(da_cust_form.cust_area_code.value, form_process);
  if (!this_valid_area_code) {
	return false;  
  }

  // recheck the phone number to see if any error are still there
  var this_valid_phone = checkPhone(da_cust_form.cust_area_phone.value, form_process);
  if (!this_valid_phone) {
	return false;  
  }
*/
  // recheck the phone number to see if any error are still there
  var this_postal_code = checkPostal(da_cust_form.cust_postal_zip.value, da_cust_form.cust_country.value, form_process);
  if (!this_postal_code) {
	return false;  
  }

/*
  // recheck the phone number to see if any error are still there
  var this_valid_phone_local = checkPhoneLocal(da_cust_form.cust_local_num.value);
  if (!this_valid_phone_local) {
	return false;  
  }
*/

 
  
 // recheck to see that they have not entered specific database commands in some fields
  var this_valid_text_entry = checkSpecialTextData(da_cust_form.cust_first_name.value.toUpperCase(), process_area);
  if (!this_valid_text_entry) {
	return false;  
  }
  
 // recheck to see that they have not entered specific database commands in some fields
  var this_valid_text_entry = checkSpecialTextData(da_cust_form.cust_address.value.toUpperCase(), process_area);
  if (!this_valid_text_entry) {
	return false;  
  } 

 // recheck to see that they have not entered specific database commands in some fields
  var this_valid_text_entry = checkSpecialTextData(da_cust_form.cust_city.value.toUpperCase(), process_area);
  if (!this_valid_text_entry) {
	return false;  
  } 

 // recheck to see that they have not entered specific database commands in some fields
  var this_valid_text_entry = checkSpecialTextData(da_cust_form.cust_comments_info.value.toUpperCase(), process_area);
  if (!this_valid_text_entry) {
	return false;  
  } 

 // recheck to see that they have not entered specific database commands in some fields
  var this_valid_text_entry = checkSpecialTextData(da_cust_form.cust_comp_name.value.toUpperCase(), process_area);
  if (!this_valid_text_entry) {
	return false;  
  } 
}



// check content of form, the full name, e-mail address and
// phone number and url, etc
function prod_request_verified(da_reg_form) {
	
  var form_process = 3;
  var language_processed = 1;
  var process_area = 4;
	
  var prod_req_array = new Array();
  prod_req_array[0] = da_reg_form.prod_first_name.value;
  prod_req_array[1] = da_reg_form.prod_surname.value;
  prod_req_array[2] = da_reg_form.prod_phone_full_number.value;
  prod_req_array[3] = da_reg_form.prod_email.value;
  prod_req_array[4] = da_reg_form.prod_address.value;


  for (i = 0; i < prod_req_array.length; i++) {
    if (prod_req_array[i] == "") {
      alert('You have not filled in all the required fields, Name, Surname, Address, Phone Number, E-Mail, have to be filled, please check and rekey.');
	  document.producer_sales.prod_first_name.focus();	      
	  return false;
    }
  }
  

  // recheck to make sure that the e-mail is correctly formated
  var this_valid_email = checkEMail(da_reg_form.prod_email.value, form_process, language_processed);
  if (!this_valid_email){
    return false;
  }

  // recheck the phone number to see if any error are still there
  var this_valid_area_code = checkFullPhone(da_reg_form.prod_phone_full_number.value, language_processed);
  if (!this_valid_area_code) {
	return false;  
  }  

  if (da_reg_form.prod_cell_full_number.value != null) {
  // recheck the phone number to see if any error are still there
    var this_valid_area_code = checkFullPhone(da_reg_form.prod_cell_full_number.value, language_processed);
    if (!this_valid_area_code) {
	  return false;  
    }
  }
  
  if (da_reg_form.prod_fax_full_number.value != null) {
  // recheck the phone number to see if any error are still there
    var this_valid_area_code = checkFullPhone(da_reg_form.prod_fax_full_number.value, language_processed);
    if (!this_valid_area_code) {
	  return false;  
    }
  }


 // recheck to see that they have not entered specific database commands in some fields
  var this_valid_text_entry = checkSpecialTextData(da_reg_form.prod_comments_info.value.toUpperCase(), process_area);
  if (!this_valid_text_entry) {
	return false;  
  }

 // recheck to see that they have not entered specific database commands in some fields
  var this_valid_text_entry = checkSpecialTextData(da_reg_form.prod_company_name.value.toUpperCase(), process_area);
  if (!this_valid_text_entry) {
	return false;  
  }
  
 // recheck to see that they have not entered specific database commands in some fields
  var this_valid_text_entry = checkSpecialTextData(da_reg_form.prod_address.value.toUpperCase(), process_area);
  if (!this_valid_text_entry) {
	return false;  
  }

 // recheck to see that they have not entered specific database commands in some fields
  var this_valid_text_entry = checkSpecialTextData(da_reg_form.prod_city.value.toUpperCase(), process_area);
  if (!this_valid_text_entry) {
	return false;  
  }

 // recheck to see that they have not entered specific database commands in some fields
  var this_valid_text_entry = checkSpecialTextData(da_reg_form.prod_postal_zip.value.toUpperCase(), process_area);
  if (!this_valid_text_entry) {
	return false;  
  }

 // recheck to see that they have not entered specific database commands in some fields
  var this_valid_text_entry = checkSpecialTextData(da_reg_form.prod_first_name.value.toUpperCase(), process_area);
  if (!this_valid_text_entry) {
	return false;  
  }
  
 // recheck to see that they have not entered specific database commands in some fields
  var this_valid_text_entry = checkSpecialTextData(da_reg_form.prod_surname.value.toUpperCase(), process_area);
  if (!this_valid_text_entry) {
	return false;  
  }  

}



// check content of form, the full name, e-mail address and
// phone number and url, etc
function search_verified(search_form) {

  // recheck to see that they have not entered specific database commands in some fields
  var this_valid_text_entry = checkTextSearchData(search_form.search_info.value.toUpperCase());
  if (!this_valid_text_entry) {
	return false;  
  }

}


// this function will check the phone number group against a regular Expression
// to see if it is valid.  
function checkFullPhone(phone_num, form_process) {
  var msg = "That is not a valid phone number. Must not contain characters. Please re-type it.";
  var fr_mess = "Ce n'est pas un numéro de téléphone valide. Nécessité ne pas contenir des caractères. Veuillez le retaper à la machine.";
  var spn_mess = "Eso no es un número de teléfono válido. Necesidad no contener caracteres. Escríbalo de nuevo por favor a máquina.";

  var ValidChars = "0123456789 .-()+NS";
  var IsNumber = true;
  var Char;
  
  phone_num = phone_num.toUpperCase();

 
  for (i = 0; i < phone_num.length && IsNumber == true; i++) { 
    Char = phone_num.charAt(i); 
//alert ('just into checking full phone function.');	

//    if (Char.value != null) {

      if (ValidChars.indexOf(Char) == -1) {
//alert ('found a character');	

        if (form_process == 1) {
          alert(msg);
          document.cust_request.cust_phone_full_number.focus();		
	    } else {
		  if (form_process == 2) {
            alert(fr_mess);
            document.cust_request.cust_phone_full_number.focus();	
	      } else {
            alert(spn_mess);
            document.cust_request.cust_phone_full_number.focus();	
	      }
	    }
        IsNumber = false;
	  }
//    }

  }
//alert ('just after checking this really big humongous full phone function.');	
  return IsNumber;
   
}



// this function will check the phone number group against a regular Expression
// to see if it is valid.  
function checkPhone(phone_num, form_process) {
  var msg = "That is not a valid 3 number group/area phone number. Please re-type it.";

  // Check to see if the phone number has been entered properly
  var checked_phone = new RegExp("[0-9][0-9][0-9]");


  // checking the phone number against a regular expression
  if (phone_num.match(checked_phone) != null) {
    return true;  
  } else {
    alert(msg);
	
    if (form_process == 2) {
      document.lakeside_registration.register_area_code.focus();		
	} else {
      document.lakeside_registration.area_code.focus();	
	}
    return false;
  }
}



// this function will check the phone number local against a regular Expression
// to see if it is valid.  
function checkPhoneLocal(phone_num, form_process) {
  var msg = "That is not a valid 4 number local phone number. Please re-type it.";

  // Check to see if the phone number has been entered properly
  var checked_phone_Local = new RegExp("[0-9][0-9][0-9][0-9]");


  // checking the phone number against a regular expression
  if (phone_num.match(checked_phone_Local) != null) {
    return true;  
  } else {
    alert(msg);
	
    if (form_process == 2) {
	  document.lakeside_registration.register_local_num.focus();		
	} else {
	  document.lakeside_registration.local_phone.focus();
	}
    return false;
  }
}


// this function will check the email information for the @ sign and the 
// period.  Also the @ sign could not be at the start of the email address
// or the period be anywhere near the end of the address.
function checkEMail(email_address, form_process, language_type) {
  // set up message variables
  var msg1 = 'You have entered an e-mail address with an improper "@", please rekey.';
  var msg2 = 'You have entered an e-mail address with an improper ".", please rekey.';
  
  var msg3 = 'Vous avez écrit un email address avec un inexact "@" , réintroduisez svp.';
  var msg4 = 'Vous avez écrit un email address avec un inexact "." , réintroduisez svp.';
  
  var msg5 = 'Usted ha incorporado un email address con un incorrecto "@", reintroduzca por favor.';
  var msg6 = 'Usted ha incorporado un email address con un incorrecto ".", reintroduzca por favor.';
  

  if (email_address != '') {
    // check for the @ sign in the field
    if ((email_address.indexOf('@') == -1)||
        (email_address.charAt(0) == '@')||
	    (email_address.charAt(email_address.length-1) == '@')) {

// language is english
      if (language_type == 1) {
        alert(msg1);
	  } else {
	    if (language_type == 2) {
          alert(msg3);			
		} else {
		  alert(msg5);
		}
	  }

// process coming from different part of pages
      if (form_process == 2) {
        document.lakeside_registration.register_email.focus();	  
	  } else {
		if (form_process == 3) {
          document.producer_sales.prod_email.focus();			
		} else {
          document.cust_request.cust_email.focus();
		}
	  }
      return false;
    }
	
    // check for the "period" in the second portion of the info
    if ((email_address.indexOf('.') == -1)||
        (email_address.charAt(0) == '.')||
	    (email_address.charAt(email_address.length-1) == '.')||
  	    (email_address.charAt(email_address.length-2) == '.')) {

// language is english
      if (language_type == 1) {
        alert(msg2);
	  } else {
	    if (language_type == 2) {
          alert(msg4);			
		} else {
		  alert(msg6);
		}
	  }
	  
      if (form_process == 2) {
        document.lakeside_registration.register_email.focus();	  
	  } else {
		if (form_process == 3) {
          document.producer_sales.prod_email.focus();	
		} else {
		  document.cust_request.cust_email.focus();
		}
	  }
      return false;
    }
  }
  return true;	
}




// this function will check the postal code to make sure that they have
// entered the correct sequence of letters and numbers
function checkPostal(postal_Info, country_name, form_process) {
  // set up message variables

  var postal_mess2 = 'You have entered an incorrect postal code, please rekey.';
  var postal_us_mess2 = 'You have entered an incorrect zip code, please rekey.';
  
  var name_Canada = 'Canada';
  var name_US = 'United States';
  var name_incorrect = 'incorrect';


  // set up the regular expression
  var checked_Postal_End = new RegExp("[A-Z][0-9][A-Z] [0-9][A-Z][0-9]");
  
  var check_us_Zip = new RegExp("[0-9][0-9][0-9][0-9][0-9]");

  postal_Info = postal_Info.toUpperCase();
  
  if (country_name.match(name_Canada) != null) {

// checking the start postal against a regular expression
    if (postal_Info.match(checked_Postal_End) != null) {
	  return true;  
    } else {
      alert(postal_mess2);

// called from either the members_registration form, or the lakeside_registration pages, 2 is members_registration
      if (form_process == 2) {
        document.lakeside_registration.register_postal_code.focus();
	  } else {
        document.lakeside_registration.postal_code.focus();	
	  }
	
      return false;
	} 

  } else {
	  
    if (country_name.match(name_US) != null) {

//alert ('just into US check postal function.');

      if (postal_Info.match(check_us_Zip) != null) {
//alert ('just into true check of zip code');
	    return true;
	  } else {
//alert ('just into false check of zip code');
        alert(postal_us_mess2);

// called from either the members_registration form, or the lakeside_registration pages, 2 is members_registration
        if (form_process == 2) {
          document.lakeside_registration.register_postal_code.focus();
	    } else {
          document.lakeside_registration.postal_code.focus();	
	    }	  
	    return false;
	  }
    } else {
      return true;
    }
	  
  }

}



// change the information to uppercase for the postal code
function changeCase(upper_Postal) {
    upper_Postal = upper_Postal.toUpperCase();
	return upper_Postal;
}



// check to make sure that the data entered in some text fields does not contain
// any commands that can be used against databases in mysql
function checkTextData(sText) {

  var msg1 = 'You may not use certain command words such as SELECT in these fields, please re-key.';   
  var msg2 = 'You may not use certain command words such as DROP in these fields, please re-key.'; 
  var msg3 = 'You may not use certain command words such as DELETE in these fields, please re-key.'; 
  var msg4 = 'You may not use certain command words such as INSERT in these fields, please re-key.'; 
  var msg5 = 'You may not use certain command words such as LOAD DATA in these fields, please re-key.'; 
  var msg6 = 'You may not use certain command words such as REPLACE in these fields, please re-key.'; 
  var msg7 = 'You may not use certain command words such as UPDATE in these fields, please re-key.'; 
  var msg8 = 'You may not use certain command words such as SHOW in these fields, please re-key.'; 
  var msg9 = 'You may not use certain command words such as DESCRIBE in these fields, please re-key.'; 
  var msg10 = 'You may not use certain command words such as EXPLAIN in these fields, please re-key.'; 
  var msg11 = 'You may not use certain command words such as CHECK in these fields, please re-key.'; 
  var msg12 = 'You may not use certain command words such as ANALYZE in these fields, please re-key.'; 
  var msg13 = 'You may not use certain command words such as REPAIR in these fields, please re-key.';
  var msg14 = 'You may not use certain command words such as OPTIMIZE in these fields, please re-key.';  

  var select_text = new RegExp("SELECT");
  var drop_text = new RegExp("DROP");
  var delete_text = new RegExp("DELETE");
  var insert_text = new RegExp("INSERT");
  var load_text = new RegExp("LOAD DATA");
  var replace_text = new RegExp("REPLACE");
  var update_text = new RegExp("UPDATE");
  var show_text = new RegExp("SHOW");
  var describe_text = new RegExp("DESCRIBE");
  var explain_text = new RegExp("EXPLAIN");
  var check_text = new RegExp("CHECK");
  var analyze_text = new RegExp("ANALYZE");
  var repair_text = new RegExp("REPAIR");
  var optimize_text = new RegExp("OPTIMIZE");


// check to make sure that there is data in the field
  if (sText != '') {

    if (select_text.test(sText)) {
        alert(msg1);
        document.lakeside_registration.register_name.focus();
        return false;
	}
    if (drop_text.test(sText)) {
        alert(msg2);
        document.lakeside_registration.register_name.focus();
        return false;
	}
    if (delete_text.test(sText)) {
        alert(msg3);
        document.lakeside_registration.register_name.focus();
        return false;
	}
    if (insert_text.test(sText)) {
        alert(msg4);
        document.lakeside_registration.register_name.focus();
        return false;
	}
    if (load_text.test(sText)) {
        alert(msg5);
        document.lakeside_registration.register_name.focus();
        return false;
	}
    if (replace_text.test(sText)) {
        alert(msg6);
        document.lakeside_registration.register_name.focus();
        return false;
	}
    if (update_text.test(sText)) {
        alert(msg7);
        document.lakeside_registration.register_name.focus();
        return false;
	}
    if (show_text.test(sText)) {
        alert(msg8);
        document.lakeside_registration.register_name.focus();
        return false;
	}
    if (describe_text.test(sText)) {
        alert(msg9);
        document.lakeside_registration.register_name.focus();
        return false;
	}
    if (explain_text.test(sText)) {
        alert(msg10);
        document.lakeside_registration.register_name.focus();
        return false;
	}
    if (check_text.test(sText)) {
        alert(msg11);
        document.lakeside_registration.register_name.focus();
        return false;
	}
    if (analyze_text.test(sText)) {
        alert(msg12);
        document.lakeside_registration.register_name.focus();
        return false;
	}
    if (repair_text.test(sText)) {
        alert(msg13);
        document.lakeside_registration.register_name.focus();
        return false;
	}
    if (optimize_text.test(sText)) {
        alert(msg14);
        document.lakeside_registration.register_name.focus();
        return false;
	}

  }
  return true;

  
}

// check to make sure that the data entered in some text fields does not contain
// any commands that can be used against databases in mysql
function checkTextSearchData(sText) {

  var msg1 = 'You may not use certain command words such as SELECT in these fields, please re-key.';   
  var msg2 = 'You may not use certain command words such as DROP in these fields, please re-key.'; 
  var msg3 = 'You may not use certain command words such as DELETE in these fields, please re-key.'; 
  var msg4 = 'You may not use certain command words such as INSERT in these fields, please re-key.'; 
  var msg5 = 'You may not use certain command words such as LOAD DATA in these fields, please re-key.'; 
  var msg6 = 'You may not use certain command words such as REPLACE in these fields, please re-key.'; 
  var msg7 = 'You may not use certain command words such as UPDATE in these fields, please re-key.'; 
  var msg8 = 'You may not use certain command words such as SHOW in these fields, please re-key.'; 
  var msg9 = 'You may not use certain command words such as DESCRIBE in these fields, please re-key.'; 
  var msg10 = 'You may not use certain command words such as EXPLAIN in these fields, please re-key.'; 
  var msg11 = 'You may not use certain command words such as CHECK in these fields, please re-key.'; 
  var msg12 = 'You may not use certain command words such as ANALYZE in these fields, please re-key.'; 
  var msg13 = 'You may not use certain command words such as REPAIR in these fields, please re-key.';
  var msg14 = 'You may not use certain command words such as OPTIMIZE in these fields, please re-key.';  

  var select_text = new RegExp("SELECT");
  var drop_text = new RegExp("DROP");
  var delete_text = new RegExp("DELETE");
  var insert_text = new RegExp("INSERT");
  var load_text = new RegExp("LOAD DATA");
  var replace_text = new RegExp("REPLACE");
  var update_text = new RegExp("UPDATE");
  var show_text = new RegExp("SHOW");
  var describe_text = new RegExp("DESCRIBE");
  var explain_text = new RegExp("EXPLAIN");
  var check_text = new RegExp("CHECK");
  var analyze_text = new RegExp("ANALYZE");
  var repair_text = new RegExp("REPAIR");
  var optimize_text = new RegExp("OPTIMIZE");


// check to make sure that there is data in the field
  if (sText != '') {

    if (select_text.test(sText)) {
        alert(msg1);
        document.search_site.search_info.focus();
        return false;
	}
    if (drop_text.test(sText)) {
        alert(msg2);
        document.search_site.search_info.focus();
        return false;
	}
    if (delete_text.test(sText)) {
        alert(msg3);
        document.search_site.search_info.focus();
        return false;
	}
    if (insert_text.test(sText)) {
        alert(msg4);
        document.search_site.search_info.focus();
        return false;
	}
    if (load_text.test(sText)) {
        alert(msg5);
        document.search_site.search_info.focus();
        return false;
	}
    if (replace_text.test(sText)) {
        alert(msg6);
        document.search_site.search_info.focus();
        return false;
	}
    if (update_text.test(sText)) {
        alert(msg7);
        document.search_site.search_info.focus();
        return false;
	}
    if (show_text.test(sText)) {
        alert(msg8);
        document.search_site.search_info.focus();
        return false;
	}
    if (describe_text.test(sText)) {
        alert(msg9);
        document.search_site.search_info.focus();
        return false;
	}
    if (explain_text.test(sText)) {
        alert(msg10);
        document.search_site.search_info.focus();
        return false;
	}
    if (check_text.test(sText)) {
        alert(msg11);
        document.search_site.search_info.focus();
        return false;
	}
    if (analyze_text.test(sText)) {
        alert(msg12);
        document.search_site.search_info.focus();
        return false;
	}
    if (repair_text.test(sText)) {
        alert(msg13);
        document.search_site.search_info.focus();
        return false;
	}
    if (optimize_text.test(sText)) {
        alert(msg14);
        document.search_site.search_info.focus();
        return false;
	}

  }
  return true;

  
}


// check to make sure that the data entered in some text fields does not contain
// any commands that can be used against databases in mysql
function checkSpecialTextData(sText, textGroup) {
	

  var msg1 = 'You may not use certain command words such as SELECT in these fields, please re-key.';   
  var msg2 = 'You may not use certain command words such as DROP in these fields, please re-key.'; 
  var msg3 = 'You may not use certain command words such as DELETE in these fields, please re-key.'; 
  var msg4 = 'You may not use certain command words such as INSERT in these fields, please re-key.'; 
  var msg5 = 'You may not use certain command words such as LOAD DATA in these fields, please re-key.'; 
  var msg6 = 'You may not use certain command words such as REPLACE in these fields, please re-key.'; 
  var msg7 = 'You may not use certain command words such as UPDATE in these fields, please re-key.'; 
  var msg8 = 'You may not use certain command words such as SHOW in these fields, please re-key.'; 
  var msg9 = 'You may not use certain command words such as DESCRIBE in these fields, please re-key.'; 
  var msg10 = 'You may not use certain command words such as EXPLAIN in these fields, please re-key.'; 
  var msg11 = 'You may not use certain command words such as CHECK in these fields, please re-key.'; 
  var msg12 = 'You may not use certain command words such as ANALYZE in these fields, please re-key.'; 
  var msg13 = 'You may not use certain command words such as REPAIR in these fields, please re-key.';
  var msg14 = 'You may not use certain command words such as OPTIMIZE in these fields, please re-key.';  

  var select_text = new RegExp("SELECT");
  var drop_text = new RegExp("DROP");
  var delete_text = new RegExp("DELETE");
  var insert_text = new RegExp("INSERT");
  var load_text = new RegExp("LOAD DATA");
  var replace_text = new RegExp("REPLACE");
  var update_text = new RegExp("UPDATE");
  var show_text = new RegExp("SHOW");
  var describe_text = new RegExp("DESCRIBE");
  var explain_text = new RegExp("EXPLAIN");
  var check_text = new RegExp("CHECK");
  var analyze_text = new RegExp("ANALYZE");
  var repair_text = new RegExp("REPAIR");
  var optimize_text = new RegExp("OPTIMIZE");
  
  var hold_error = 1;


// check to make sure that there is data in the field
  if (sText != '') {

    if (select_text.test(sText)) {
        alert(msg1);
		hold_error = 2;
	}
    if (drop_text.test(sText)) {
        alert(msg2);
        hold_error = 2;
	}
    if (delete_text.test(sText)) {
        alert(msg3);
		hold_error = 2;
	}
    if (insert_text.test(sText)) {
        alert(msg4);
		hold_error = 2;
	}
    if (load_text.test(sText)) {
        alert(msg5);
		hold_error = 2;
	}
    if (replace_text.test(sText)) {
        alert(msg6);
		hold_error = 2;
	}
    if (update_text.test(sText)) {
        alert(msg7);
		hold_error = 2;
	}
    if (show_text.test(sText)) {
        alert(msg8);
		hold_error = 2;
	}
    if (describe_text.test(sText)) {
        alert(msg9);
		hold_error = 2;
	}
    if (explain_text.test(sText)) {
        alert(msg10);
		hold_error = 2;
	}
    if (check_text.test(sText)) {
        alert(msg11);
		hold_error = 2;
	}
    if (analyze_text.test(sText)) {
        alert(msg12);
		hold_error = 2;
	}
    if (repair_text.test(sText)) {
        alert(msg13);
		hold_error = 2;
	}
    if (optimize_text.test(sText)) {
        alert(msg14);
		hold_error = 2;
	}


// an error has occured return to screen 
	if (hold_error != 1) {
		if (textGroup == 1) {
          document.cust_request.cust_comp_name.focus();			
		} else {
          document.producer_sales.prod_company_name.focus();
		}
        return false;		
	}

  }
  return true;

  
}





// build a footer so that I only have to update this to make the footer the same on all pages
function create_footer() {

    var current_date = new Date().getFullYear();

    document.write('<p>Web site design and integration by <a href="http://www.swj.cc" target="_blank">SWJ Strategic Marketing &amp; Advertising</a><br />Copyright '+current_date+'.  All rights reserved.</p>');
}




// this code will swap an image from what you had to what you want
// the image and new_image is what you want in and out
function swap_the_Image(image, new_image){
  if (document.images) {
    document.images[image].src = new_image;
  }
}

