<!--
function turnonSubs() {
   document.form.listingtype[0].disabled = false;
   document.form.listingtype[1].disabled = false;
   document.form.listingtype[2].disabled = false;
   document.form.accreditationrequest.disabled = false;

}

function turnonPay() {
   document.form1.paynow.disabled = false;			 
}

function validate_form(form) {

  var cHosen = form.country.options[form.country.selectedIndex].value;
  var emailRe = '/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*\.(\w{2}|(com|net|org|edu|int|mil|gov|arpa|biz|aero|name|coop|info|pro|museum))$/';
  var phoneRe = '/^((\+\d{1,3}(-| )?\(?\d\)?(-| )?\d{1,5})|(\(?\d{2,6}\)?))(-| )?(\d{3,4})(-| )?(\d{4})(( x| ext| *)\d{1,5}){0,1}$/';
  var urlRe = '/^@"((https?|ftp|gopher|telnet|file|notes|ms-help):((//)|(\\\\))+[\w\d:#@%/;$()~_?\+-=\\\.&]*)"$/';

      if (!check_empty(document.form.name.value))  {
        alert('Please enter your name');
        document.form.name.focus();
        return false;  
      }

      if (!check_empty(document.form.country.value))  {
        alert('Please enter your country');
        document.form.country.focus();
        return false;  
      }

      if (!check_empty(document.form.address1.value))  {
         alert('Please enter your postal address');
         document.form.address1.focus(); 
         return false;
      }

      if (!check_empty(document.form.city.value))  {
         alert('Please enter your city');
         document.form.city.focus(); 
         return false;
      }

      if (!check_empty(document.form.state.value))  {
         alert('If USA or Australia, please SELECT your state/province..if not USA or Australia with no state/province, enter None');
         document.form.state.focus(); 
         return false;
      }

      if (!check_empty(document.form.postcode.value))  {
         alert('Please enter your postcode or zip code. If your address does not require a postcode or zip code, please enter 0');
         document.form.postcode.focus(); 
         return false;
      }

      if (!check_empty(document.form.email.value))  {
         alert('Please enter a valid email address in approved format: whatitis@whatelseitis.ext');
         document.form.email.focus(); 
         document.form.email.select(); 
         return false;
      }

      if (document.form.email.value != document.form.checkemail.value) {
         alert('Your email addresses do not match, please retype');
         document.form.checkemail.focus(); 
         document.form.checkemail.select(); 
         return false;
      }
      
      if (!check_empty(document.form.password.value))  {
         alert('Please enter a Password');
         document.form.password.focus(); 
         return false;
      }

      if (document.form.password.value != document.form.checkpassword.value) {
         alert('Your passwords do not match, please check / retype');
         document.form.checkpassword.focus(); 
         document.form.checkpassword.select(); 
         return false;
      }

      if (!check_empty(document.form.memberdetails.value))  {
         alert('Please enter your member details');
         document.form.memberdetails.focus(); 
         return false;
      }

      if (document.form.memberdetails.value.length > 250) {
         alert ('Max length for Membership Details is 250 characters. Please retype before continuing.');
         document.form.memberdetails.focus();
         document.form.memberdetails.select();
         return false;
      }

      if (!document.form.listingtype[0].checked && !document.form.listingtype[1].checked && !document.form.listingtype[2].checked) {
         alert('Please select one of the three listing types: Logo Listing, Redlist Listing, or Free Listing');
         document.form.listingtype[0].focus();
         return false;
      }

      if (document.form.listingtype[0].checked && !check_empty(document.form.userfile.value) && (document.form.formtype.value == "subscribe" || document.form.substatus.value == "Amend" || document.form.substatus.value == "Update")) {
         alert('With a Logo Listing, you must enter/provide your logo for uploading.');
         document.form.userfile.focus();
         return false;
      }

      if (check_empty(document.form.comments.value) && document.form.comments.value.length > 250) {
         alert ('Max length for Comments is 250 characters. Please retype before continuing.');
         document.form.comments.focus();
         document.form.comments.select();
         return false;
      }

      if (document.form.spamcheck.value != "right")  {
        alert("Correct answer to the mandatory block is 'right', small letters without the quotes");
        document.form.spamcheck.focus();
        document.form.spamcheck.select();
        return false;  
      }

   return true;

   }

function check_empty(text) {
  return (text.length > 0); // returns false if empty
}

function changeState() {
  var cHosenState = form.state1.options[form.state1.selectedIndex].value;
  document.form.state.value = cHosenState;
  document.form.state1.options.selectedIndex = 0;
  return;
}

function accredReq(n) {
  if ((document.form.accreditationrequest.checked == true) && ((n == 1 || n == 2 || n == 3))) {
     alert('Accreditation Request includes Logo Listing; please unselect Accreditation Request for different listing type.');
     document.form.listingtype[0].checked = true;
     return;
  }
  if (document.form.accreditationrequest.checked == true && n == 0) {
     document.form.listingtype[0].checked = true;
     alert('Logo Listing is included in the Accreditation Package.  Please browse and provide your logo listing image.');
     document.form.userfile.focus();
     document.form.userfile.select();
  } 

  if (document.form.listingtype[0].checked == true && n == 3) {
     alert('Please browse and provide your logo listing image.');
     document.form.userfile.focus();
     document.form.userfile.select();
  } 

  if (document.form.accreditationrequest.checked == false && n == 0) {
       document.form.listingtype[0].checked = false;
       document.form.userfile.select();
       document.form.userfile.focus();
       alert('Please press the delete key to clear the logo listing image file (if displayed) before continuing.');
  }

}

