	function check_reg_form(frm){
		// check the form for errors
		//var bChecked=false;
		var blank= new String();

		bChecked=false;
		

		// salutation
		if(frm.salutation.value.length == 0){
		  blank+='Salutation\n';
		}

		// f name
		if(frm.f_name.value.length == 0){
			blank+='First Name\n';
		}

		// l name
		if(frm.l_name.value.length == 0){
			blank+='Last Name\n';
		}

		// address
		if(frm.addr_1.value.length == 0){
			blank+='Address\n';
		}

		// city
		if(frm.city.value.length == 0){
			blank+='City\n';
		}

		// state
		if(frm.st.value.length != 2){
			blank +='State\n';
		}

		// zip
		if(frm.zip.value.length != 5){
			blank+='Zip Code\n';
		}

		// day phone
		if(frm.d_phone_areacode.value.length != 3 || frm.d_phone_exchange.value.length != 3 || frm.d_phone_number.value.length != 4){
			blank+='Daytime Phone\n';
		}

		/*// if evening phone filled in, check lengths
		if((frm.e_phone_areacode.value.length + frm.e_phone_exchange.value.length + frm.e_phone_number.value.length) > 0){
			if(frm.e_phone_areacode.value.length != 3 || frm.e_phone_exchange.value.length != 3 || frm.e_phone_number.value.length != 4){
				blank+='Evening Phone\n';
			}
		}*/

		// if fax filled in, check lengths
		if((frm.fax_areacode.value.length + frm.fax_exchange.value.length + frm.fax_number.value.length) > 0){
			if(frm.fax_areacode.value.length != 3 || frm.fax_exchange.value.length != 3 || frm.fax_number.value.length != 4){
				blank+='Fax\n';
			}
		}
        
        //audio_visual needs
        
        //alert(frm.audio_visual_other.value.length);
        /*if(frm.present_sessions.value=="on"){
           var total_checked=0;
           for(var i=1;i<=6;i++){
            if(frm.elements["audio_visual["+i+"]"].checked==true){
                total_checked+=1;
            }
           }
           //alert(total_checked);
           //alert(frm.elements["audio_visual[6]"].checked);
           //alert(frm.audio_visual_other.value.length);
           if(total_checked==0){
                blank+='Audiovisual needs\n';
           }else{
            if(frm.elements["audio_visual[6]"].checked==true && frm.audio_visual_other.value.length == 0 ){
                //alert("here");
                blank+='Audiovisual needs: Other-please specify\n';
            }
           }
        }*/
        
        //lodging
        //if(frm.name!="sd_state_staff"){
        //alert(frm.eligible_for_lodging.value);
        if(frm.conference_id.value!="38")
        {
            if(frm.lodging.value==""){
                    blank +='Need lodging\n';
            }
            
            //if(frm.is_team.value==""){
            //        blank +='Team?\n';
            //}
        
            
            if(frm.eligible_for_lodging.value=="Y"){
           
                    if(frm.lodging.value=="Y" && frm.name=="confirmation"){
                        // checkin
                        if(frm.checkin.value.length == 0){
                          blank+='Check-In Date\n';
                        }
                
                        // checkout
                        if(frm.checkout.value.length == 0){
                            blank+='Check-Out Date\n';
                        }
                
                        // l room
                        //if(frm.room.value.length == 0){
                        //    blank+='Room Type\n';
                        //}
        
                    }
            }
        
        }
		// email
		if(frm.email.value.length == 0){
			blank+='Email Address\n';
		}

		if(blank.length>0){
			alert('This form has several required fields. Your data has been checked and the following fields are blank or are not in the correct format:\n\n'+blank+'\n\nPlease fill in the fields listed and re-submit the form');
			//frm.name.focus();
			return false;
		} else {
			if(verify_email(frm.email.value)){
				// check in dates
				/*
					if(frm.check_in_date){
						if(frm.check_in_date.selectedIndex == 2 && frm.check_out_date.selectedIndex == 1){
							alert('You have selected the same day for check-in and check-out.');
							return false;
						}
					}
				*/
				return true;
			} else {
				alert ('The email address you entered does not appear to be valid. Please double check it.');
				frm.email.focus();
				return false;
			}
		}
  }

