
function confirmSignup()
{
	if (confirm ("\nThis form is about to be submitted.\nAre you sure everything is correct?"))
	{
		return true;
	}
	else
	{
		return false;
	}
}

function submitForm()
{
	document.signup.target="_self";
	document.signup.submit();
}

//--***************************************************************************************************

function checkForms()	{

	if ( (checkLogon() ) && (checkPassword() ) && (checkFname() ) && (checkLname() ) && (checkEmail() ) && (checkPhoneac() ) && (checkPhonepre() ) && (checkPhonesfx() ) && (checkBusphoneac() ) && (checkBusphonepre() ) && (checkBusphonesfx() ) && (checkCompany() ) && (checkAddress() ) && (checkCity() ) && (checkState() ) && (checkZip() ) && (checkZip4() ) && (checkUrl() ) )
      {
      alert("\nAll forms appear to be filled out properly.\n\nYour submission will now be made.");
      }
	  
	 submitForm();
	  return (true);
}

		
//-- CHECK LOGON
function checkLogon()	{

	var str = document.signup.logon.value;
	if (str == "")
	{
		alert("\nThe DIRECTORY NAME field is blank.\n\nPlease enter your desired directory name.");
		document.signup.logon.select();
		document.signup.logon.focus();
		return false;
	}
	var str = document.signup.logon.value;
	for (var i = 0; i < str.length; i++)
	{
		var ch = str.substring(i, i + 1);
		if ((ch < "a" || "z" < ch) && (ch < "0" || "9" < ch))
		{
			alert("\nThe DIRECTORY NAME field accepts only one word, lowercase usernames.\n\nPlease re-enter your desired directory name");
			document.signup.logon.select();
			document.signup.logon.focus();
			return false;
		}
		else
		{
		document.signup.password.select();
		document.signup.password.focus();
		}
	}
	return true;
}

//-- CHECK PASSWORD
function checkPassword()	{

	var str = document.signup.password.value;
	if (str == "")
	{
		alert("\nThe PASSWORD field is blank.\n\nPlease enter your desired password.");
		document.signup.password.select();
		document.signup.password.focus();
		return false;
	}
	else
	{
		document.signup.fname.select();
		document.signup.fname.focus();
	}
	return true;
}

//-- CHECK FIRST NAME
function checkFname()	{

	var str = document.signup.fname.value;
	if (str == "")
	{
		alert("\nThe FIRST NAME field is blank.\n\nPlease enter your first name.");
		document.signup.fname.select();
		document.signup.fname.focus();
		return false;
	}

	for (var i = 0; i < str.length; i++)
	{
		var ch = str.substring(i, i + 1);
		if (((ch < "a" || "z" < ch) && (ch < "A" || "Z" < ch)) && ch != ' ')
		{
			alert("\nThe FIRST NAME field accepts letters and spaces only.\n\nPlease re-enter your first name");
			document.signup.fname.select();
			document.signup.fname.focus();
			return false;
		}
	}
			return false;
}

//-- CHECK LAST NAME
function checkLname()	{

	var str = document.signup.lname.value;
	if (str == "")
	{
		alert("\nThe LAST NAME field is blank.\n\nPlease enter your last name.");
		document.signup.lname.select();
		document.signup.lname.focus();
		return false;
	}

	for (var i = 0; i < str.length; i++)
	{
		var ch = str.substring(i, i + 1);
		if (((ch < "a" || "z" < ch) && (ch < "A" || "Z" < ch)) && ch != ' ')
		{
			alert("\nThe LAST NAME field accepts letters and spaces only.\n\nPlease re-enter your last name");
			document.signup.lname.select();
			document.signup.lname.focus();
			return false;
		}
	}
	return true;
}

//-- CHECK E-MAIL
function checkEmail()	{

	var str = document.signup.email.value;
	if (str == "")
	{
		alert("\nThe E-MAIL field is blank.\n\nPlease enter your e-mail address.");
		document.signup.email.select();
		document.signup.email.focus();
		return false;
	}
	if (document.signup.email.value.indexOf ('@',0) == -1 || 
	document.signup.email.value.indexOf ('.',0) == -1)
		{
		alert("\nThe E-MAIL appears to be invalid.\n\nPlease re-enter your e-mail address.")
		document.signup.email.select();
		document.signup.email.focus();
		return false;
		}
		else
		{
		document.signup.phoneac.select();
		document.signup.phoneac.focus();
		return false;
	}
}

