function indexInArray(arr,val){
	for(var i=0;i<arr.length;i++) {
		if(val.indexOf(arr[i])>0) {
			return i;
		}
	}
	return -1;
} 

function gotourl(url) {
	if(url == "") {
		return false;
	} else {
		location.href=url;
	}
	
}

function search_showcitystatebox() {
	$("#zipcitystatebox").empty().html($("#citystatebox").html());
}
function search_showzipbox() {
	$("#zipcitystatebox").empty().html($("#zipbox").html());
}

function searchValidateZip(fieldname,type) {
  //type: zipcode, city, state
  //fieldname: name of form field
  //use: onsubmit="return searchValidateZip(document.searchForm2.searchZip,'zipcode')"
  var v = fieldname.value;
  
  if(type == "procedure") {
    if(v == "") {
      alert("Please enter a procedure");
      return false;
    }
  } else {//zip
    if(v.length != 5 || isNaN(v)) {
      alert("Please enter a valid zipcode");
      fieldname.focus();
      return false;
    }
  }
  return true;
}

