function chg(tp){
//alert("tp="+tp)

		for(var loop=0;loop <=document.company_form.acc_rep_id.options.length;loop++)
		{
			document.company_form.acc_rep_id[1] = null;
			document.company_form.acc_rep_id.options.length = 0;
		}
		
	strOuter = all_reps.split("$");
	len=0;
			for (OuterLoop = 0; OuterLoop < strOuter.length; OuterLoop++) 
			{		
				strInner = strOuter[OuterLoop].split("#");			//#
//alert(strInner[0])
				if(strInner[0] == tp)
				{
					acc_rep_id  = strInner[1];
					acc_rep_name = strInner[2];
					len = document.company_form.acc_rep_id.options.length;
					var option = new Option(acc_rep_name,acc_rep_id);
					eval("document.company_form.acc_rep_id.options[len] = option");
				}
			}
	
}

// to copy contact billing info to shipping info in create_account.php and create_account_non.php
function copy_contact_billing_info(theForm) {
	obj_handle = theForm;
	obj_handle.billing_address1.value = obj_handle.address1.value; 	
	obj_handle.billing_address2.value = obj_handle.address2.value; 	
	obj_handle.billing_city.value = obj_handle.city.value; 	
	obj_handle.billing_state.selectedIndex = obj_handle.state.selectedIndex; 	
	obj_handle.billing_zip.value = obj_handle.zip.value;
}

function check_company(){
	var nn = document.company_form.name.value;
	var cpn = document.company_form.contact_person.value;

	var cp = document.company_form.contact_phone.value;
	var ce = document.company_form.contact_email.value;
	var emp = document.company_form.approx_nr_employees.value;

	var add = document.company_form.address1.value;
	var cty = document.company_form.city.value;
	var zp = document.company_form.zip.value;

	var badd = document.company_form.billing_address1.value;
	var bcty = document.company_form.billing_city.value;
	var bzp = document.company_form.billing_zip.value;

	
	if (nn=="" ){
		alert('Please enter the company name.');
		document.company_form.name.focus();
		return;
	}
	if (cpn==""){
		alert('Please enter the contact person name.');
		document.company_form.contact_person.focus();
		return;
	}	
	if (cp==""){
		alert('Please enter the contact phone.');
		document.company_form.contact_phone.focus();
		return;
	}

	if (ce=="" ){
		alert('Please enter the contact email address.');
		document.company_form.contact_email.focus();
		return;
	}

		var goodEmail = document.company_form.contact_email.value.match(/\b(^(\S+@).+((\.com)|(\.net)|(\.edu)|(\.mil)|(\.gov)|(\.org)|(\..{2,2}))$)\b/gi);
		if (!goodEmail){
			alert("Please include a proper email address, of the form id@domain.zzz or id@domain.xx.zzz.")
			document.company_form.contact_email.focus()
			return ;
    	}	

	if (emp==""){
		alert('Please enter the approx number of members.');
		document.company_form.approx_nr_employees.focus();
		return;
	}

	if (add==""){
		alert('Please enter the physical address.');
		document.company_form.address1.focus();
		return;
	}
	
	if (cty==""){
		alert('Please enter the physical city.');
		document.company_form.city.focus();
		return;
	}

	if (zp==""){
		alert('Please enter the physical zip.');
		document.company_form.zip.focus();
		return;
	}	
	
	if (badd==""){
		alert('Please enter the billing address.');
		document.company_form.billing_address1.focus();
		return;
	}
		
	if (bcty==""){
		alert('Please enter the billing city.');
		document.company_form.billing_city.focus();
		return;
	}
		
	if (bzp==""){
		alert('Please enter the billing zip.');
		document.company_form.billing_zip.focus();
		return;
	}	

	
	document.company_form.submit();	
				
}


