function func_check_form()
{
	var pub_f_name = document.join_form.pub_f_name.value;
	var pub_l_name = document.join_form.pub_l_name.value;
	var cmp_name = document.join_form.cmp_name.value;
	var street = document.join_form.street.value;
	var city = document.join_form.city.value;
	var state = document.join_form.state.value;
	var zip = document.join_form.zip.value;
	var country = document.join_form.country.value;
	var pub_phone = document.join_form.pub_phone.value;
	var pub_email = document.join_form.pub_email.value;
	var num_emp = document.join_form.num_emp.value;
	var cmp_desc = document.join_form.cmp_desc.value;
	var prv_f_name = document.join_form.prv_f_name.value;
	var prv_l_name = document.join_form.prv_l_name.value;
	var prv_phone = document.join_form.prv_phone.value;
	var prv_email = document.join_form.prv_email.value;
	var m_type_length = document.join_form.m_type.length;
	var m_type_value = document.join_form.m_type.value;
	var cmp_sch_object = document.getElementById('cmp_sch');

	var result = true;
	var error_string = '';
	var email_valid = true;
	
	if (pub_f_name.toString() == '')
	{
		error_string = 'First name is required for public contact information.\n';
	}
	else
	{
		if (pub_f_name.replace(/\s/g,'') == '')
		{
			error_string = 'First name is required for public contact information.\n';
		}
	}
	
  if (pub_l_name.toString() == '')
	{
		error_string += 'Last name is required for public contact information.\n';
	}
	else
	{
		if (pub_l_name.replace(/\s/g,'') == '')
		{
			error_string += 'Last name is required for public contact information.\n';
		}
	}

  if (cmp_name.toString() == '')
	{
		if (cmp_sch_object.innerHTML == 'School')
		{
			error_string += 'School name is required.\n';
		}
		else
		{
			error_string += 'Company name is required.\n';
		}
	}
	else
	{
		if (cmp_name.replace(/\s/g,'') == '')
		{
			if (cmp_sch_object.innerHTML == 'School')
			{
				error_string += 'School name is required.\n';
			}
			else
			{
				error_string += 'Company name is required.\n';
			}
		}
	}

  if (street.toString() == '')
	{
		error_string += 'Street address is required.\n';
	}
	else
	{
		if (street.replace(/\s/g,'') == '')
		{
			error_string += 'Street address is required.\n';
		}
	}

  if (city.toString() == '')
	{
		error_string += 'City is required.\n';
	}
	else
	{
		if (city.replace(/\s/g,'') == '')
		{
			error_string += 'City is required.\n';
		}
	}

  if (state.toString() == '')
	{
		error_string += 'State is required.\n';
	}
	else
	{
		if (state.replace(/\s/g,'') == '')
		{
			error_string += 'State is required.\n';
		}
	}

  if (zip.toString() == '')
	{
		error_string += 'Zip code is required.\n';
	}
	else
	{
		if (zip.replace(/\s/g,'') == '')
		{
			error_string += 'Zip code is required.\n';
		}
	}

  if (country.toString() == '')
	{
		error_string += 'Country is required.\n';
	}
	else
	{
		if (country.replace(/\s/g,'') == '')
		{
			error_string += 'Country is required.\n';
		}
	}

	if (pub_phone.toString() == '')
	{
		error_string += 'Telephone is required for public contact information.\n';
	}
	else
	{
		if (pub_phone.replace(/\s/g,'') == '')
		{
			error_string += 'Telephone is required for public contact information.\n';
		}
	}

  if (pub_email.toString() == '')
	{
		error_string += 'Email address is required for public contact information.\n';
	}
	else
	{
		email_valid = emailAddressValidate(pub_email);
		if (email_valid != true)
		{
			error_string += 'Valid email address is required for public contact information.\n';
		}
	}

  if (num_emp.toString() == '')
	{
		error_string += 'Number of employees is required.\n';
	}
	else
	{
		if (num_emp.replace(/\s/g,'') == '')
		{
			error_string += 'Number of employees is required.\n';
		}
	}

  if (cmp_desc.toString() == '')
	{
		error_string += 'A company description is required.\n';
	}
	else
	{
		if (cmp_desc.replace(/\s/g,'') == '')
		{
			error_string += 'A company description is required.\n';
		}
	}

	if (prv_f_name.toString() == '')
	{
		error_string += 'First name is required for private contact information.\n';
	}
	else
	{
		if (prv_f_name.replace(/\s/g,'') == '')
		{
			error_string += 'First name is required for private contact information.\n';
		}
	}

  if (prv_l_name.toString() == '')
	{
		error_string += 'Last name is required for private contact information.\n';
	}
	else
	{
		if (prv_l_name.replace(/\s/g,'') == '')
		{
			error_string += 'Last name is required for private contact information.\n';
		}
	}

	if (prv_phone.toString() == '')
	{
		error_string += 'Telephone is required for private contact information.\n';
	}
	else
	{
		if (prv_phone.replace(/\s/g,'') == '')
		{
			error_string += 'Telephone is required for private contact information.\n';
		}
	}

  if (prv_email.toString() == '')
	{
		error_string += 'Email address is required for private contact information.\n';
	}
	else
	{
		email_valid = emailAddressValidate(prv_email);
		if (email_valid != true)
		{
			error_string += 'Valid email address is required for private contact information.\n';
		}
	}
	
	var m_type_flag = 1;
	var i = 0;
	while (i < m_type_length)
	{
		if (document.join_form.m_type[i].checked)
		{
			m_type_flag = 0;
		}
		i++;
	}
	
	if (m_type_value >= 0)
	{
		m_type_flag = 0;
	}

	
	if (m_type_flag)
	{
		error_string += 'A membership type must be selected.';
	}
	
	

	if (error_string != '')
	{
		alert(error_string);
		result = false;
	}

	return result;
}