//-- CHECK PHONE AREA CODE
function checkPhoneac()	{

	var str = document.signup.phoneac.value;
	if (str == "")
	{
		alert("\nThe PHONE AREA CODE field is blank.\n\nPlease enter your area code.");
		document.signup.phoneac.focus();
		return false;
	}

	for (var i = 0; i < str.length; i++)
	{
		var ch = str.substring(i, i + 1);
		if (ch < "0" || "9" < ch)
		{
			alert("\nThe PHONE AREA CODE field accepts numbers only.\n\nPlease re-enter your area code");
			document.signup.phoneac.select();
			document.signup.phoneac.focus();
			return false;
		}
	
	}
	return true;
}

//-- CHECK PHONE PREFIX
function checkPhonepre()	{

	var str = document.signup.phonepre.value;
	if (str == "")
	{
		alert("\nThe PHONE PREFIX field is blank.\n\nPlease enter your request date.");
		document.signup.phonepre.focus();
		return false;
	}

	for (var i = 0; i < str.length; i++)
	{
		var ch = str.substring(i, i + 1);
		if (ch < "0" || "9" < ch)
		{
			alert("\nThe PHONE PREFIX field accepts numbers only.\n\nPlease re-enter your request date");
			document.signup.phonepre.select();
			document.signup.phonepre.focus();
			return false;
		}
	
	}
	return true;
}

//-- CHECK PHONE SUFFIX
function checkPhonesfx()
{
	var str = document.signup.phonesfx.value;

	if (str == "")
	{
		alert("\nThe PHONE SUFFIX field is blank.\n\nPlease enter your phone suffix.");
		document.signup.phonesfx.focus();
		return false;
	}

	for (var i = 0; i < str.length; i++)
	{
		var ch = str.substring(i, i + 1);
		if (ch < "0" || "9" < ch)
		{
			alert("\nThe PHONE field accepts numbers only.\n\nPlease re-enter your phone suffix");
			document.signup.phonesfx.select();
			document.signup.phonesfx.focus();
			return false;
		}
	
	}
	return true;
}

//-- CHECK BUSINESS PHONE AREA CODE
function checkBusphoneac()	{

	var str = document.signup.busphoneac.value;
	if (str == "")
	{
		alert("\nThe fax AREA CODE field is blank.\n\nPlease enter your area code.");
		document.signup.busphoneac.focus();
		return false;
	}

	for (var i = 0; i < str.length; i++)
	{
		var ch = str.substring(i, i + 1);
		if (ch < "0" || "9" < ch)
		{
			alert("\nThe fax AREA CODE field accepts numbers only.\n\nPlease re-enter your area code");
			document.signup.busphoneac.select();
			document.signup.busphoneac.focus();
			return false;
		}
	
	}
	return true;
}

//-- CHECK BUSINESS PHONE PREFIX
function checkBusphonepre()	{

	var str = document.signup.busphonepre.value;
	if (str == "")
	{
		alert("\nThe Business Phone PREFIX field is blank.\n\nPlease enter your request date.");
		document.signup.busphonepre.focus();
		return false;
	}

	for (var i = 0; i < str.length; i++)
	{
		var ch = str.substring(i, i + 1);
		if (ch < "0" || "9" < ch)
		{
			alert("\nThe fax PREFIX field accepts numbers only.\n\nPlease re-enter your request date");
			document.signup.busphonepre.select();
			document.signup.busphonepre.focus();
			return false;
		}
	
	}
	return true;
}

//-- CHECK BUSINESS PHONE SUFFIX
function checkBusphonesfx()	{

	var str = document.signup.busphonesfx.value;
	if (str == "")
	{
		alert("\nThe fax SUFFIX field is blank.\n\nPlease enter your Business Phone suffix.");
		document.signup.busphonesfx.focus();
		return false;
	}

	for (var i = 0; i < str.length; i++)
	{
		var ch = str.substring(i, i + 1);
		if (ch < "0" || "9" < ch)
		{
			alert("\nThe fax field accepts numbers only.\n\nPlease re-enter your Business Phone suffix");
			document.signup.busphonesfx.select();
			document.signup.busphonesfx.focus();
			return false;
		}
	
	}
	return true;
}

//-- CHECK COMPANY
function checkCompany()
{
	var str = document.signup.company.value;
	if (str == "")
	{
		alert("\nThe COMPANY NAME field is blank.\n\nPlease enter your company name.");
		document.signup.company.focus();
		return false;
	}

	for (var i = 0; i < str.length; i++)
	{
		var ch = str.substring(i, i + 1);
		if ((ch < "a" || "z" < ch) && (ch < "A" || "Z" < ch) && ch != ' ')
		{
			alert("\nThe COMPANY NAME field accepts letters and spaces only.\n\nPlease re-enter your company name");
			document.signup.company.select();
			document.signup.company.focus();
			return false;
		}
	}
	return true;
}

