function showMsg() {
    divOnSubmit.innerText = 'Retrieving foreclosure records...';
    divOnSubmit.style.visibility = 'visible';
    return true;
}

function Clear_Screen() {
    document.getElementById('ctl00_ContentPlaceHolder1_txbHouseNum').value = '';
    document.getElementById('ctl00_ContentPlaceHolder1_ddlCityList').value = 'All';
    document.getElementById('ctl00_ContentPlaceHolder1_txbFromDate').value = '';
    document.getElementById('ctl00_ContentPlaceHolder1_txbToDate').value = '';
    document.getElementById('ctl00_ContentPlaceHolder1_lblImportDate').style.visibility = 'hidden';

    if (document.getElementById('ctl00_ContentPlaceHolder1_grvForeclosureList') != null) {
        document.getElementById('ctl00_ContentPlaceHolder1_grvForeclosureList').style.visibility = 'hidden';
    }
    if (document.getElementById('ctl00_ContentPlaceHolder1_grvPendingSales') != null) {
        document.getElementById('ctl00_ContentPlaceHolder1_grvPendingSales').style.visibility = 'hidden';
    }
    return true;
}

function Enable_Gridviews() {
    var InputValue = document.getElementById("ctl00_ContentPlaceHolder1_ddlSalesType").value

    if (InputValue == "Completed") {
        document.getElementById('ctl00_ContentPlaceHolder1_lblFromDate').style.visibility = 'visible';
        document.getElementById('ctl00_ContentPlaceHolder1_lblFromDate').innerHTML = 'Completed sales available 12 months prior to today.';
        document.getElementById('ctl00_ContentPlaceHolder1_lblToDate').style.visibility = 'visible';
        document.getElementById('ctl00_ContentPlaceHolder1_lblToDate').innerHTML = 'Completed sales may take several days to be recorded and available.';
        document.getElementById('ctl00_ContentPlaceHolder1_lblDisclaimerHDG').innerHTML = 'Completed Sales Disclaimer:';
        document.getElementById('ctl00_ContentPlaceHolder1_lblDisclaimer').innerHTML = 'Anoka County does not warrant the accuracy of the foreclosure information shown here. Much of the information shown here is gathered and presented by private parties who prepare foreclosures. The status of sale information can change due to court order, or corrective action taken by interested parties. The information in this database is continuously updated and contains data 12 months prior to the current date. Users of the information are responsible for verifying its accuracy.';
        document.getElementById('ctl00_ContentPlaceHolder1_lblImportDate').style.visibility = 'hidden';
    }
    else {
        document.getElementById('ctl00_ContentPlaceHolder1_lblFromDate').style.visibility = 'hidden';
        document.getElementById('ctl00_ContentPlaceHolder1_lblToDate').style.visibility = 'hidden';
        document.getElementById('ctl00_ContentPlaceHolder1_lblDisclaimerHDG').innerHTML = 'Pending Sales Disclaimer:';
        document.getElementById('ctl00_ContentPlaceHolder1_lblDisclaimer').innerHTML = "Anoka County does not warrant the accuracy of the foreclosure information shown here.  The information in this website and database is continuously updated.  Much of the information shown here is gathered and presented by private parties who prepare foreclosures.  The status of sale information can change at any time due to court order, corrective action taken by the interested parties, or other reasons.  This means it is possible that an upcoming sale may not occur at the listed time or place.  Users of the information are responsible for verifying the accuracy of the information.  This can most often be accomplished by contacting the mortgagee\'s attorney.  The Sheriff\'s Office cannot give legal advice.  Please consult an attorney for all questions related to real estate transactions.";
        document.getElementById('ctl00_ContentPlaceHolder1_lblImportDate').style.visibility = 'visible';
    }

    if (document.getElementById('ctl00_ContentPlaceHolder1_grvForeclosureList') != null) {
        if (InputValue == "Completed") {
            document.getElementById('ctl00_ContentPlaceHolder1_grvForeclosureList').style.visibility = 'visible';
        }
        else {
            document.getElementById('ctl00_ContentPlaceHolder1_grvForeclosureList').style.visibility = 'hidden';
        }
    }
    if (document.getElementById('ctl00_ContentPlaceHolder1_grvPendingSales') != null) {
        if (InputValue == "Pending") {
            document.getElementById('ctl00_ContentPlaceHolder1_grvPendingSales').style.visibility = 'visible';
        }
        else {
            document.getElementById('ctl00_ContentPlaceHolder1_grvPendingSales').style.visibility = 'hidden';
        }
    }
    return true;
}

