﻿function addressSearch(address, callBackFunction) {
    homeAddress = address;
    geocoder.getLatLng(address,
        function(point) {
            if (point) {
                homePoint = point;
                callBackFunction.run();
            }
            else {
                formSubmitted = false;
                homeAddress = '';
                homePoint = '';
                cleanMap();
                resizeList();
                var noResults = new Element('div', {
                    'class': 'noresults',
                    'text': 'Sorry. That location could not be found.'
                });
                if ($('pages')) {
                    $('pages').destroy();
                }
                if ($('whereField').get('value') == 'vioc') {
                    noResults.setStyle('padding-left', '45px');
                }
                noResults.inject($('locations').getElement('div'));
                $('loading').setStyle('display', 'none');
                pageTracker._trackPageview('/locationSearch/' + encodeURI(homeAddress) + '/' + getFilter() + '/invalid');
            }
        });
}