function charAlert() {

var textField1 = document.contact_form.alert1;
var textField2 = document.contact_form.alert2;
var textField3 = document.contact_form.alert3;

if(textField1.value.length > 250){ 
/* must be > 5, not == 5 or else the substring statement on the next line will cause the function to run again if the user dismisses the alert by pressing the 'enter' key rather than clicking 'OK'. */ 

textField1.value= textField1.value.substring(0,250) 
// set field's value equal to first five characters. 

textField1.blur() 
/* move cursor out of form element to keep it from placing itself at position zero, causing an overwrite of the first character */

alert("You have exceeded the maximum number of characters allowed, 250.") 
}


if(textField2.value.length > 250){ 
/* must be > 5, not == 5 or else the substring statement on the next line will cause the function to run again if the user dismisses the alert by pressing the 'enter' key rather than clicking 'OK'. */ 

textField2.value= textField2.value.substring(0,250)
// set field's value equal to first five characters. 

textField2.blur() 
/* move cursor out of form element to keep it from placing itself at position zero, causing an overwrite of the first character */

alert("You have exceeded the maximum number of characters allowed, 250.") 
}


if(textField3.value.length > 250){ 
/* must be > 5, not == 5 or else the substring statement on the next line will cause the function to run again if the user dismisses the alert by pressing the 'enter' key rather than clicking 'OK'. */ 

textField3.value= textField3.value.substring(0,250) 
// set field's value equal to first five characters. 

textField3.blur() 
/* move cursor out of form element to keep it from placing itself at position zero, causing an overwrite of the first character */

alert("You have exceeded the maximum number of characters allowed, 250.") 
}

} 

function same_as_member(nr){

	eval("document.co_member_form.co_address"+nr+"_1.value=document.co_member_form.address"+nr+"_1.value")
	eval("document.co_member_form.co_address"+nr+"_2.value=document.co_member_form.address"+nr+"_2.value")
	eval("document.co_member_form.co_city_"+nr+".value=document.co_member_form.city_"+nr+".value")
	eval("document.co_member_form.co_state_"+nr+".value=document.co_member_form.state_"+nr+".value")
	eval("document.co_member_form.co_zip_"+nr+"a.value=document.co_member_form.zip_"+nr+"a.value")
	eval("document.co_member_form.co_zip_"+nr+"b.value=document.co_member_form.zip_"+nr+"b.value")
	eval("document.co_member_form.co_email.value=document.co_member_form.email.value")
	
	for (i=1;i<=3;i++){
		eval("document.co_member_form.co_phone_home_"+nr+"_"+i+".value=document.co_member_form.phone_home_"+nr+"_"+i+".value")
		eval("document.co_member_form.co_phone_cell_"+nr+"_"+i+".value=document.co_member_form.phone_cell_"+nr+"_"+i+".value")
		eval("document.co_member_form.co_phone_work_"+nr+"_"+i+".value=document.co_member_form.phone_work_"+nr+"_"+i+".value")
		eval("document.co_member_form.co_phone_other_"+nr+"_"+i+".value=document.co_member_form.phone_other_"+nr+"_"+i+".value")
		
	}
}