function amendDb(n) {
   if (document.form.intention[0].checked == true && n==1 && document.form.listingtype[2].checked != true) {
      document.form.substatus.value = "Renew";
      document.form.listingtype[0].disabled = false;
      document.form.listingtype[1].disabled = false;
      document.form.listingtype[2].disabled = false;
      document.form.accreditationrequest.disabled = false;
      document.form.submit();
   }

   if ((document.form.intention[0].checked == true || document.form.intention[1].checked == true) && n==1 && document.form.listingtype[2].checked == true) {
      alert('Free Listing Type does not require renewal.');
      document.form.intention[0].checked = false;
   }
   //if (document.form.intention[1].checked == true && n==0) {
   //alert('You selected Change Membership Details with renewal of CURRENT subscription at same level.');
   //}

   if (document.form.intention[1].checked == true && n==1) {
      document.form.listingtype[0].disabled = true;
      document.form.listingtype[1].disabled = true;
      document.form.listingtype[2].disabled = true;
      document.form.accreditationrequest.disabled = true;
      document.form.membercertificate.disabled = false;
      document.form.substatus.value = "Renew";
   }

   //if (document.form.intention[2].checked == true && document.form.listingtype[2].checked == false && n==0) {
   //alert('You selected to ONLY Change Membership Details.');
   //}

   //if (document.form.intention[2].checked == true && document.form.listingtype[2].checked == true && n==0) {
   //alert('You selected to ONLY Change Membership Details, maintaining FREE LISTING at this time.');
   //}

   if (document.form.intention[2].checked == true && n==1) {
      document.form.listingtype[0].disabled = true;
      document.form.listingtype[1].disabled = true;
      document.form.listingtype[2].disabled = true;
      document.form.accreditationrequest.disabled = true;
      document.form.membercertificate.disabled = false;
      document.form.substatus.value="Amend";
   }

   if (document.form.intention[3].checked == true && n==1) {
      document.form.listingtype[0].disabled = false;
      document.form.listingtype[1].disabled = false;
      document.form.listingtype[2].disabled = false;
      document.form.accreditationrequest.disabled = false;
      document.form.membercertificate.disabled = false;
      document.form.substatus.value="Update";
   }

}

function checkPreselect() {
   if (document.form.intention[0].checked != true && document.form.intention[1].checked != true && document.form.intention[2].checked != true && document.form.intention[3].checked != true) {
      alert('You MUST select one of Amendment Type options at the top of the form !!');
      document.form.intention[0].focus();
      document.form.intention[0].select();
   }
}

function checkMDLen() {
  if (document.form.memberdetails.value.length > 250) {
     alert ('Max length for Membership Details is 250 characters. Please retype before continuing.');
     document.form.memberdetails.focus();
     document.form.memberdetails.select();
  }
}

function checkCommentLen() {
  if (document.form.comments.value.length > 250) {
         alert ('Max length for Comments is 250 characters. Please retype before continuing.');
         document.form.comments.focus();
         document.form.comments.select();
      }
}

function doCountryState() { 
var setcountrystate="countrystate";
form.countrystate.value=setcountrystate;
form.submit(); 
}

function toDollarsAndCents(n) {
  var s = "" + Math.round(n * 100) / 100
  var i = s.indexOf('.')
  if (i < 0) return s + ".00"
  var t = s.substring(0, i + 1) + s.substring(i + 1, i + 3)
  if (i + 2 == s.length) t += "0"
  return t
}

function FormatFields()
{
document.form1.paynow.disabled = true;
document.form1.FSN_Certificate.value = document.form1.FSN_Certificate_qty.value + "," + document.form1.FSN_Certificate_value.value;
document.form1.FSN_Logo_Listing.value = document.form1.FSN_Logo_Listing_qty.value + "," + document.form1.FSN_Logo_Listing_value.value;
document.form1.FSN_Redlist.value = document.form1.FSN_Redlist_qty.value + "," + document.form1.FSN_Redlist_value.value;
document.form1.FSN_Accredited_Member.value = document.form1.FSN_Accredited_Member_qty.value + "," + document.form1.FSN_Accredited_Member_value.value;


document.form1.FSN_Certificate_subtotal.value = toDollarsAndCents(document.form1.FSN_Certificate_qty.value * document.form1.FSN_Certificate_value.value);
document.form1.FSN_Logo_Listing_subtotal.value = toDollarsAndCents(document.form1.FSN_Logo_Listing_qty.value * document.form1.FSN_Logo_Listing_value.value);
document.form1.FSN_Redlist_subtotal.value = toDollarsAndCents(document.form1.FSN_Redlist_qty.value * document.form1.FSN_Redlist_value.value);
document.form1.FSN_Accredited_Member_subtotal.value = toDollarsAndCents(document.form1.FSN_Accredited_Member_qty.value * document.form1.FSN_Accredited_Member_value.value);

document.form1.OrderTotal.value = 0;

document.form1.OrderTotal.value = toDollarsAndCents(parseFloat(document.form1.OrderTotal.value)
			 + parseFloat(document.form1.FSN_Certificate_subtotal.value)
			 + parseFloat(document.form1.FSN_Logo_Listing_subtotal.value)
			 + parseFloat(document.form1.FSN_Redlist_subtotal.value)
			 + parseFloat(document.form1.FSN_Accredited_Member_subtotal.value));
}

function validate_entry() {

  validity = true; 

  if (validity) {
     if (!check_email(document.form2.email.value))
        { validity = false; alert('Please enter a valid email address');
          document.form2.email.focus(); } }

  if (validity) {
     if (!check_empty(document.form2.password.value))
        { validity = false; alert('Please enter a Password');
          document.form2.password.focus(); } }

  return validity;

}

function check_email(address) {
  if ((address == "")
    || (address.indexOf ('@') == -1)
    || (address.indexOf ('.') == -1))
      {return false;}
  return true;
}

// -->

