function LogWebTrendsBasicPhysician() {
    var WT = _tag.WT;
    WT.z_Quick_Search = 1;
    _tag.dcsCollect();
}

function submitform()
{
    var zipcode = $("#zip").val();
    var speciality = $("#specialty").val();
    var lastname = $("#lastName").val();
    var radius = $("#radius").val();
    
    // Check to see if at least one option has been chosed
    if (zipcode == "" && speciality == "" && lastname == "") {
        alert("Please either provide or select some criteria prior to submitting the form.");
        return;
    }
    
    // Validate to see if entered zip code is 5 digits
    if (zipcode.length != 0 && zipcode.length != 5) 
    {
        alert("A 5-digit ZIP Code is required. Please re-enter your ZIP Code.");
        $("#zip").focus();
        return;
    }
    
    // Check to see if a valid speciality has been selected
    if (speciality == "-1")
    {
        alert("Please select a valid speciality.");
        $("#specialty").focus();
        return;
    }

    if (zipcode.length != 0 && radius.length == 0) {
        $("#radius").val("5");
    }
    
    // Call function to log webtrends for basic search (removed to avoid double counting)
    //LogWebTrendsBasicPhysician()
    
    // Submit form if all validation has passed
    $("#providerDir").submit();
}

//function entsub(event,ourform) {
//  if (event && event.which == 13) 
//  {
//    ourform.submit();
//  }
//  else
//  {
//    return true;
//  }
//}

function entsub(event,ourform) {
  if (event && event.which == 13) 
  {
    ourform.submit();
  }
  else
  {
    return true;
  }
}
function clearPage() {
	document.getElementById('andor1').innerHTML="OR";
	document.getElementById('andor1').innerHTML="OR";
	document.getElementById('searchBox_last').style.background="url('images/search_box_lastname_active.jpg')";
	document.getElementById('searchBox_zip').style.background="url('images/search_box_zip.jpg')";
	document.getElementById('searchBox_specialty').style.background="url('images/search_box_specialty.jpg')";
	document.getElementById('searchbutton_lastname').innerHTML="<a href='javascript:submitform()' tabstop='4'><img src='images/search_button_lastname.jpg' border='0'></a><br>";
	document.getElementById('searchbutton_zip').innerHTML="&nbsp;";
	document.getElementById('searchbutton_specialty').innerHTML="&nbsp;";
	document.providerDir.lastName.value="";
	document.providerDir.zip.value="";
	document.providerDir.specialty.value="";
	document.providerDir.lastName.focus();
}

function activateLastName() {
	if (document.providerDir.zip.value!="" && document.providerDir.specialty.value!="") {
		document.getElementById('andor1').innerHTML="AND";
		document.getElementById('andor2').innerHTML="AND";
		document.getElementById('searchbutton_lastname').innerHTML="&nbsp;";
		document.getElementById('searchbutton_zip').innerHTML="&nbsp;";
		document.getElementById('searchbutton_specialty').innerHTML="<a href='javascript:submitform()' tabstop='4'><img src='images/search_button_specialty_lastname_zip.jpg' border='0'></a><br>";
		
	}
	else {
		if (document.providerDir.zip.value!="" && document.providerDir.specialty.value=="") {
			document.getElementById('andor1').innerHTML="AND";
			document.getElementById('andor2').innerHTML="OR";
			document.getElementById('searchBox_specialty').style.background="url('images/search_box_specialty.jpg')";
			document.getElementById('searchbutton_lastname').innerHTML="&nbsp;";
			document.getElementById('searchbutton_specialty').innerHTML="&nbsp;";
			document.getElementById('searchbutton_zip').innerHTML="<a href='javascript:submitform()' tabstop='4'><img src='images/search_button_zip_lastname.jpg' border='0'></a><br>";
		}
		else {
			if (document.providerDir.zip.value=="" && document.providerDir.specialty.value!="") {
				document.getElementById('andor1').innerHTML="OR";
				document.getElementById('andor2').innerHTML="AND";
				document.getElementById('searchBox_zip').style.background="url('images/search_box_zip.jpg')";
				document.getElementById('searchbutton_lastname').innerHTML="&nbsp;";
				document.getElementById('searchbutton_zip').innerHTML="&nbsp;";
				document.getElementById('searchbutton_specialty').innerHTML="<a href='javascript:submitform()' tabstop='4'><img src='images/search_button_specialty_lastname.jpg' border='0'></a><br>";
			}
			else {
				if (document.providerDir.zip.value=="" && document.providerDir.specialty.value=="") {
					document.getElementById('andor1').innerHTML="OR";
					document.getElementById('andor2').innerHTML="OR";
					document.getElementById('searchBox_zip').style.background="url('images/search_box_zip.jpg')";
					document.getElementById('searchBox_specialty').style.background="url('images/search_box_specialty.jpg')";
					document.getElementById('searchbutton_lastname').innerHTML="<a href='javascript:submitform()' tabstop='4'><img src='images/search_button_lastname.jpg' border='0'></a><br>";
					document.getElementById('searchbutton_zip').innerHTML="&nbsp;";
					document.getElementById('searchbutton_specialty').innerHTML="&nbsp;";
				}
			}
		}
	}
	document.getElementById('searchBox_last').style.background="url('images/search_box_lastname_active.jpg')";
}

