function validateinput(form)
{
    /*
    We test to see that the user only input data for one of the three tests.
    if they've entered data in two different search criteria, we present an
    error message.

	THE CODE WITHIN THE COMMENT BELOW IS FOR FUTURE CODE

    ziptest = (form.o_zip.value != "" || form.d_zip.value != "") ? 1 : 0;
    loctest = (form.ship_city.value != "" || form.ship_state.value != "" ||
        form.del_city.value != "" ||  form.del_state.value != "") ? 1 : 0;

    */
    datetest =
        (form.startdate.value != "" || form.enddate.value != "") ? 1 : 0;

/*
    if ((ziptest + datetest + loctest) != 1) {
        alert("You may choose to search by Zipcode, Listing OR Location");
        return false;
    }
*/

    switch (1) {
/*
        case ziptest:
            if (! validatezipcode(form)) { return false; }
            break;
*/
        case datetest:
            if (! validatedate(form)) { return false; }
            break;
/*
        case loctest:
            alert("validatelocation");
            if (! validatelocation(form)) { return false; }
            break;
*/
    }
    return true;
}

/*
function validatezipcode(form) {

    var error = "";

    if (isNaN(form.o_zip.value)) {

        error = "Origin Zipcode must be numeric (" + form.o_zip.value + ")";
    }

    if (isNaN(form.d_zip.value)) {

        error = error +
            "\nDestination Zipcode must be numeric (" + form.d_zip.value + ")";
    }

    if ((form.d_zip.value < 10000) || (form.d_zip.value > 99999))
    {
        error = error + "\nDestination Zipcode must be a 5 digit number (" +
            form.d_zip.value + ")";
    }

    if ((form.o_zip.value < 10000) || (form.o_zip.value > 99999))
    {
        error = error + "\nOrigin Zipcode must be a 5 digit number (" +
            form.o_zip.value + ")";
    }

    if (error) { alert(error); return false; }

    return true;
}
*/

function validatedate(form)
{

    if (form.startdate.value == "unset") {

        alert("You must select a start date");
        return false;
    }

    var startarr = form.startdate.value.split("/");
    var endarr = form.enddate.value.split("/");

    if ((new Date(startarr[2],startarr[0] - 1,startarr[1])) > 
        (new Date(endarr[2],endarr[0] - 1,endarr[1])))
    {
        alert("Start date (" + form.startdate.value + ") must be\n" +
            "earlier than End date (" + form.enddate.value + ")");
        return false;
    }

    return true;
}

/*
function validatelocation(form)
{

    var error = "";

    switch ("") {

        case form.ship_state.value:
            error =
                "When searching by location you must select a Shipping State\n";

        case form.ship_city.value:
            error = error + 
                "When searching by location you must enter a Shipping City\n";

        case form.del_state.value:
            error = error +
                "When searching by location you must select a Delivery State\n";

        case form.del_city.value:
            error = error + 
                "When searching by location you must enter a Delivery City\n";
    }

    if (error) { alert(error); return false; }

    return true;
}
*/
