window.onload=function() {

var tableRowOld

//Set default highlighting and selection
for(i=0;i<document.search.refType.length;i++)
	if(document.search.refType[i].checked){
		document.search.refType[i].parentNode.parentNode.parentNode.className="focusrow"
		tableRowOld = document.search.refType[i].parentNode.parentNode.parentNode
		tableRowOld.className="focusrow"
		}


//set listeners for row behavior
function FormRadioPair(textField,radioButton,tableRow){
	
		textField.onfocus = function(){
			tableRowOld.className="blurrow"
			tableRowOld.getElementsByTagName("input")[1].value=""
			tableRowOld=tableRow
			
			radioButton.checked=true
			
			tableRow.className="focusrow"
		}
		radioButton.onfocus = function(){
			tableRowOld.className="blurrow"
			tableRowOld.getElementsByTagName("input")[1].value=""
			tableRowOld=tableRow
			
			textField.focus()
			tableRow.className="focusrow"
		}
}
//create form pairs
new FormRadioPair(document.search.vin,document.search.refType[0],document.search.getElementsByTagName("tr")[0])
new FormRadioPair(document.search.plate,document.search.refType[1],document.search.getElementsByTagName("tr")[1])
new FormRadioPair(document.search.chassisnumber,document.search.refType[2],document.search.getElementsByTagName("tr")[3])
new FormRadioPair(document.search.modelcode,document.search.refType[3],document.search.getElementsByTagName("tr")[4])
}