function setLastSearchResult(){
	//this is a lot of work just to get rid of the protocol ...
	var result = window.location.href;
	if (result != ''){
		setCookie('lastSearchResult', result, null, '/');
	}
}
function showForm()
{
    document.getElementById('eForm').style.display = 'block';
}
function hideForm()
{
    document.getElementById('eForm').style.display = 'none';
}
function submitForm(url)
{
    var email = document.getElementById('email').value;
    var geo = document.getElementById('geoArea').value;
    var freq;
    var rb = document.getElementById('daily');
    if(rb.checked) {
        freq = rb.value;
    } else {
        freq = document.getElementById('weekly').value;
    }
    
    var emailValid = ValidateEmail(email, false);
    if(emailValid) {
        var params = 'GeoAreaID=' + geo + '&Email=' + email + '&Freq=' + freq; 
        AsyncPost(url,params,function(status){emailFormConfirm(status);});
        var div = document.getElementById('content');
        var height = div.offsetHeight;
        div.style.height = height + 'px';
        div.innerHTML = '<div class="Sending">&#160;</div>';
    } else {
        document.getElementById('eError').style.display = 'block';
    }
}
function emailFormConfirm(postStatus) {
    document.getElementById('eForm').style.display = 'block';
    var div = document.getElementById('content');
    var height = div.offsetHeight;
    div.style.height = height + 'px';
    if (postStatus == 200) {
        div.innerHTML = '<div class="Result">Success, you will begin receiving new listing emails soon.</div>'; 
    } else {
        div.innerHTML = '<div class="Result">Sorry, an error occured while attempting to subscribe you.<br/>Please try again in a few moments.</div>'; 
    }
}