//-- CHECK ADDRESS
function checkAddress()	{

	var str = document.signup.address.value;
	if (str == "")
	{
		alert("\nThe ADDRESS field is blank.\n\nPlease enter your address.");
		document.signup.address.focus();
		return false;
	}
	return true;
}

//-- CHECK CITY
function checkCity()	{

	var str = document.signup.city.value;
	if (str == "")
	{
		alert("\nThe CITY field is blank.\n\nPlease enter your city.");
		document.signup.city.focus();
		return false;
	}
	for (var i = 0; i < str.length; i++)
	{
		var ch = str.substring(i, i + 1);
		if (((((ch < "a" || "z" < ch) && (ch < "A" || "Z" < ch) && (ch < "0" || ch > "9")) && ch != ' ') && ch != '.') && ch != '-')
		{
			alert("\nThe CITY field accepts letters and spaces only.\n\nPlease re-enter your city");
			document.signup.city.select();
			document.signup.city.focus();
			return false;
		}
	}
	return true;
}

//-- CHECK STATE
function checkState()	{

	var str = document.signup.state.value;
	if (str == "")
	{
		alert("\nThe STATE field is blank.\n\nPlease enter your state.");
		document.signup.state.focus();
		return false;
	}
	for (var i = 0; i < str.length; i++)
	{
		var ch = str.substring(i, i + 1);
		if (((((ch < "a" || "z" < ch) && (ch < "A" || "Z" < ch) && (ch < "0" || ch > "9")) && ch != ' ') && ch != '.') && ch != '-')
		{
			alert("\nThe STATE field accepts letters and spaces only.\n\nPlease re-enter your state");
			document.signup.state.select();
			document.signup.state.focus();
			return false;
		}
	}
	return true;
}

//-- CHECK ZIP
function checkZip()	{

	var str = document.signup.zip.value;
	if (str == "")
	{
		alert("\nThe ZIP CODE field is blank.\n\nPlease enter your zip.");
		document.signup.zip.focus();
		return false;
	}
	for (var i = 0; i < str.length; i++)
	{
		var ch = str.substring(i, i + 1);
		if (ch < "0" || ch > "9")
		{
			alert("\nThe ZIP CODE field accepts numbers only.\n\nPlease re-enter your zip code");
			document.signup.zip.select();
			document.signup.zip.focus();
			return false;
		}
	}
	return true;
}

//-- CHECK ZIP EXTENSION
function checkZip4()	{

	var str = document.signup.zip4.value;
	if (str == "")
	{
		alert("\nThe ZIP CODE field is blank.\n\nPlease enter your zip.");
		document.signup.zip4.focus();
		return false;
	}
	for (var i = 0; i < str.length; i++)
	{
		var ch = str.substring(i, i + 1);
		if (ch < "0" || ch > "9")
		{
			alert("\nThe ZIP CODE field accepts numbers only.\n\nPlease re-enter your zip code");
			document.signup.zip4.select();
			document.signup.zip4.focus();
			return false;
		}
	}
	return true;
}

//-- CHECK ADDRESS
function checkUrl()	{

	var str = document.signup.url.value;
	if (str == "")
	{
		alert("\nThe ADDRESS field is blank.\n\nPlease enter your address.");
		document.signup.url.select();
		document.signup.url.focus();
		return false;
	}
	return true;
}

//--*************************************************************************************************************

function goLogon()
{
	document.signup.logon.select();
	document.signup.logon.focus();
}

function goPassword()
{
	document.signup.password.select();
	document.signup.password.focus();
}

function goFname()
{
	document.signup.fname.select();
	document.signup.fname.focus();
}

function goLname()
{
	document.signup.lname.select();
	document.signup.lname.focus();
}

function goEmail()
{
	document.signup.email.select();
	document.signup.email.focus();
}

function goCompany()
{
	document.signup.company.select();
	document.signup.company.focus();
}

function goAddress()
{
	document.signup.address.select();
	document.signup.address.focus();
}

function goCity()
{
	document.signup.city.select();
	document.signup.city.focus();
}

function goState()
{
	document.signup.state.select();
	document.signup.state.focus();
}

function goZip()
{
	document.signup.zip.select();
	document.signup.zip.focus();
}

function goZip4()
{
	document.signup.zip4.select();
	document.signup.zip4.focus();
}

function goUrl()
{
	document.signup.url.select();
	document.signup.url.focus();
}

function goPhoneac()
{
	document.signup.phoneac.select();
	document.signup.phoneac.focus();
}

function goPhonepre()
{
	document.signup.phonepre.select();
	document.signup.phonepre.focus();
}

function goPhonesfx()
{
	document.signup.phonesfx.select();
	document.signup.phonesfx.focus();
}

