function addColorSwitch() {
inputlist = document.getElementsByTagName('input');
textarealist = document.getElementsByTagName('textarea');

	for (i=0 ; i<inputlist.length ; i++) {
		inputlist[i].onfocus = function() {
			switchColor(this);
			}
		;
		inputlist[i].onblur = function() {
			switchColorBack(this);
			}
		;
	}
		
	for (i=0 ; i<textarealist.length ; i++) {
		textarealist[i].onfocus = function() {
			switchColor(this);
			}
		;
		textarealist[i].onblur = function() {
			switchColorBack(this);
			}
		;
	}
}

function switchColor(e) {
	e.style.borderColor = '#99cc33';
}

function switchColorBack(e) {
	e.style.borderColor = '#666';
}

window.onload=function() {
	addColorSwitch();
}