function PDF10_clicked_claim (id, label, dest) {
	if(document.getElementById(id).checked) 
	{ 
		document.getElementById(id).value ="yes"; 
		document.getElementById('div_'+dest).innerHTML ="<label id='label_"+dest+"'>"+label+"</label>"; 
	} else {
		var name = document.getElementById(id).name; 
		setSessionVar(name, "no");	// not yes; need to circumvent post values
		document.getElementById(id).value ="no"; 
		document.getElementById('div_'+dest).innerHTML =""; 
	}
}

function PDF10_print_name() {
	var name = document.getElementById('input_PDF10_NAME').value;
	document.getElementById('input_PDF10_PRINT_NAME').value = name;
}	

var forms;
var form;
var elem;
function validate_PDF10() {
	//confirm('validate_PDF10')
	forms = document.forms;
	for (var i = 0; i < forms.length; i++) { 
		form = document.getElementById(forms[i].id)
		form.length
		for(var e = 0; e < form.length; e++) {
			elem = form.elements[e];
			if(elem.type == 'text') {
				//confirm(elem.value);	
				if(elem.value == '') {
					// FF hack: title='optional' prevents hidden fields from getting focus 
					if(elem.title != 'optional') {
						elem.focus();	// go to element 
						return false;
					}
				}
			}
			var en;
			var enc;
			var fe;
			if(elem.type == 'radio') {
				// ARGH!  This won't catch the last set
				//confirm(elem.name+'; '+elem.checked);
				if(!en) {
					//confirm('en empty first time');
					fe = elem;
					en = elem.name;
					enc = elem.checked;
				}
				if(en == elem.name) {
					//confirm('en == elem.name');
					enc = (enc || elem.checked);
				} else {
					//confirm('en != elem.name');
					if(!enc) {
						fe.focus(); 
						return false;	// nothing selected
					}
				}
			}
			if(elem.type == 'select-one') {
				//confirm(elem.id);	
				//confirm(elem.selectedIndex);	
				if(elem.selectedIndex == 0) {
					elem.focus();	// go to element 
					return false;
				}
			}
		}
	}
}

var input_PDF10_NAME;
input_PDF10_NAME = function() {
	var name = document.getElementById('input_PDF10_NAME').value;
	// the printed name is empty fill
	if(document.getElementById('input_PDF10_PRINT_NAME').value == '') {
		document.getElementById('input_PDF10_PRINT_NAME').value = name;
	}
	tabbing = false;
}
var input_PDF10_NAME_error;
input_PDF10_NAME_error = function() {
	document.getElementById('input_PDF10_NAME').focus();
}

var input_PDF10_BUSINESS_NAME;
input_PDF10_BUSINESS_NAME = function() {
	tabbing = false;
} 
var input_PDF10_BUSINESS_NAME_error; 
input_PDF10_BUSINESS_NAME_error = function() {
	document.getElementById('input_PDF10_BUSINESS_NAME').focus();
}

var select_PDF10_BUSINESS_TYPE
select_PDF10_BUSINESS_TYPE = function() {
	tabbing = false;
}

var select_PDF10_BUSINESS_TYPE_error
select_PDF10_BUSINESS_TYPE_error = function() {
	document.getElementById('select_PDF10_BUSINESS_TYPE').focus();
}

var input_PDF10_STREET;
input_PDF10_STREET = function() {
	tabbing = false;
} 
var input_PDF10_STREET_error; 
input_PDF10_STREET_error = function() {
	document.getElementById('input_PDF10_STREET').focus();
}

var input_PDF10_POC;
input_PDF10_POC = function() {
	tabbing = false;
} 
var input_PDF10_POC_error; 
input_PDF10_POC_error = function() {
	document.getElementById('input_PDF10_POC').focus();
}

// proxy_set is used for the purpose of display error messages in a better position 
function proxy_set(from, to) {
	var innerHTML = document.getElementById(from).innerHTML;
	document.getElementById(to).innerHTML = innerHTML;
	document.getElementById(from).innerHTML = '';
}

