function verifyLogin() {
	if (document.getElementById('email').value == "email" || document.getElementById('password').value == "password") {
		alert("Please enter your e-mail and password.");
		return false;
	}
	return true;
}

function clickclear(thisfield, defaulttext) {
	if (thisfield.value == defaulttext) {
		thisfield.value = "";
	}
}

function clickrecall(thisfield, defaulttext) {
	if (thisfield.value == "") {
		thisfield.value = defaulttext;
	}
}

function IsNumeric(strString)
   //  check for valid numeric strings	
   {
   var strValidChars = "0123456789";
   var strChar;
   var blnResult = true;

   if (strString.length == 0) return false;

   //  test strString consists of valid characters listed above
   for (i = 0; i < strString.length && blnResult == true; i++)
      {
      strChar = strString.charAt(i);
      if (strValidChars.indexOf(strChar) == -1)
         {
         blnResult = false;
         }
      }
   return blnResult;
   }



function submitSearch() {
	var cityzip = document.getElementById('cityzip').value;
	
	if (document.getElementById('cityzip').value == "City or Zip Code" && document.getElementById('tempmls').value == "") {
		alert("Please enter a city, zip code or MLS Number.");
		return;
	}
	else if (document.getElementById('tempmls').value != "") {
		document.getElementById('mls_id1').value = document.getElementById('tempmls').value;
		document.the_mls_form.search_type.value = "mls_id";
		document.the_mls_form.display_style.value = "detail";
		document.the_mls_form.submit();
		return;
	}
	else if (IsNumeric(cityzip) == false) {
		document.qs_form.city.value = cityzip;
		document.qs_form.zipcode.value = "";
		document.qs_form.search_type.value = "city";
		document.qs_form.display_style.value = "detail";
		document.qs_form.submit();
	}
	else {
		document.qs_form.zipcode.value = cityzip;
		document.qs_form.city.value = "";
		document.qs_form.search_type.value = "zipcode";
		document.qs_form.display_style.value = "detail";
		document.qs_form.submit();
	}
}

function submitMap() {
	var cityzip = document.getElementById('cityzip').value;
	
	if (document.getElementById('cityzip').value == "City or Zip Code" && document.getElementById('tempmls').value == "") {
		alert("Please enter a city, zip code or MLS Number.");
		return;
	}
	else if (document.getElementById('tempmls').value != "") {
		document.getElementById('mls_id1').value = document.getElementById('tempmls').value;
		document.the_mls_form.search_type.value = "mls_id";
		document.the_mls_form.display_style.value = "map";
		document.the_mls_form.submit();
		return;
	}
	else if (IsNumeric(cityzip) == false) {
		document.qs_form.city.value = cityzip;
		document.qs_form.zipcode.value = "";
		document.qs_form.search_type.value = "city";
		document.qs_form.display_style.value = "map";
		document.qs_form.submit();
	}
	else {
		document.qs_form.zipcode.value = cityzip;
		document.qs_form.city.value = "";
		document.qs_form.search_type.value = "zipcode";
		document.qs_form.display_style.value = "map";
		document.qs_form.submit();
	}
}
