function checkFieldType(type){
  if(type == "submit" || type == "reset" || type == "hidden"){
    return false;
  }
  else {
    return true;
  }
}

function SmartFocusFields(){
  var FocusPages = new Array();
  FocusPages[0] = "contact-webcommons";

  var locVar = location.href;

  var formExists = (document.forms[0]) ? document.forms[0] : null;

  if(formExists){ //first check to see if there is a form on this page
    var FocusPage = false;
    
    for(var i=0; i<FocusPages.length; i++){ // begin looping through noFocusPages array

      if(locVar.indexOf(FocusPages[i]) > -1){ // is this a 'no-focus' page?
        FocusPage = true;
        break;
      }
    } //end Focus for

    if(FocusPage == true){ //this page is a focus page, so focus if there is appropriate field

      for(var e=0; e<formExists.elements.length; e++){

        if(checkFieldType(formExists.elements[e].type) && (formExists.elements[e].name != "s")){
          formExists.elements[e].focus();
          break;
        }

      }// end elements for

    }//end if

  } //end formExists if
}