function check_preconf_meeting_form(frm){
        // check the form for errors
		//var bChecked=false;
		var blank= new String();

		
		if(frm.will_attend[0].checked==false && frm.will_attend[1].checked==false){
			blank+='Do you plan to attend one of the Preconference Meetings?\n';
		}
		
		if(blank.length>0){
			alert('This form has several required fields. Your data has been checked and the following fields are blank or are not in the correct format:\n\n'+blank+'\n\nPlease fill in the fields listed and re-submit the form');
			//frm.name.focus();
			return false;
		} 
}
function check_pinvalidation_form(frm){
		// check the form for errors
		//var bChecked=false;
		var blank= new String();

		bChecked=false;
		// checkin
		if(frm.pin.value.length == 0 || frm.pin.value.length!=8){
		  blank+='PIN is not valid\n';
		}

        //alert(frm.live_how_far[1].checked);
		if(frm.live_how_far[0].checked==false && frm.live_how_far[1].checked==false){
			blank+='How far is your home or job from Washington, DC?\n';
		}
        
        if(frm.job_function[0].checked==false && frm.job_function[1].checked==false && frm.job_function[2].checked==false){
			blank+='Please select the choice that best describes your job title or function\n';
		}
        
		/*
        if(frm.fed_emp[0].checked==false && frm.fed_emp[1].checked==false){
			blank+='2.	Are you employed by the Federal Government or a CSAT Addiction Technology Transfer Center (ATTC)? \n';
		}
        */
		
		if(blank.length>0){
			alert('This form has several required fields. Your data has been checked and the following fields are blank or are not in the correct format:\n\n'+blank+'\n\nPlease fill in the fields listed and re-submit the form');
			//frm.name.focus();
			return false;
		} 
  }

function check_screen1_form(frm){
		// check the form for errors
		//var bChecked=false;
		var blank= new String();

		bChecked=false;
		
        //Are you an employee of the Federal Government?
		if(frm.fed_emp[0].checked==false && frm.fed_emp[1].checked==false){
			blank+='Are you an employee of the Federal Government?\n';
		}

		//Are you scheduled to present or facilitate any sessions at the conference?
        if(frm.present_sessions[0].checked==false && frm.present_sessions[1].checked==false){
			blank+='Are you scheduled to present or facilitate any sessions at the conference?\n';
		}

		//Are you a confirmed conference exhibitor? 
        if(frm.exhibitor[0].checked==false && frm.exhibitor[1].checked==false){
			blank+='Are you a confirmed conference exhibitor? \n';
		}
        
        //Are you a State Director? 
        if(frm.sd[0].checked==false && frm.sd[1].checked==false){
			blank+='Are you a State Director? \n';
		}
        
        //Did you receive a PIN from either the director of the State substance abuse agency in your State or from JBS?
        if(frm.has_pin[0].checked==false && frm.has_pin[1].checked==false){
			blank+='Did you receive a PIN from either the director of the State substance abuse agency in your State or from JBS?\n';
		}
        
		if(blank.length>0){
			alert('This form has several required fields. Your data has been checked and the following fields are blank or are not in the correct format:\n\n'+blank+'\n\nPlease fill in the fields listed and re-submit the form');
			//frm.name.focus();
			return false;
		} 
  }
  
  function check_screen1_2_form(frm){
		// check the form for errors
		//var bChecked=false;
		var blank= new String();

		bChecked=false;
		
        //Are you a DSCA Staff?
		if(frm.is_dsca_staff[0].checked==false && frm.is_dsca_staff[1].checked==false){
			blank+='Are you a DSCA Staff?\n';
		}
        
		if(blank.length>0){
			alert('This form has several required fields. Your data has been checked and the following fields are blank or are not in the correct format:\n\n'+blank+'\n\nPlease fill in the fields listed and re-submit the form');
			//frm.name.focus();
			return false;
		} 
  }
  
function check_lodging_form(frm){
		// check the form for errors
		//var bChecked=false;
		var blank= new String();

		bChecked=false;
		// checkin
        //alert(frm.checkin.value.length);
		if(frm.checkin.value.length == 0){
		  blank+='Check-In Date\n';
		}

		// checkout
		if(frm.checkout.value.length == 0){
			blank+='Check-Out Date\n';
		}

		// l room
		//if(frm.room.value.length == 0){
		//	blank+='Room Type\n';
		//}

		
		if(blank.length>0){
			alert('This form has several required fields. Your data has been checked and the following fields are blank or are not in the correct format:\n\n'+blank+'\n\nPlease fill in the fields listed and re-submit the form');
			//frm.name.focus();
			return false;
		} 
  }



	function verify_eligibility(chk){
		//
		if(chk.checked == true)
		{
			chk.checked = false ;
			var popup = window.open('eligibility.htm',popup,'top=40,left=40,height=400,width=500,menubar=yes,scrollbars=yes,resizable=yes');
		}
	}

	function verify_email(str) {
		//field.value.match(/\b(^(\S+@).+( (\.com)|(\.net)|(\.edu)|(\.mil)|(\.gov)|(\.org)| (\..{2,2}) )$)\b/gi);
		// ends with: +( (\.com)|(\.biz)|(\.net)|(\.edu)|(\.mil)|(\.gov)|(\.org)| (\..{2,2}) )$
		if(!str.match(/^[\w]{1}[\w\.\-_]*@[\w]{1}[\w\-_\.]*\.[\w]{2,3}$/i)) {
			return false;
		} else {
			return true;
		}
	}

	function printPage() {
		//if (window.print) {
			agree = confirm('You have succesfully registered for the conference!\n\nThis confirmation page contains important information and \nwe recommend that you print it at this time. \n\nWould you like to print it now?');
			if (agree) window.print();
		//}
  }

