function clearVoterForm(){
	document.voter.voter_id.value=''; 
	document.voter.first_name.value='';
	document.voter.middle_name.value='';
	document.voter.last_name.value='';
	document.voter.bday_month.value='MM';
	document.voter.bday_year.value='YYYY';
	document.voter.bday_day.value='DD';
	for(i=0;i<document.voter.county_code.options.length;i++){
		if(document.voter.county_code.options[i].value == document.voter.county_reset.value){
		//	alert(document.voter.county_code.options[document.voter.county_code.selectedIndex].value);
			document.voter.county_code.selectedIndex = i;
			break;
		}
	}
	document.voter.county_code_2.value = document.voter.county_reset.value;
	document.voter.status_a.checked = 'checked';
	document.voter.status_i.checked = 'checked';
	document.voter.status_d.checked = false;
	document.voter.pa_dem.checked = 'checked';
	document.voter.pa_ind.checked = 'checked';
	document.voter.pa_rep.checked = 'checked';
	document.voter.soundex.checked = false;
	document.voter.precinct_code.value = '';
}

function changeTab(tabname,role){
	if(role == 1){
		tabs = new Array('mailing', 'residence', 'str', 'polling', 'system', 'activity', 'history');
	}else{
		tabs = new Array('mailing', 'residence', 'str', 'polling', 'activity', 'history');
	}
	for(i=0;i<tabs.length; i++){
				//alert(tabs[i]);
				the_tab = document.getElementById(tabs[i]);
				if(the_tab.className != 'tab-disabled'){
					the_tab.className = 'tab-unselected';
				}
	}
	document.getElementById(tabname).className = 'tab-selected';

}

function initTab(){
	if(document.forms.length >0){
		document.forms[0].elements[0].focus();
	}
}

function precinct2county(precinct){
	
	var county_code = precinct.substring(0,2);
	document.getElementById('county_code_2').value = county_code;
		j=0;
		for(i=0;i<document.getElementById('county_code').options.length;i++){
			if(document.getElementById('county_code').options[i].value == county_code){
				document.getElementById('county_code').selectedIndex = i;
			}else{
				j++;
			}
		}
		if(document.voter.county_code.options.length == j){
			alert('Invalid County Code');
			document.voter.county_code_2.value = document.voter.county_reset.value;
		}
}

