// gets the URL Parameter.. ex index.php?test=ok, if you search for test it will return ok
function getURLParam(strParamName){
  var strReturn = "";
  var strHref = window.location.href;

  if (strHref.match(strParamName) != null) { return 1; }
  else { return 0; }
}

// found form field to set focus to
var bFound = false;
 
// set # of forms to look to
var formNumToLoad = 1; 	// set focus to second form

// as long as the form is > 1 set next form to first field
if (document.forms.length >= 1) {
	
	// for each form\
	for (f=0; f < document.forms.length; f++) {

// for each element in each form
		for(i=0; i < document.forms[f].length; i++) {
			
		  // if it's not a hidden element, disabled and is text
		  if (getURLParam("blog.html") == 0 && getURLParam("blogSearch.html") == 0 && document.forms[f][i].type != "hidden" && document.forms[f][i].disabled != true &&
				document.forms[f][i].type == "text" ||
				document.forms[f][i].type == "TEXT" ||
				document.forms[f][i].type == "Text") {

				document.forms[f][i].focus();
				bFound = true;
				break; 
				//else if (getURLParam("shopping_cart") == 1) { break; }
		  }
		  
		  // if found in this element, stop looking
		  if (bFound == true) break;
		}
		// if found in this form, stop looking
		if (bFound == true) break;
	}
}