function validate_page() {

    var errmsg = '';
    var firstemptyfield = 0;

    //start of date fields validation/////////////////////////////////////
    //	var isvalidformat = 1;
    //	var date_array = new Array(2)
    //	
    //	for (i=0; i<2; i++) {
    //		date_array[i] = new Array(2)
    //	}

    //	//load all the date fields into an array 
    //    var InputValue = document.getElementById("ctl00_ContentPlaceHolder1_txbFromDate").value

    //    if ((InputValue != null) && (InputValue.length != 0)) 
    //    {
    ////        date_array[0][0] = document.ForeclosureList.txbFromDate
    //        date_array[0][0] = InputValue
    //        date_array[0][1] = "From Date"
    //    }
    //    
    //    InputValue = document.getElementById("ctl00_ContentPlaceHolder1_txbToDate").value

    //    if ((InputValue != null) && (InputValue.length != 0)) 
    //    {
    ////        date_array[1][0] = document.ForeclosureList.txbToDate
    //        date_array[1][0] = InputValue
    //        date_array[1][1] = "To Date"
    //    }
    //	//make sure date is a valid date format
    //	//if date is entered without slashes it must be mmddyyyy
    //	
    //	for (i=0; i<2; i++) {
    //		if ((date_array[i][0] != null) && (date_array[i][0].length != 0)) {
    //			if (date_array[i][0].value != '') {
    //				var validformat1=/^\d{2}\/\d{2}\/\d{4}$/ //date was entered with slashes
    //				var validformat2=/^\d{1}\/\d{1}\/\d{4}$/ //date was entered with slashes
    //				var validformat3=/^\d{1}\/\d{2}\/\d{4}$/ //date was entered with slashes
    //				var validformat4=/^\d{2}\/\d{1}\/\d{4}$/ //date was entered with slashes
    //				if (!validformat1.test(date_array[i][0].value) && !validformat2.test(date_array[i][0].value) && !validformat3.test(date_array[i][0].value) && !validformat4.test(date_array[i][0].value)) {
    //					isvalidformat = 0; //if date was entered without slashes, it has to be mmddyyyy
    //												//add slashes and check format again
    //					var tempd = date_array[i][0].value.substring(0,2) + "/" + date_array[i][0].value.substring(2,4) + "/" + date_array[i][0].value.substring(4,8);
    //					if (!validformat1.test(tempd)) { //date is not mm/dd/yyyy
    //						errmsg += "\nPlease enter a valid " + date_array[i][1] + " (ex. mm/dd/yyyy or mmddyyyy)"
    //						if (firstemptyfield == 0) {
    //							date_array[i][0].focus();
    //							firstemptyfield = 1;
    //						}	
    //					}
    //					else {
    //						//date was entered as mmddyyyy
    //						isvalidformat = 1;
    //					}
    //				}
    //				else {
    //					//date was entered correctly with slashes
    //					var tempd = date_array[i][0].value;
    //				}

    //				if (isvalidformat == 1) {
    //					var dArr = tempd.split("/");
    //					var testd = new Date(tempd); //the format is good now see if date is valid
    //					//this will catch invalid dates like entering 12/46/2004
    //					
    //					if ((parseInt(testd.getMonth(),10) + 1 != parseInt(dArr[0],10)) || (parseInt(testd.getDate(),10) != parseInt(dArr[1],10)) || (parseInt(testd.getFullYear(),10) != parseInt(dArr[2],10))) {
    //						errmsg += "\nPlease enter a valid " + date_array[i][1] + " (ex. mm/dd/yyyy or mmddyyyy)"
    //						if (firstemptyfield == 0) {
    //							date_array[i][0].focus();
    //							firstemptyfield = 1;
    //						}
    //					}
    //					else {
    //						date_array[i][0].value = tempd;
    //					}
    //				}
    //			}
    //		}
    //	}
    ////end date fields validation/////////////////////////////////////////////////

    if (errmsg.length > 0) {
        alert("There is a problem with the following fields:\n " + errmsg);
        return false;
    }
    else {
        return true;
    }

}
//end validate_page function///////////////////////////////////