function emailAddressValidate(_email)
{
	var _at_index = _email.lastIndexOf('@');
	if (_at_index <= 0)
	{
		return false;
	}

	var _email_local_part = _email.substr(0,_at_index);
	var _email_domain_part = _email.substr(_at_index + 1);
	
	if (_email_local_part.length > 64)
	{
		return false;
	}
	if (_email_domain_part.length < 1  || _email_domain_part.length > 255)
	{
		return false;
	}

	var _temp_email_local_part = _email_local_part.replace(/\\\\/g, '');

	var _temp_email_local_part = _temp_email_local_part.replace(/\\./g, '');

	var _quote_pattern = new RegExp('\"');
	while (_quote_pattern.test(_temp_email_local_part) == true)
	{
		var _1st_ptr = _temp_email_local_part.indexOf("\"");
		var _length_tracker = _temp_email_local_part.length
		if (_1st_ptr < _length_tracker - 1)
		{
			var _2nd_ptr = _temp_email_local_part.indexOf("\"", _1st_ptr + 1);
			if (_2nd_ptr > 0)
			{
				var _quote = _temp_email_local_part.substring(_1st_ptr, _2nd_ptr + 1)
				_temp_email_local_part = _temp_email_local_part.replace(_quote, '');
			}
			else
			{
				return false;
			}
		}
		else
		{
			return false;
		}
	}
	
	var _char_pattern = new RegExp ('[^a-zA-Z0-9!#$%&\'*+-/=?^_`{|}.~]', 'g');
	if (_char_pattern.test(_temp_email_local_part) == true)
	{
		return false;
	}

	var _dot_check = _temp_email_local_part.indexOf('.');
	if (_dot_check >= 0)
	{
		if (_temp_email_local_part.substr(0,1) == '.')
		{
			return false;
		}
		if (_temp_email_local_part.substr(_temp_email_local_part.length - 1, 1) == '.')
		{
			return false;
		}
		var _dot_pattern = new RegExp('\\.\\.');
		if (_dot_pattern.test(_temp_email_local_part) == true)
		{
			return false;
		}
	}

	var _dot_check = _email_domain_part.indexOf('.');
	if (_dot_check >= 0)
	{
		if (_email_domain_part.substr(0,1) == '.')
		{
			return false;
		}
		if (_email_domain_part.substr(_email_domain_part.length - 1, 1) == '.')
		{
			return false;
		}
		var _dot_pattern = new RegExp('\\.\\.');
		if (_dot_pattern.test(_email_domain_part) == true)
		{
			return false;
		}
	}
	else
	{
		return false;
	}

	var _char_pattern = new RegExp ('[^a-zA-Z0-9\-.]', 'g');
	if (_char_pattern.test(_email_domain_part) == true)
	{
		return false;
	}

	var _labels = new Array;
	_labels = _email_domain_part.split(".");
	var _labels_count = _labels.length;
	var _counter = 1;
	var _ptr = 0;
	while (_counter <= _labels_count)
	{
		if (_labels[_ptr].length > 63)
		{
			return false;
		}

		if (_labels[_ptr].charAt(0) == '-')
		{
			return false;
		}

		if (_labels[_ptr].length > 1)
		{
			var _last_char_pattern = new RegExp("[a-zA-Z0-9]$");
			if (_labels[_ptr].charAt(_labels[_ptr].length - 1) == '-')
			{
				return false;
			}
		}
		
		_counter++;
		_ptr++;
	}
	
	return true;
} 	

function pub_prv()
{
	var prv_pub_checked = document.join_form.prv_pub.checked;
	if(prv_pub_checked)
	{
		document.join_form.prv_f_name.disabled = true;
		document.join_form.prv_l_name.disabled = true;
		document.join_form.prv_phone.disabled = true;
		document.join_form.prv_email.disabled = true;
		document.join_form.prv_f_name.value = document.join_form.pub_f_name.value;
		document.join_form.prv_l_name.value = document.join_form.pub_l_name.value;
		document.join_form.prv_phone.value = document.join_form.pub_phone.value;
		document.join_form.prv_email.value = document.join_form.pub_email.value;
	}
	else
	{
		document.join_form.prv_f_name.disabled = false;
		document.join_form.prv_l_name.disabled = false;
		document.join_form.prv_phone.disabled = false;
		document.join_form.prv_email.disabled = false;
		document.join_form.prv_f_name.value = '';
		document.join_form.prv_l_name.value = '';
		document.join_form.prv_phone.value = '';
		document.join_form.prv_email.value = '';
	}
	return;
}

function prv_follow()
{
	var prv_pub_checked = document.join_form.prv_pub.checked;
	if(prv_pub_checked)
	{
		document.join_form.prv_f_name.value = document.join_form.pub_f_name.value;
		document.join_form.prv_l_name.value = document.join_form.pub_l_name.value;
		document.join_form.prv_phone.value = document.join_form.pub_phone.value;
		document.join_form.prv_email.value = document.join_form.pub_email.value;
	}
	return;
}

function helpTip()
{
	var wit_ht_object = document.getElementById('wit_ht');
		var box_display = wit_ht_object.style.display;
		if (box_display == 'inline')
		{
			wit_ht_object.style.display = 'none';
		}
		else
		{
			wit_ht_object.style.display = 'inline';
		}
	return;
}