/*

	function set_hotel_defaults(){
		frm = document.forms['registration'];
		// when they first select yes for hotel, set
		// defaults for other lodging fields
		if(frm.stay_at_hotel.selectedIndex == 1){
			// set defaults
			if(frm.check_in_date.selectedIndex == 0){
				frm.check_in_date.selectedIndex = 1;
			}
			if(frm.check_out_date.selectedIndex == 0){
				frm.check_out_date.selectedIndex = 1;
			}
			if(frm.room_size.selectedIndex == 0){
				frm.room_size.selectedIndex = 1;
			}
			if(frm.room_type.selectedIndex == 0){
				frm.room_type.selectedIndex = 1;
			}
		}
	}

	function swap_addr_1(eAddr){
		// eAddr is address_1
		// a_abbr is array of regular expressions which will match on the abreviations
		// a_expanded is matching array of expaned words
		// keep these in sync!

		var strTemp = new String();
		var newString = new String(eAddr.value);
		var myRegExp = new RegExp();


		//a_abbr = new Array(/ ave /i,/ av /i,/ blvd /i,/ ctr /i,/ cir /i,/ cswy /i,/ ct /i,/ cres /i,/ dr /i,/ expy /i,/ hts /i,/ hwy /i,/ jct /i,/ la /i,/ ln /i,/ pkwy /i,/ plz /i,/ pl /i,/ rdg /i,/ rd /i,/ rte /i,/ sq /i,/ sqr /i,/ sta /i,/ stn /i,/ str /i,/ st /i,/ tpke /i,/ tpk /i);
		a_expanded = new Array(' Avenue','Avenue','Boulevard','Center','Circle','Causeway','Court','Crescent','Drive','Expressway','Heights','Highway','Junction','Lane','Lane','Parkway','Plaza','Place','Ridge','Road','Route','Square','Square','Station','Station','Street','Street','Turnpike','Turnpike');
		a_abbr = new Array(/\sst/i,/\sstr/i,/\sav/i);
		// need to detect the change and exit, other wise newString is set back to original
		for(var i=0;i<a_abbr.length;i++){
			myRegExp.compile(a_abbr[i]);
			newString = eAddr.value.replace(myRegExp,a_expanded[i]);
			if(newString != eAddr.value){
				strTemp = newString;
			}
		}
		alert('i: ' + i + '\n\norig: ' + eAddr.value + '\n\nstrTemp: ' + strTemp + '\n\nnewString: ' + newString);
		//document.registration.addr_1.value = newString;
	}

	function swap_addr_2(eAddr){
		a_abbr = new Array('apt','bsmt','bldg','dept','fl','frnt','hngr','lbby','lowr','ofc','ph','rm','ste','trlr','uppr');
    a_expanded = new Array('Apartment','Basement','Building','Department','Floor','Front','Hangar','Lobby','Lower','Office','Penthouse','Room','Suite','Trailer','Upper');
	}
*/

	//function set_conference(conference1,conference2)
	//{
	//	//if( conference1 == true)
	//	//{
	//		document.registration.conference_1.checked = conference1 ;
//	//	}
	//	//if( conference2 == 'true' )
//	//	{
	//		document.registration.conference_2.checked = conference2 ;
	//	//}
	//}

	function autofill(){
		//var popup = window.open('find_my_rec.php?c1='+conf1+'&c2='+conf2,popup,'top=60,left=60,height=275,width=380,menubar=yes,scrollbars=yes,resizable=yes');
        var popup = window.open('find_my_rec.php',popup,'top=60,left=60,height=275,width=380,menubar=yes,scrollbars=yes,resizable=yes');
	}

	function open_degrees(){
		var popup = window.open('degrees.php',popup,'top=40,left=40,height=600,width=425,menubar=yes,scrollbars=yes,resizable=yes');
	}
	function open_credentials(){
		var popup = window.open('credentials.php',popup,'top=40,left=40,height=600,width=425,menubar=yes,scrollbars=yes,resizable=yes');
	}