function check_contacts(){
	var test=0;
	var j=0;
	aa=new Array();
	
	for (i=0;i<document.contact_form.elements.length;i++)
	{
		var temp=document.contact_form.elements[i].name;
		temp=temp.slice(0,13);
		
		if (temp=='contact_fname')
		{
			aa[j]=document.contact_form.elements[i].value;
			if(aa[j]!="") test+=1;
			j++;
		}
		
	}	
	
	if (test==0)
	{
		alert('Enter at least 1 emergency contact');
		document.contact_form.elements[0].focus();
	}	
	else
	{
		var test=0;
		var j=0;
		var phonevalue='';
		var checkphone=0;
		aa=new Array();
		
		for (i=0;i<document.contact_form.elements.length;i++)
		{
			var temp=document.contact_form.elements[i].name;
			var temp2=document.contact_form.elements[i].name;
			var temp3=document.contact_form.elements[i].name;
			temp=temp.slice(0,10);

			temp3=temp3.slice(11,12);
			
			if (temp=='phone_home' || temp=='phone_cell' || temp=='phone_work')
			{
				var varlength = 3;
				var varname1 = '';
				var varname2 = '';

				if(temp3 == 1)
				{
					varname1 = ' area code';
				}
				
				if(temp3 == 2)
				{
					varname1 = ' suffix';
				}

				if(temp3 == 3)
				{
					varname1 = '';
					varlength = 4;
				}
				
				checkphone=0;

				if (temp=='phone_home')
				{					
					if(document.contact_form.elements[i].value!="") checkphone+=1;
					varname2 = 'home';
				}
				
				if (temp=='phone_cell')
				{							
					if(document.contact_form.elements[i].value!="") checkphone+=1;
					varname2 = 'cell';
				}

				if (temp=='phone_work')
				{								
					if(document.contact_form.elements[i].value!="") checkphone+=1;
					varname2 = 'work';
				}

				if(checkphone > 0 && document.contact_form.elements[i].value.length != varlength)
				{
					alert('Please enter ' + varlength + ' digits for the ' + varname2 + ' phone' + varname1 + '.');
					document.contact_form.elements[i].focus();
					return;
				}


				aa[j]=document.contact_form.elements[i].value;				
				if(aa[j]!="") test+=1;
				j++;
			}
			
			temp2=temp2.slice(0,11);
			
			checkphone=0;
			if (temp2=='phone_other')
			{
				var varlength = 3;
				var varname1 = '';
				
				if(document.contact_form.elements[i].value!="") checkphone+=1;

				if(temp3 == 1)
				{
					varname1 = ' area code';
				}
				
				if(temp3 == 2)
				{
					varname1 = ' suffix';
				}

				if(temp3 == 3)
				{
					varname1 = '';
					varlength = 4;
				}
				
				if(checkphone > 0 && document.contact_form.elements[i].value.length != varlength)
				{
					alert('Please enter ' + varlength + ' digits for the other phone' + varname1 + '.');
					document.contact_form.elements[i].focus();
					return;
				}

				aa[j]=document.contact_form.elements[i].value;
				if(aa[j]!="") test+=1;
				j++;
			}
		}

		if (test==0)
		{
			alert('At least 1 contact number is required.')
			document.contact_form.elements[3].focus();
		}	
		else
		{
			document.contact_form.submit();	
		}
	}	
}

function check_user_pass(){
	var fn = document.user_pass_form.fname.value;
	var ln = document.user_pass_form.lname.value;

	var un = document.user_pass_form.username.value;
	var pw = document.user_pass_form.pass.value;
	var pw2 = document.user_pass_form.pass2.value;
	var em = document.user_pass_form.email.value;


	
	if (fn=="" ){
		alert('Please enter your first name.');
		document.user_pass_form.fname.focus();
		return;
	}
	if (ln=="" ){
		alert('Please enter your last name.');
		document.user_pass_form.lname.focus();
		return;
	}


	if (un=="" || un.length<=5 ){
		alert('The username must be at least 6 chars long.');
		document.user_pass_form.username.focus();
		return;
	}	
	

	
	if (pw=="" || pw.length<=5 ){
		alert('Password must be at least 6 chars long.');
		document.user_pass_form.pass.focus();
		return;
	}

	if (pw!=pw2 ){
		alert('Passwords do not match.');
		document.user_pass_form.pass2.focus();
		return;
	}

	if (em=="" ){
		alert('Please enter your email.');
		document.user_pass_form.email.focus();
		return;
	}
		

		var goodEmail = document.user_pass_form.email.value.match(/\b(^(\S+@).+((\.com)|(\.net)|(\.edu)|(\.mil)|(\.gov)|(\.org)|(\..{2,2}))$)\b/gi);
		if (!goodEmail){
			alert("Please include a proper email address, of the form id@domain.zzz or id@domain.xx.zzz.")
			document.user_pass_form.email.focus()
			return ;
    	}	
			
	var un=document.user_pass_form.security_code.value;
	if (un!=""){
	var le2=un.length;
		for (i=0;i<le2;i++)  {
            u=un.charCodeAt(i);
        	uu=un.charAt(i);
			if (u<48 || u>57){
				alert('Security code must contain only integers.');
				document.user_pass_form.security_code.focus();
				return;
			}
		}
	}		

	document.user_pass_form.submit();	

}
/////////////////////////////////
/////////////////////////////////

