function trim(s) {
  while (s.substring(0,1) == ' ') {
    s = s.substring(1,s.length);
  }
  while (s.substring(s.length-1,s.length) == ' ') {
    s = s.substring(0,s.length-1);
  }
  return s;
}

function focus_first_field(){
	var set = false;
	for(i=0; i < document.forms[0].length; i++){
		if (document.forms[0][i].type != "hidden" && document.forms[0][i].disabled != true){
			document.forms[0][i].focus();
			var set = true;
		}
		if (set == true){
			break;
		}
	}
}
