﻿
var Message31 = "Please enter street";
var Message32 = "Please enter zip code";
var Message33 = "This should be only 5 digits";
var Message34 = "Please select Island";
var Message35 = "Please enter a building";

function validateAddressSearch(objSearchStreet, objIsland) {
    

    if (IsEmpty(objSearchStreet, Message31)) {
        return false;
    }

    if (objIsland.value == 0) {
        alert(Message34);
        return false;
    }
}

function IsEmpty(objTx, Mess) {
    if (objTx.value == "") {
        alert(Mess);
        objTx.focus();
        return true;
    }
    return false;
}
function selectCheck(objPropertyStatus,objBuildingStreet,objMinPrice,objMaxPrice) {
    var numSelected = 0;
    var i;
    var objPropertyStatus = objPropertyStatus;
    var streetList = objBuildingStreet;
    var pricemin = objMinPrice;
    var pricemax = objMaxPrice
    for (i = 0; i < streetList.length; i++) {
        if (streetList.options[i].selected)
            numSelected++;
    }
    if (numSelected < 1) {
        alert("Please select only one option from the list of available Streets or Buildings.");
        streetList.focus();
        return (false);
    }

    if (numSelected > 1) {
        alert("Please select only one option from the list of available Streets or Buildings.");
        streetList.focus();
        return (false);
    }

    if (parseFloat(pricemin.value) > parseFloat(pricemax.value) && parseFloat(pricemax.value) > 0) {
        alert('Price Min cannot be larger than Price Max');
        return false;
    }
    //Validate Adress ProprtyStatus
    if (objPropertyStatus.selectedIndex == 0) {
        alert('Please Select Property Status');
        return false;
    }
}