function check_co_member_info(){
	/*
	var fn = document.co_member_form.co_fname.value;
	var ln = document.co_member_form.co_lname.value;

	var em = document.co_member_form.co_email.value;
	
	if (fn=="" ){
		alert('Please enter the first name.');
		document.co_member_form.co_fname.focus();
		return;
	}
	if (ln=="" ){
		alert('Please enter the last name.');
		document.co_member_form.co_lname.focus();
		return;
	}
	
	if (document.co_member_form.co_gender.value=="" ){
		alert('Please select a gender.');
		document.co_member_form.co_gender.focus();
		return;
	}

	if (document.co_member_form.co_address1_1.value=="" ){
		alert('Please enter the address.');
		document.co_member_form.co_address1_1.focus();
		return;
	}

	if (document.co_member_form.co_city_1.value=="" ){
		alert('Please enter the city.');
		document.co_member_form.co_city_1.focus();
		return;
	}
	if (document.co_member_form.co_zip_1a.value=="" ){
		alert('Please enter the zip.');
		document.co_member_form.co_zip_1a.focus();
		return;
	}	
	*/

	phone_home_1=document.co_member_form.co_phone_home_1_1.value+document.co_member_form.co_phone_home_1_2.value+document.co_member_form.co_phone_home_1_3.value;
	phone_cell_1=document.co_member_form.co_phone_cell_1_1.value+document.co_member_form.co_phone_cell_1_2.value+document.co_member_form.co_phone_cell_1_3.value;
	phone_work_1=document.co_member_form.co_phone_work_1_1.value+document.co_member_form.co_phone_work_1_2.value+document.co_member_form.co_phone_work_1_3.value
	phone_other_1=document.co_member_form.co_phone_other_1_1.value+document.co_member_form.co_phone_other_1_2.value+document.co_member_form.co_phone_other_1_3.value
	
	/*
	if (phone_home_1=="" && phone_cell_1=="" && phone_work_1=="" && phone_other_1==""){
		alert('Please enter at least one primary contact number.');
		return;
	}
	*/

	if (phone_home_1!="")
	{
		if(document.co_member_form.co_phone_home_1_1.value.length != 3)
		{
			alert('Please enter 3 digits for the home phone area code.');
			document.co_member_form.co_phone_home_1_1.focus();
			return;
		}

		if(document.co_member_form.co_phone_home_1_2.value.length != 3)
		{
			alert('Please enter 3 digits for the home phone prefix.');
			document.co_member_form.co_phone_home_1_2.focus();
			return;
		}

		if(document.co_member_form.co_phone_home_1_3.value.length != 4)
		{
			alert('Please enter 4 digits for the home phone.');
			document.co_member_form.co_phone_home_1_3.focus();
			return;
		}
	}

	if (phone_cell_1!="")
	{
		if(document.co_member_form.co_phone_cell_1_1.value.length != 3)
		{
			alert('Please enter 3 digits for the cell phone area code.');
			document.co_member_form.co_phone_cell_1_1.focus();
			return;
		}

		if(document.co_member_form.co_phone_cell_1_2.value.length != 3)
		{
			alert('Please enter 3 digits for the cell phone prefix.');
			document.co_member_form.co_phone_cell_1_2.focus();
			return;
		}

		if(document.co_member_form.co_phone_cell_1_3.value.length != 4)
		{
			alert('Please enter 4 digits for the cell phone.');
			document.co_member_form.co_phone_cell_1_3.focus();
			return;
		}
	}
	
	if (phone_work_1!="")
	{
		if(document.co_member_form.co_phone_work_1_1.value.length != 3)
		{
			alert('Please enter 3 digits for the work phone area code.');
			document.co_member_form.co_phone_work_1_1.focus();
			return;
		}

		if(document.co_member_form.co_phone_work_1_2.value.length != 3)
		{
			alert('Please enter 3 digits for the work phone prefix.');
			document.co_member_form.co_phone_work_1_2.focus();
			return;
		}

		if(document.co_member_form.co_phone_work_1_3.value.length != 4)
		{
			alert('Please enter 4 digits for the work phone.');
			document.co_member_form.co_phone_work_1_3.focus();
			return;
		}
	}

	if (phone_other_1!="")
	{
		if(document.co_member_form.co_phone_other_1_1.value.length != 3)
		{
			alert('Please enter 3 digits for the other phone area code.');
			document.co_member_form.co_phone_other_1_1.focus();
			return;
		}

		if(document.co_member_form.co_phone_other_1_2.value.length != 3)
		{
			alert('Please enter 3 digits for the other phone prefix.');
			document.co_member_form.co_phone_other_1_2.focus();
			return;
		}

		if(document.co_member_form.co_phone_other_1_3.value.length != 4)
		{
			alert('Please enter 4 digits for the other phone.');
			document.co_member_form.co_phone_other_1_3.focus();
			return;
		}	
	}

	phone_home_2=document.co_member_form.co_phone_home_2_1.value+document.co_member_form.co_phone_home_2_2.value+document.co_member_form.co_phone_home_2_3.value;
	phone_cell_2=document.co_member_form.co_phone_cell_2_1.value+document.co_member_form.co_phone_cell_2_2.value+document.co_member_form.co_phone_cell_2_3.value;
	phone_work_2=document.co_member_form.co_phone_work_2_1.value+document.co_member_form.co_phone_work_2_2.value+document.co_member_form.co_phone_work_2_3.value
	phone_other_2=document.co_member_form.co_phone_other_2_1.value+document.co_member_form.co_phone_other_2_2.value+document.co_member_form.co_phone_other_2_3.value

	if (phone_home_2!="")
	{
		if(document.co_member_form.co_phone_home_2_1.value.length != 3)
		{
			alert('Please enter 3 digits for the home phone area code.');
			document.co_member_form.co_phone_home_2_1.focus();
			return;
		}

		if(document.co_member_form.co_phone_home_2_2.value.length != 3)
		{
			alert('Please enter 3 digits for the home phone prefix.');
			document.co_member_form.co_phone_home_2_2.focus();
			return;
		}

		if(document.co_member_form.co_phone_home_2_3.value.length != 4)
		{
			alert('Please enter 4 digits for the home phone.');
			document.co_member_form.co_phone_home_2_3.focus();
			return;
		}
	}

	if (phone_cell_2!="")
	{
		if(document.co_member_form.co_phone_cell_2_1.value.length != 3)
		{
			alert('Please enter 3 digits for the cell phone area code.');
			document.co_member_form.co_phone_cell_2_1.focus();
			return;
		}

		if(document.co_member_form.co_phone_cell_2_2.value.length != 3)
		{
			alert('Please enter 3 digits for the cell phone prefix.');
			document.co_member_form.co_phone_cell_2_2.focus();
			return;
		}

		if(document.co_member_form.co_phone_cell_2_3.value.length != 4)
		{
			alert('Please enter 4 digits for the cell phone.');
			document.co_member_form.co_phone_cell_2_3.focus();
			return;
		}
	}
	
	if (phone_work_2!="")
	{
		if(document.co_member_form.co_phone_work_2_1.value.length != 3)
		{
			alert('Please enter 3 digits for the work phone area code.');
			document.co_member_form.co_phone_work_2_1.focus();
			return;
		}

		if(document.co_member_form.co_phone_work_2_2.value.length != 3)
		{
			alert('Please enter 3 digits for the work phone prefix.');
			document.co_member_form.co_phone_work_2_2.focus();
			return;
		}

		if(document.co_member_form.co_phone_work_2_3.value.length != 4)
		{
			alert('Please enter 4 digits for the work phone.');
			document.co_member_form.co_phone_work_2_3.focus();
			return;
		}
	}

	if (phone_other_2!="")
	{
		if(document.co_member_form.co_phone_other_2_1.value.length != 3)
		{
			alert('Please enter 3 digits for the other phone area code.');
			document.co_member_form.co_phone_other_2_1.focus();
			return;
		}

		if(document.co_member_form.co_phone_other_2_2.value.length != 3)
		{
			alert('Please enter 3 digits for the other phone prefix.');
			document.co_member_form.co_phone_other_2_2.focus();
			return;
		}

		if(document.co_member_form.co_phone_other_2_3.value.length != 4)
		{
			alert('Please enter 4 digits for the other phone.');
			document.co_member_form.co_phone_other_2_3.focus();
			return;
		}	
	}
	
	/*
	if (em=="" ){
		alert('Please enter the email.');
		document.co_member_form.co_email.focus();
		return;
	}

		var goodEmail = document.co_member_form.co_email.value.match(/\b(^(\S+@).+((\.com)|(\.net)|(\.edu)|(\.mil)|(\.gov)|(\.org)|(\..{2,2}))$)\b/gi);
		if (!goodEmail){
			alert("Please include a proper email address, of the form id@domain.zzz or id@domain.xx.zzz.")
			document.co_member_form.co_email.focus()
			return ;
    	}	
	*/
	
	document.co_member_form.submit();	
			
}