function goBusphoneac()
{
	document.signup.busphoneac.select();
	document.signup.busphoneac.focus();
}

function goBusphonepre()
{
	document.signup.busphonepre.select();
	document.signup.busphonepre.focus();
}

function goBusphonesfx()
{
	document.signup.busphonesfx.select();
	document.signup.busphonesfx.focus();
}

//--*************************************************************************************************************

var capable;
var name = navigator.appName.toLowerCase();
var vers = parseFloat(navigator.appVersion);

if ((name.indexOf("netscape") >= 0 && vers >= 4) || (name.indexOf("microsoft") >= 0 && vers >= 4))
  capable = true;
else
  capable = false;


var FLDSEP;    
var IDXSEP;

if (capable) 
{
  FLDSEP = String.fromCharCode(1);
  IDXSEP = String.fromCharCode(2);
}

function storeData(name, days, exclude) 
{

  var f;
  var expdate;
  var list, include;
  var i;
  var fld;
  var data;

  if (!capable)
    return true;

  if (!(f = document.forms[name]))
    return true;

  if (days == "")
    days = 0;
  expdate = new Date();
  expdate.setTime (expdate.getTime() + (86400 * 1000 * days));

  list = new Array();
  if (exclude != "") {
    i = 0;
    while ((i = exclude.indexOf(",")) >= 1) {
      list[list.length] = exclude.substr(0, i);
      exclude = exclude.substr(i + 1)
    }
    list[list.length] = exclude;
  }

  data = FLDSEP;
  for (i = 0; i < f.length; i++) {
    fld = f.elements[i];

    include = true;
    for (j = 0; j < list.length; j++)
      if (fld.name == list[j])
        include = false;

      if (include) {

      if ((fld.type == "checkbox" || fld.type == "radio") && fld.checked)
        data += setData(fld.name, fld.value);

      if (fld.type == "select-one")
        if (fld.selectedIndex >= 0)
          data += setData(fld.name, fld.options[fld.selectedIndex].value);

      if (fld.type == "select-multiple")
        for (j = 0; j < fld.options.length; j++)
          if (fld.options[j].selected)
            data += setData(fld.name + IDXSEP + j, fld.options[j].value);

      if (fld.type == "hidden" || fld.type == "password" || fld.type == "text")
        data += setData(fld.name, fld.value);
    }
  }

  deleteCookie(name);
  setCookie(name, data, expdate);

  return true;
}

function retrieveData(name) {

  var f;
  var i, j;
  var fld;
  var s;
  var data;

  if (!capable)
    return false;

  if (!(f = document.forms[name]))
    return false;

  data = getCookie(name);
  if (data == "")
    return false;

  for (i = 0; i < f.elements.length; i++) {
    fld = f.elements[i];

    if ((fld.type == "checkbox" || fld.type == "radio") && (s = getData(fld.name, data)) != null && fld.value == s)
      fld.checked = true;

    if (fld.type == "select-one" && (s = getData(fld.name, data)) != null)
      for (j = 0; j < fld.options.length; j++)
        if (fld.options[j].value == s)
          fld.options[j].selected = true;

    if (fld.type == "select-multiple")
      for (j = 0; j < fld.options.length; j++)
        if ((s = getData(fld.name + IDXSEP + j, data)) != null && fld.options[j].value == s)
          fld.options[j].selected = true;

    if ((fld.type == "hidden" || fld.type == "password" || fld.type == "text" || fld.type == "textarea") && (s = getData(fld.name, data)) != null)
      fld.value = s;
  }

  return true;
}
function setData(name, value) {

  if (value != "")
    return name + "=" + value + FLDSEP;
  else
    return "";
}

function getData(name, data) {

  var i, j;
  var s;

  if (data == "")
    return null;

  s = FLDSEP + name + "=";
  i = data.indexOf(s);
  if (i >= 0) {
    i += s.length;
    j = data.indexOf(FLDSEP, i);
    if (j >= 0)
      return data.substr(i, j - i);
  }

  return null;
}


function setCookie (name, value, expires) {

  document.cookie = name + "=" + escape(value) + "; expires=" + expires.toGMTString() +  "; path=/";
}


function getCookie(name) {

  var search;

  search = name + "="
  offset = document.cookie.indexOf(search) 
  if (offset != -1) {
    offset += search.length ;
    end = document.cookie.indexOf(";", offset) ;
    if (end == -1)
      end = document.cookie.length;
    return unescape(document.cookie.substring(offset, end));
  }
  else
    return "";
}

function deleteCookie(name) {

  var expdate = new Date();
  expdate.setTime(expdate.getTime() - (86400 * 1000 * 1));
  setCookie(name, "", expdate);
}

//--***************************************************************************************************************
