function checkOther()
{
	var dest = document.getElementById('location');
	var key = dest.selectedIndex;
	if (dest[key].value == 'other')
	{
		document.getElementById('other').style.display = 'inline';
		return false;
	} else {
		document.getElementById('other_input').value = '';
		document.getElementById('other').style.display = 'none';
		return true;
	}
}

function makeDirectionsRequest(url) {
var http_request = false;

if (window.XMLHttpRequest) { // Mozilla, Safari, ...
    http_request = new XMLHttpRequest();
    if (http_request.overrideMimeType) {
        http_request.overrideMimeType('text/xml');
        // See note below about this line
    }
} else if (window.ActiveXObject) { // IE
    try {
        http_request = new ActiveXObject("Msxml2.XMLHTTP");
    } catch (e) {
        try {
            http_request = new ActiveXObject("Microsoft.XMLHTTP");
        } catch (e) {}
    }
}

if (!http_request) {
    alert('Giving up :( Cannot create an XMLHTTP instance');
    return false;
}
http_request.onreadystatechange = function() { showResults(http_request); };
http_request.open('GET', url, true);
http_request.send(null);

}

function showResults(http_request) {
if (http_request.readyState == 4) {
    if (http_request.status == 200) {
        //alert(http_request.responseText);
		response = http_request.responseText;
		if (response == 'FALSE') {			
			//alert('There was no location founded.');
			document.getElementById('errors_div').innerHTML = 'We could not find that location. Please try another again.';
			document.getElementById('errors_div').style.display = 'inline';
			return false;
		} else {			
			dest_coord = response.split(',');		
			mqRoute.origin.setLatitude(dest_coord[0]);
			mqRoute.origin.setLongitude(dest_coord[1]);
		
			mqRoute.doRoute();
			return true;
		}
    } else {		
		//alert('There was a problem with the request.');
		document.getElementById('errors_div').innerHTML = 'There was a problem with the request';
		document.getElementById('errors_div').style.display = 'inline';		
			return false;
        }
    }

}

function checkErr()
{
	var err = document.getElementById('errors_div');
	if (err.style.display == 'inline')
	{
		err.style.display = 'none';
	}
}

function is_opera()
{
	if (window.opera) {
		document.getElementById('main_data').style.display = 'none';
		var err_div = document.getElementById('errors_div');
		var font = document.createElement('font');
		font.setAttribute('size', '4');
		font.appendChild(document.createTextNode('You can\'t use Driving Directions service browsing with Opera'));
		err_div.appendChild(font);
		err_div.style.display = 'inline';
	}
}