/////////////////////////////////

function filter_input(e)
{
	e = (e) ? e : ((event) ? event : null);

	if(e.keyCode == 8 || e.keyCode == 37 || e.keyCode == 39 || e.keyCode == 46 || (e.keyCode > 47 && e.keyCode < 58) || (e.keyCode > 95 && e.keyCode < 106))
	{
		return true;
	}
	
	return false;
}

/////////////////////////////////

function check_member_info(){
	var fn = document.member_info_form.fname.value;
	var ln = document.member_info_form.lname.value;

	var em = document.member_info_form.email.value;
	
	if (fn=="" ){
		alert('Please enter your first name.');
		document.member_info_form.fname.focus();
		return;
	}
	
	if (ln=="" ){
		alert('Please enter your last name.');
		document.member_info_form.lname.focus();
		return;
	}
	
	if (document.member_info_form.gender.value=="" ){
		alert('Please select your gender.');
		document.member_info_form.gender.focus();
		return;
	}

	if (document.member_info_form.address1_1.value=="" ){
		alert('Please enter your address.');
		document.member_info_form.address1_1.focus();
		return;
	}

	if (document.member_info_form.city_1.value=="" ){
		alert('Please enter your city.');
		document.member_info_form.city_1.focus();
		return;
	}
	
	if (document.member_info_form.zip_1a.value=="" ){
		alert('Please enter your zip.');
		document.member_info_form.zip_1a.focus();
		return;
	}	

	phone_home_1=document.member_info_form.phone_home_1_1.value+document.member_info_form.phone_home_1_2.value+document.member_info_form.phone_home_1_3.value;
	phone_cell_1=document.member_info_form.phone_cell_1_1.value+document.member_info_form.phone_cell_1_2.value+document.member_info_form.phone_cell_1_3.value;
	phone_work_1=document.member_info_form.phone_work_1_1.value+document.member_info_form.phone_work_1_2.value+document.member_info_form.phone_work_1_3.value
	phone_other_1=document.member_info_form.phone_other_1_1.value+document.member_info_form.phone_other_1_2.value+document.member_info_form.phone_other_1_3.value

	if (phone_home_1=="" && phone_cell_1=="" && phone_work_1=="" && phone_other_1==""){
		alert('Please enter at least one primary contact number.');
		return;
	}		
	
	if (phone_home_1!="")
	{
		if(document.member_info_form.phone_home_1_1.value.length != 3)
		{
			alert('Please enter 3 digits for the home phone area code.');
			document.member_info_form.phone_home_1_1.focus();
			return;
		}

		if(document.member_info_form.phone_home_1_2.value.length != 3)
		{
			alert('Please enter 3 digits for the home phone prefix.');
			document.member_info_form.phone_home_1_2.focus();
			return;
		}

		if(document.member_info_form.phone_home_1_3.value.length != 4)
		{
			alert('Please enter 4 digits for the home phone.');
			document.member_info_form.phone_home_1_3.focus();
			return;
		}
	}

	if (phone_cell_1!="")
	{
		if(document.member_info_form.phone_cell_1_1.value.length != 3)
		{
			alert('Please enter 3 digits for the cell phone area code.');
			document.member_info_form.phone_cell_1_1.focus();
			return;
		}

		if(document.member_info_form.phone_cell_1_2.value.length != 3)
		{
			alert('Please enter 3 digits for the cell phone prefix.');
			document.member_info_form.phone_cell_1_2.focus();
			return;
		}

		if(document.member_info_form.phone_cell_1_3.value.length != 4)
		{
			alert('Please enter 4 digits for the cell phone.');
			document.member_info_form.phone_cell_1_3.focus();
			return;
		}
	}
	
	if (phone_work_1!="")
	{
		if(document.member_info_form.phone_work_1_1.value.length != 3)
		{
			alert('Please enter 3 digits for the work phone area code.');
			document.member_info_form.phone_work_1_1.focus();
			return;
		}

		if(document.member_info_form.phone_work_1_2.value.length != 3)
		{
			alert('Please enter 3 digits for the work phone prefix.');
			document.member_info_form.phone_work_1_2.focus();
			return;
		}

		if(document.member_info_form.phone_work_1_3.value.length != 4)
		{
			alert('Please enter 4 digits for the work phone.');
			document.member_info_form.phone_work_1_3.focus();
			return;
		}
	}

	if (phone_other_1!="")
	{
		if(document.member_info_form.phone_other_1_1.value.length != 3)
		{
			alert('Please enter 3 digits for the other phone area code.');
			document.member_info_form.phone_other_1_1.focus();
			return;
		}

		if(document.member_info_form.phone_other_1_2.value.length != 3)
		{
			alert('Please enter 3 digits for the other phone prefix.');
			document.member_info_form.phone_other_1_2.focus();
			return;
		}

		if(document.member_info_form.phone_other_1_3.value.length != 4)
		{
			alert('Please enter 4 digits for the other phone.');
			document.member_info_form.phone_other_1_3.focus();
			return;
		}	
	}
	
	phone_home_2=document.member_info_form.phone_home_2_1.value+document.member_info_form.phone_home_2_2.value+document.member_info_form.phone_home_2_3.value;
	phone_cell_2=document.member_info_form.phone_cell_2_1.value+document.member_info_form.phone_cell_2_2.value+document.member_info_form.phone_cell_2_3.value;
	phone_work_2=document.member_info_form.phone_work_2_1.value+document.member_info_form.phone_work_2_2.value+document.member_info_form.phone_work_2_3.value
	phone_other_2=document.member_info_form.phone_other_2_1.value+document.member_info_form.phone_other_2_2.value+document.member_info_form.phone_other_2_3.value

	if (phone_home_2!="")
	{
		if(document.member_info_form.phone_home_2_1.value.length != 3)
		{
			alert('Please enter 3 digits for the home phone area code.');
			document.member_info_form.phone_home_2_1.focus();
			return;
		}

		if(document.member_info_form.phone_home_2_2.value.length != 3)
		{
			alert('Please enter 3 digits for the home phone prefix.');
			document.member_info_form.phone_home_2_2.focus();
			return;
		}

		if(document.member_info_form.phone_home_2_3.value.length != 4)
		{
			alert('Please enter 4 digits for the home phone.');
			document.member_info_form.phone_home_2_3.focus();
			return;
		}
	}

	if (phone_cell_2!="")
	{
		if(document.member_info_form.phone_cell_2_1.value.length != 3)
		{
			alert('Please enter 3 digits for the cell phone area code.');
			document.member_info_form.phone_cell_2_1.focus();
			return;
		}

		if(document.member_info_form.phone_cell_2_2.value.length != 3)
		{
			alert('Please enter 3 digits for the cell phone prefix.');
			document.member_info_form.phone_cell_2_2.focus();
			return;
		}

		if(document.member_info_form.phone_cell_2_3.value.length != 4)
		{
			alert('Please enter 4 digits for the cell phone.');
			document.member_info_form.phone_cell_2_3.focus();
			return;
		}
	}
	
	if (phone_work_2!="")
	{
		if(document.member_info_form.phone_work_2_1.value.length != 3)
		{
			alert('Please enter 3 digits for the work phone area code.');
			document.member_info_form.phone_work_2_1.focus();
			return;
		}

		if(document.member_info_form.phone_work_2_2.value.length != 3)
		{
			alert('Please enter 3 digits for the work phone prefix.');
			document.member_info_form.phone_work_2_2.focus();
			return;
		}

		if(document.member_info_form.phone_work_2_3.value.length != 4)
		{
			alert('Please enter 4 digits for the work phone.');
			document.member_info_form.phone_work_2_3.focus();
			return;
		}
	}

	if (phone_other_2!="")
	{
		if(document.member_info_form.phone_other_2_1.value.length != 3)
		{
			alert('Please enter 3 digits for the other phone area code.');
			document.member_info_form.phone_other_2_1.focus();
			return;
		}

		if(document.member_info_form.phone_other_2_2.value.length != 3)
		{
			alert('Please enter 3 digits for the other phone prefix.');
			document.member_info_form.phone_other_2_2.focus();
			return;
		}

		if(document.member_info_form.phone_other_2_3.value.length != 4)
		{
			alert('Please enter 4 digits for the other phone.');
			document.member_info_form.phone_other_2_3.focus();
			return;
		}	
	}

	if (em=="" ){
		alert('Please enter your email.');
		document.member_info_form.email.focus();
		return;
	}

		var goodEmail = document.member_info_form.email.value.match(/\b(^(\S+@).+((\.com)|(\.net)|(\.edu)|(\.mil)|(\.gov)|(\.org)|(\..{2,2}))$)\b/gi);
		if (!goodEmail){
			alert("Please include a proper email address, of the form id@domain.zzz or id@domain.xx.zzz.")
			document.member_info_form.email.focus()
			return ;
    	}	
			
	/*if (document.member_info_form.company_id2.value!="" && document.member_info_form.company_id.value==""){
		alert('Please enter the Employer ID.');
		document.member_info_form.company_id.focus()
		return;
	}

	if (document.member_info_form.company_id2.value=="" && document.member_info_form.company_id.value!=""){
		alert('Please select the Employer.')
		document.member_info_form.company_id2.focus()
		return;
	}*/

	document.member_info_form.submit();	
				
}

	
	// returns the objects ref variable when the name is passed.
	function getControlName(controlName)
	{
		var control;
		var formname='member_info_form';
//		alert(formname);
	   	control = eval('document.' + formname+ '.elements') ;
	   	var j;
		for (j=0; j < control.length; j++)
		{
			var inner = control[j];
			//alert("name " + inner.name + "controlName " +  controlName);
			if (inner.name.toUpperCase() == controlName.toUpperCase()) 
			{	
				return inner;
			}
		}
		return "";	
	}	


	// returns the objects ref variable when the name is passed.
	function getControlName2(controlName)
	{
		var control;
		var formname='contact_form';
//		alert(formname);
	   	control = eval('document.' + formname+ '.elements') ;
	   	var j;
		for (j=0; j < control.length; j++)
		{
			var inner = control[j];
			//alert("name " + inner.name + "controlName " +  controlName);
			if (inner.name.toUpperCase() == controlName.toUpperCase()) 
			{	
				return inner;
			}
		}
		return "";	
	}	

	
	
