//color row rolloever
color=0;
function rowOver(obj){
    color=obj.style.backgroundColor;
    obj.style.backgroundColor = '#EEE6E3';
}
function rowOut(obj){
    obj.style.backgroundColor = color;
}  
// next element is used by validation and autotab functions
function nextElement(theElement){
	document.getElementById(theElement).focus();
}
//
function autoTab(currentElement, theNextElement, maxLength){
	if(document.getElementById(currentElement).value.length==maxLength){
		nextElement(theNextElement);
	}
}
//addEvent uses the appropriate method of attaching a listener for DOM standard and IE
//generic function called by addListeners
function addEvent(elm, evType, fn, useCapture){
	if (elm.addEventListener){
		elm.addEventListener(evType, fn, useCapture);
		return true;
	}else if (elm.attachEvent){
		var r=elm.attachEvent('on'+evType, fn);
		return r;
	}else{
		elm['on'+evType]=fn;
	}
}
//applySelect selects the text in input text fields
function applySelect(e){
	//IE
	if(window.event){
		window.event.srcElement.select();
	//others
	}else{
		e.target.select();
	}
}
//listeners for text input fields
function addListeners(){
	//make sure browser can support the methods used
	if(!document.getElementsByTagName) return;
	
	var allInputs = document.getElementsByTagName('input')
	//alert(allInputs.length);
	for (var i=0; i<allInputs.length; i++){
		if(allInputs[i].type == 'text'){
			addEvent(allInputs[i], 'focus', applySelect, false);
		}
	}
}
addEvent(window,'load',addListeners,false);