function activateZip() {
	if (document.providerDir.lastName.value!="" && document.providerDir.specialty.value!="") {
		document.getElementById('andor1').innerHTML="AND";
		document.getElementById('andor2').innerHTML="AND";
		document.getElementById('searchbutton_lastname').innerHTML="&nbsp;";
		document.getElementById('searchbutton_zip').innerHTML="&nbsp;";
		document.getElementById('searchbutton_specialty').innerHTML="<a href='javascript:submitform()' tabstop='4'><img src='images/search_button_specialty_lastname_zip.jpg' border='0'></a><br>";
	}
	else {
		if (document.providerDir.lastName.value!="" && document.providerDir.specialty.value=="") {
			document.getElementById('andor1').innerHTML="AND";
			document.getElementById('andor2').innerHTML="OR";
			document.getElementById('searchBox_specialty').style.background="url('images/search_box_specialty.jpg')";
			document.getElementById('searchbutton_lastname').innerHTML="&nbsp;";
			document.getElementById('searchbutton_zip').innerHTML="<a href='javascript:submitform()' tabstop='4'><img src='images/search_button_zip_lastname.jpg' border='0'></a><br>";
			document.getElementById('searchbutton_specialty').innerHTML="&nbsp;";
		}
		else {
			if (document.providerDir.lastName.value=="" && document.providerDir.specialty.value!="") {
				document.getElementById('andor1').innerHTML="OR";
				document.getElementById('andor2').innerHTML="AND";
				document.getElementById('searchBox_last').style.background="url('images/search_box_lastname.jpg')";
				document.getElementById('searchbutton_lastname').innerHTML="&nbsp;";
				document.getElementById('searchbutton_zip').innerHTML="&nbsp;";
				document.getElementById('searchbutton_specialty').innerHTML="<a href='javascript:submitform()' tabstop='4'><img src='images/search_button_specialty_zip.jpg' border='0'></a><br>";
			}
			else {
				if (document.providerDir.lastName.value=="" && document.providerDir.specialty.value=="") {
					document.getElementById('andor1').innerHTML="OR";
					document.getElementById('andor2').innerHTML="OR";
					document.getElementById('searchBox_last').style.background="url('images/search_box_lastname.jpg')";
					document.getElementById('searchBox_specialty').style.background="url('images/search_box_specialty.jpg')";
					document.getElementById('searchbutton_lastname').innerHTML="&nbsp;";
					document.getElementById('searchbutton_zip').innerHTML="<a href='javascript:submitform()' tabstop='4'><img src='images/search_button_zip.jpg' border='0'></a><br>";
					document.getElementById('searchbutton_specialty').innerHTML="&nbsp;";
				}
			}
		}
	}
	document.getElementById('searchBox_zip').style.background="url('images/search_box_zip_active.jpg')";
}

function activateSpecialty() {
	if (document.providerDir.lastName.value!="" && document.providerDir.zip.value!="") {
		document.getElementById('andor1').innerHTML="AND";
		document.getElementById('andor2').innerHTML="AND";
		document.getElementById('searchbutton_lastname').innerHTML="&nbsp;";
		document.getElementById('searchbutton_zip').innerHTML="&nbsp;";
		document.getElementById('searchbutton_specialty').innerHTML="<a href='javascript:submitform()' tabstop='4'><img src='images/search_button_specialty_lastname_zip.jpg' border='0'></a><br>";
	}
	else {
		if (document.providerDir.lastName.value!="" && document.providerDir.zip.value=="") {
			document.getElementById('andor1').innerHTML="OR";
			document.getElementById('andor2').innerHTML="AND";
			document.getElementById('searchbutton_lastname').innerHTML="&nbsp;";
			document.getElementById('searchbutton_zip').innerHTML="&nbsp;";
			document.getElementById('searchBox_zip').style.background="url('images/search_box_zip.jpg')";
			document.getElementById('searchbutton_specialty').innerHTML="<a href='javascript:submitform()' tabstop='4'><img src='images/search_button_specialty_lastname.jpg' border='0'></a><br>";
		}
		else {
			if (document.providerDir.lastName.value=="" && document.providerDir.zip.value!="") {
				document.getElementById('andor1').innerHTML="OR";
				document.getElementById('andor2').innerHTML="AND";
				document.getElementById('searchbutton_lastname').innerHTML="&nbsp;";
				document.getElementById('searchbutton_zip').innerHTML="&nbsp;";
				document.getElementById('searchBox_last').style.background="url('images/search_box_lastname.jpg')";
				document.getElementById('searchbutton_specialty').innerHTML="<a href='javascript:submitform()' tabstop='4'><img src='images/search_button_specialty_zip.jpg' border='0'></a><br>";
			}
			else {
				if (document.providerDir.lastName.value=="" && document.providerDir.zip.value=="") {
					document.getElementById('andor1').innerHTML="OR";
					document.getElementById('andor2').innerHTML="OR";
					document.getElementById('searchbutton_lastname').innerHTML="&nbsp;";
					document.getElementById('searchbutton_zip').innerHTML="&nbsp;";
					document.getElementById('searchBox_last').style.background="url('images/search_box_lastname.jpg')";
					document.getElementById('searchBox_zip').style.background="url('images/search_box_zip.jpg')";
					document.getElementById('searchbutton_specialty').innerHTML="<a href='javascript:submitform()' tabstop='4'><img src='images/search_button_specialty.jpg' border='0'></a><br>";
					//alert('here');
				}
			}
		}
	}
	document.getElementById('searchBox_specialty').style.background="url('images/search_box_specialty_active.jpg')";
}