// proxy_clear is used for clearing the error message created by the benefactor 
function proxy_clear(to) {
	document.getElementById(to).innerHTML = '';
}

var input_PDF10_CITY
input_PDF10_CITY = function() {
	proxy_clear('input_PDF10_STREET_error');
	tabbing = false;
}	

var input_PDF10_CITY_error
input_PDF10_CITY_error = function() {
	proxy_set('input_PDF10_CITY_error','input_PDF10_STREET_error');
	document.getElementById('input_PDF10_CITY').focus();
}	

var select_PDF10_STATE
select_PDF10_STATE = function() {
	proxy_clear('input_PDF10_STREET_error');
	tabbing = false;
}

var select_PDF10_STATE_error
select_PDF10_STATE_error = function() {
	proxy_set('select_PDF10_STATE_error','input_PDF10_STREET_error');
	document.getElementById('select_PDF10_STATE').focus();
}

var input_PDF10_ZIP
input_PDF10_ZIP = function() {
	proxy_clear('input_PDF10_STREET_error');
	tabbing = false;
}	

var input_PDF10_ZIP_error
input_PDF10_ZIP_error = function() {
	proxy_set('input_PDF10_ZIP_error','input_PDF10_STREET_error');
	document.getElementById('input_PDF10_ZIP').focus();
}	

var input_PDF10_PHONE
input_PDF10_PHONE = function() {
	proxy_clear('input_PDF10_FAX_error');
	tabbing = false;
}	

var input_PDF10_PHONE_error
input_PDF10_PHONE_error = function() {
	proxy_set('input_PDF10_PHONE_error','input_PDF10_FAX_error');
	document.getElementById('input_PDF10_PHONE').focus();
}	

var input_PDF10_FAX
input_PDF10_FAX = function() {
	tabbing = false;
}	

var input_PDF10_FAX_error
input_PDF10_FAX_error = function() {
	// not required
	//document.getElementById('input_PDF10_FAX').focus();
	var innerHTML = document.getElementById('input_PDF10_FAX_error').innerHTML;
	document.getElementById('input_PDF10_FAX_error').innerHTML = 'Optional: '+innerHTML;
	tabbing = false;
}	

var input_PDF10_EMAIL;
input_PDF10_EMAIL = function() {
	tabbing = false;
} 

var input_PDF10_EMAIL_error; 
input_PDF10_EMAIL_error = function() {
	document.getElementById('input_PDF10_EMAIL').focus();
}

var select_PDF10_CONTACT_TYPE
select_PDF10_CONTACT_TYPE = function() {
	tabbing = false;
}

var select_PDF10_CONTACT_TYPE_error
select_PDF10_CONTACT_TYPE_error = function() {
	document.getElementById('select_PDF10_CONTACT_TYPE').focus();
}

var select_PDF10_BUSINESS_CATEGORY
select_PDF10_BUSINESS_CATEGORY = function() {
	tabbing = false;
}

var select_PDF10_BUSINESS_CATEGORY_error
select_PDF10_BUSINESS_CATEGORY_error = function() {
	document.getElementById('select_PDF10_CONTACT_TYPE').focus();
}

var input_PDF10_EVENT_DESCRIPTIONS;
input_PDF10_EVENT_DESCRIPTIONS = function() {
	proxy_clear('label_PDF10_EVENT_error');
	tabbing = false;
} 
var input_PDF10_EVENT_DESCRIPTIONS_error; 
input_PDF10_EVENT_DESCRIPTIONS_error = function() {
	proxy_set('input_PDF10_EVENT_DESCRIPTIONS_error','label_PDF10_EVENT_error');
	document.getElementById('input_PDF10_EVENT_DESCRIPTIONS').focus();
}

var input_PDF10_EVENT_NUMBER;
input_PDF10_EVENT_NUMBER = function() {
	proxy_clear('label_PDF10_EVENT_error');
	tabbing = false;
} 
var input_PDF10_EVENT_NUMBER_error; 
input_PDF10_EVENT_NUMBER_error = function() {
	proxy_set('input_PDF10_EVENT_NUMBER_error','label_PDF10_EVENT_error');
	document.getElementById('input_PDF10_EVENT_NUMBER').focus();
}