function MoveNext(objFrom,objTo,len)	
	{
		var strFrom="";
		strFrom=objFrom.value;
		
		var FromLen;
		FromLen=strFrom.length;
		if(FromLen==parseInt(len))
		{
			objTo.focus();
		}
}


function check_contact_us_form(){
	var fn = document.contact_us_form.first_name.value;
	var ln = document.contact_us_form.last_name.value;		
	var em = document.contact_us_form.contact_email.value;
	var ph = document.contact_us_form.contact_phone.value;
	
	for(i=0;i<document.contact_us_form.contact_method.length;i++)
	{
		if(document.contact_us_form.contact_method[i].checked)
		{
			var cm = document.contact_us_form.contact_method[i].value;			
		}
	}

	if (fn=="" ){
		alert('Please enter the first name.');
		document.contact_us_form.first_name.focus();
		return false;
	}
	
	if (ln=="" ){
		alert('Please enter the last name.');
		document.contact_us_form.last_name.focus();
		return false;
	}

	if (document.contact_us_form.category.value=="None" ){
		alert('Please select a category.');
		document.contact_us_form.category.focus();
		return false;
	}

	if (cm=="E-Mail" ){
		if (em=="") {
			alert('Please enter your email address.');
			document.contact_us_form.contact_email.focus();
			return false;
		}
		var goodEmail = document.contact_us_form.contact_email.value.match(/\b(^(\S+@).+((\.com)|(\.net)|(\.edu)|(\.mil)|(\.gov)|(\.org)|(\..{2,2}))$)\b/gi);
		if (!goodEmail){
			alert("Please include a proper email address, of the form id@domain.zzz or id@domain.xx.zzz.")
			document.contact_us_form.contact_email.focus()
			return false;
    	}
	}

	if (cm=="Telephone" ){
		if (ph=="") {
			alert('Please enter your phone number.');
			document.contact_us_form.contact_phone.focus();
			return false;
		}
	}
			
	//document.contact_us_form_form.submit();				
}

function logout()
{
	location.href = "index.php?goto=logout";
}