var input_PDF10_EVENT_DAYS;
input_PDF10_EVENT_DAYS = function() {
	proxy_clear('label_PDF10_EVENT_error');
	tabbing = false;
} 
var input_PDF10_EVENT_DAYS_error; 
input_PDF10_EVENT_DAYS_error = function() {
	proxy_set('input_PDF10_EVENT_DAYS_error','label_PDF10_EVENT_error');
	document.getElementById('input_PDF10_EVENT_DAYS').focus();
}

var input_PDF10_EVENT_STATES;
input_PDF10_EVENT_STATES = function() {
	proxy_clear('label_PDF10_EVENT_error');
	tabbing = false;
} 
var input_PDF10_EVENT_STATES_error; 
input_PDF10_EVENT_STATES_error = function() {
	proxy_set('input_PDF10_EVENT_STATES_error','label_PDF10_EVENT_error');
	document.getElementById('input_PDF10_EVENT_STATES').focus();
}

var input_PDF10_EMPLOYEES_PT_NUMBER;
input_PDF10_EMPLOYEES_PT_NUMBER = function() {
	proxy_clear('label_PDF10_EMPLOYEES_error');
	tabbing = false;
} 
var input_PDF10_EMPLOYEES_PT_NUMBER_error; 
input_PDF10_EMPLOYEES_PT_NUMBER_error = function() {
	proxy_set('input_PDF10_EMPLOYEES_PT_NUMBER_error','label_PDF10_EMPLOYEES_error');
	document.getElementById('input_PDF10_EMPLOYEES_PT_NUMBER').focus();
}

var input_PDF10_PDF10_EMPLOYEES_FT_NUMBER;
input_PDF10_PDF10_EMPLOYEES_FT_NUMBER = function() {
	proxy_clear('label_PDF10_EMPLOYEES_error');
	tabbing = false;
} 
var input_PDF10_PDF10_EMPLOYEES_FT_NUMBER_error; 
input_PDF10_PDF10_EMPLOYEES_FT_NUMBER_error = function() {
	proxy_set('input_PDF10_PDF10_EMPLOYEES_FT_NUMBER_error','label_PDF10_EMPLOYEES_error');
	document.getElementById('input_PDF10_PDF10_EMPLOYEES_FT_NUMBER').focus();
}

var input_PDF10_YEARS_IN_BUSINESS;
input_PDF10_YEARS_IN_BUSINESS = function() {
	tabbing = false;
} 
var input_PDF10_YEARS_IN_BUSINESS_error; 
input_PDF10_YEARS_IN_BUSINESS_error = function() {
	document.getElementById('input_PDF10_YEARS_IN_BUSINESS').focus();
}

var input_PDF10_YEARS_OF_EXPERIENCE;
input_PDF10_YEARS_OF_EXPERIENCE = function() {
	tabbing = false;
} 
var input_PDF10_YEARS_OF_EXPERIENCE_error; 
input_PDF10_YEARS_OF_EXPERIENCE_error = function() {
	document.getElementById('input_PDF10_YEARS_OF_EXPERIENCE').focus();
}

var input_PDF10_RESPONSIBLE;
input_PDF10_RESPONSIBLE = function() {
	tabbing = false;
} 
var input_PDF10_RESPONSIBLE_error; 
input_PDF10_RESPONSIBLE_error = function() {
	document.getElementById('input_PDF10_RESPONSIBLE').focus();
}

function PDF10_clicked_signature (id) {
	if(document.getElementById(id).checked) 
	{ 
		setSessionVar(id, "yes");	// not yes; need to circumvent post values
		document.getElementById(id).value ="yes"; 
		document.getElementById('label_PDF10_SIGNATURE').innerHTML ="I approve of this transaction."; 
	} else {
		setSessionVar(id, "no");	// not yes; need to circumvent post values
		document.getElementById(id).value ="no"; 
		document.getElementById('label_PDF10_SIGNATURE').innerHTML ="By checking this box, in lieu of my signature, I approve of this transaction."; 
	}
}

function PDF10_checkbox_with_effect (id) {
	var name = document.getElementById(id).name;
	if(document.getElementById(id).checked) 
	{ 
		getSessionVar(name+'_yes', 'label_'+name+'_effect')	// performs innerHTML on arg 2
		setSessionVar(id, "yes");	// not yes; need to circumvent post values
		document.getElementById(id).value ="yes"; 
	} else {
		getSessionVar(name+'_no', 'label_'+name+'_effect')	
		setSessionVar(id, "no");	// not yes; need to circumvent post values
		document.getElementById(id).value ="no"; 
	}
}

/*
// test case
var input_PDF10_QUERY_EFFECT
input_PDF10_QUERY_EFFECT = function() {
	// checkbox_with_effect($name, $query, $answer, $attributes, $top) sets vars _query & _answer
	var checked = document.getElementById('input_PDF10_QUERY_EFFECT').checked;
	if(checked) {
		getSessionVar('PDF10_QUERY_EFFECT_answer', 'label_PDF10_QUERY_EFFECT');
	} else {
		getSessionVar('PDF10_QUERY_EFFECT_query', 'label_PDF10_QUERY_EFFECT');
	}
	tabbing = false;
}	

// test case
var input_PDFn_QUERY_REQUIRED
input_PDFn_QUERY_REQUIRED = function() {
	tabbing = false;
}
var input_PDFn_QUERY_REQUIRED_error
input_PDFn_QUERY_REQUIRED_error = function() {
	document.getElementById('input_PDFn_QUERY_REQUIRED').focus();
}

// test case
var textarea_PDFn_TEXTAREA
textarea_PDFn_TEXTAREA = function() {
	tabbing = false;
}
var textarea_PDFn_TEXTAREA_REQUIRED_error
textarea_PDFn_TEXTAREA_REQUIRED_error = function() {
	confirm('textarea_PDFn_TEXTAREA_REQUIRED - This field is not required.  Should not get here.');
}

var textarea_PDFn_TEXTAREA_REQUIRED
textarea_PDFn_TEXTAREA_REQUIRED = function() {
	tabbing = false;
}
var textarea_PDFn_TEXTAREA_REQUIRED_error
textarea_PDFn_TEXTAREA_REQUIRED_error = function() {
	document.getElementById('textarea_PDFn_TEXTAREA_REQUIRED').focus();
}

*/

/*
var PDFn_clicked_signature;
function PDFn_clicked_signature (id) {
	if(document.getElementById(id).checked) 
	{ 
		setSessionVar(id, "yes");	// not yes; need to circumvent post values
		document.getElementById(id).value ="yes"; 
		document.getElementById('label_SIGNATURE').innerHTML ="I approve of this transaction."; 
	} else {
		setSessionVar(id, "no");	// not yes; need to circumvent post values
		document.getElementById(id).value ="no"; 
		document.getElementById('label_SIGNATURE').innerHTML ="By checking this box, in lieu of my signature, I approve of this transaction."; 
	}
}
*/

/*
var month; 
var day;
var year;
var days;
var tabindex;

var input_PDFn_EVENT_DAYS;
input_PDFn_EVENT_DAYS = function() {
	// calculate calendar date from to
	//month = parseInt(document.getElementById('select_PDFn_DATE_FROM_MONTH').value);
	month = document.getElementById('select_PDFn_DATE_FROM_MONTH').value;
	day = document.getElementById('select_PDFn_DATE_FROM_DAY').value;
	//year = parseInt(document.getElementById('select_PDFn_DATE_FROM_YEAR').value);
	year = document.getElementById('select_PDFn_DATE_FROM_YEAR').value;
	days = document.getElementById('input_PDFn_EVENT_DAYS').value;
	setSessionVar('month',month);
	setSessionVar('day',day);
	setSessionVar('year',year);
	setSessionVar('days',days);
	//confirm(month+':'+day+':'+year+'plus'+days);
	if((month != 0) && (day != 0) && (year != 'default')) {
		var to_date = PDFn_get_to_date('get_to_date','days','tag');
	}
	tabbing = false;
}	

function PDFn_get_to_date(id, name, tag) {
	//mywindow = window.open("","_blank", "toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=yes, resizable=no, copyhistory=no, width=800");
	var xmlHttp = newXmlHttp();
	var post_pairs = 'sid='+Math.random()+
		'&id='+id+
		'&name='+name+
		'&tag='+tag
	xmlHttp.onreadystatechange = function() {
		if(xmlHttp.readyState == 4) {
			if(mywindow) mywindow.document.write(xmlHttp.responseText);
			var to_date = xmlHttp.responseText.split(",");
			//confirm(to_date);
			document.getElementById('select_PDFn_DATE_TO_MONTH').value = to_date[0];
			document.getElementById('select_PDFn_DATE_TO_DAY').value = to_date[1];
			document.getElementById('select_PDFn_DATE_TO_YEAR').value = to_date[2];
			// insures values are available since disabled lists are not returned by Submit
			month = document.getElementById('select_PDFn_DATE_TO_MONTH').value;
			day = document.getElementById('select_PDFn_DATE_TO_DAY').value;
			year = document.getElementById('select_PDFn_DATE_TO_YEAR').value;
			setSessionVar('PDFn_DATE_TO_MONTH',month);
			setSessionVar('PDFn_DATE_TO_DAY',day);
			setSessionVar('PDFn_DATE_TO_YEAR',year);
		}
	}
	//confirm(post_pairs);	
	xmlHttp.open("POST", "Ajax/text.php", true); 
	xmlHttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");	
	xmlHttp.send(post_pairs);  	
}

var input_PDFn_EVENT_DAYS_error
input_PDFn_EVENT_DAYS_error = function() {
	document.getElementById('input_PDFn_EVENT_DAYS').focus();
}	

var select_PDFn_DATE_FROM_MONTH
select_PDFn_DATE_FROM_MONTH = function() {
	// make sure year has been set first
	if(document.getElementById('select_PDFn_DATE_FROM_YEAR').value == 'default') {
		document.getElementById('select_PDFn_DATE_FROM_YEAR').focus();
		document.getElementById('select_PDFn_DATE_FROM_YEAR_error').innerHTML = "Please, select a year prior to selecting a month.";
		tabbing = false;
	}
	id = 'select_PDFn_DATE_FROM_MONTH';
	name = 'PDFn_DATE_FROM_MONTH';
	tag = 'select';
	//month = document.getElementById('select_PDFn_DATE_FROM_MONTH').selectedIndex;
	month = document.getElementById('select_PDFn_DATE_FROM_MONTH').value;
	setSessionVar('month',month);
	tabindex = document.getElementById('select_PDFn_DATE_FROM_DAY').tabIndex;
	setSessionVar('tabindex',tabindex);
	//year = document.getElementById('select_PDFn_DATE_FROM_YEAR').selectedIndex;
	year = document.getElementById('select_PDFn_DATE_FROM_YEAR').value;
	setSessionVar('year',year);
	setSessionVar('table_id','PDFn');
	//mywindow = window.open("","_blank", "toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=yes, resizable=no, copyhistory=no, width=800");
	var xmlHttp = newXmlHttp();
	var post_pairs = 'sid='+Math.random()+
		'&id='+id+
		'&name='+name+
		'&tag='+tag
	xmlHttp.onreadystatechange = function() {
		if(xmlHttp.readyState == 4) {
			if(mywindow) mywindow.document.write(xmlHttp.responseText);
			if(xmlHttp.responseText.indexOf("ERROR:") == 0)	{
				document.getElementById(id+'_error').innerHTML = xmlHttp.responseText.replace(/ERROR:/, "");
				eval(id+'_error()');
			} else {
				document.getElementById('span_PDFn_DATE_FROM_DAY').innerHTML = xmlHttp.responseText;	
				document.getElementById(id+'_error').innerHTML = '';	
			}
		}
	}
	//confirm(post_pairs);	
	xmlHttp.open("POST", "Ajax/select_one.php", true); 
	xmlHttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");	
	xmlHttp.send(post_pairs);  	
	tabbing = false;
}

var select_PDFn_DATE_FROM_MONTH_error
select_PDFn_DATE_FROM_MONTH_error = function() {
	//document.getElementById('select_PDFn_DATE_FROM_YEAR').focus();
}

var select_PDFn_DATE_FROM_DAY
select_PDFn_DATE_FROM_DAY = function() {
	// make sure month has been set first
	if(document.getElementById('select_PDFn_DATE_FROM_MONTH').value == 'default') {
		document.getElementById('select_PDFn_DATE_FROM_MONTH').focus();
		document.getElementById('select_PDFn_DATE_FROM_MONTH_error').innerHTML = "Please, select a month prior to selecting a day.";
	}
	tabbing = false;
}

var select_PDFn_DATE_FROM_DAY_error
select_PDFn_DATE_FROM_DAY_error = function() {
	//document.getElementById('select_PDFn_DATE_FROM_MONTH').focus();
}

var select_PDFn_DATE_FROM_YEAR
select_PDFn_DATE_FROM_YEAR = function() {
	//year = document.getElementById('select_PDFn_DATE_FROM_YEAR').selectedIndex;
	year = document.getElementById('select_PDFn_DATE_FROM_YEAR').value;
	setSessionVar('year',year);
	next_name = 'PDFn_DATE_FROM_MONTH';
	setSessionVar('next_name',next_name);
	document.getElementById('select_PDFn_DATE_FROM_YEAR_error').innerHTML = '';

	tabindex = document.getElementById('select_PDFn_DATE_FROM_MONTH').tabIndex;
	setSessionVar('tabindex',tabindex);
	setSessionVar('table_id','PDFn');
	var id = 'select_PDFn_DATE_FROM_YEAR';
	var name = 'PDFn_DATE_FROM_YEAR';
	var tag = 'select';
	
	var xmlHttp = newXmlHttp();
	var post_pairs = 'sid='+Math.random()+
		'&id='+id+
		'&name='+name+
		'&tag='+tag
	xmlHttp.onreadystatechange = function() {
		if(xmlHttp.readyState == 4) {
			if(mywindow) mywindow.document.write(xmlHttp.responseText);
			if(xmlHttp.responseText.indexOf("ERROR:") == 0)	{
				document.getElementById(id+'_error').innerHTML = xmlHttp.responseText.replace(/ERROR:/, "");
				eval(id+'_error()');
			} else {
				document.getElementById('span_PDFn_DATE_FROM_MONTH').innerHTML = xmlHttp.responseText;	
				document.getElementById(id+'_error').innerHTML = '';	
			}
		}
	}
	//confirm(post_pairs);	
	xmlHttp.open("POST", "Ajax/select_one.php", true); 
	xmlHttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");	
	xmlHttp.send(post_pairs);  	
	tabbing = false;

}

var select_PDFn_DATE_FROM_YEAR_error
select_PDFn_DATE_FROM_YEAR_error = function() {
	//document.getElementById('select_PDFn_DATE_FROM_MONTH').focus();
}

var select_PDFn_DATE_TO_MONTH
select_PDFn_DATE_TO_MONTH = function() {
	tabbing = false;
}

var select_PDFn_DATE_TO_MONTH_error
select_PDFn_DATE_TO_MONTH_error = function() {
	//document.getElementById('select_PDFn_DATE_FROM_MONTH').focus();
}

var select_PDFn_DATE_TO_DAY
select_PDFn_DATE_TO_DAY = function() {
	tabbing = false;
}

var select_PDFn_DATE_TO_DAY_error
select_PDFn_DATE_TO_DAY_error = function() {
	//document.getElementById('select_PDFn_DATE_TO_MONTH').focus();
}

var select_PDFn_DATE_TO_YEAR
select_PDFn_DATE_TO_YEAR = function() {
	tabbing = false;
}

var select_PDFn_DATE_TO_YEAR_error
select_PDFn_DATE_TO_YEAR_error = function() {
	//document.getElementById('select_PDFn_DATE_TO_MONTH').focus();
}
*/