//google map code moved to individual pages, as they all had different lat and long


function mapGoogle(addrId,csvId,faddrId) {
	addr = document.getElementById(addrId).value;
	csv = document.getElementById(csvId).value;
	faddr = document.getElementById(faddrId).value;
	$("form input.error").removeClass("error");
	$("form label.error").remove();
	if (addr && csv) {
		adVal = addr + '+' + csv;
		var gUrl = 'http://maps.google.com';
		escapedaddr = escapeBlanks(adVal);
		var loc = gUrl+'?saddr='+escapedaddr+'&daddr='+faddr;
		//window.location = loc;
		window.open(loc,"_blank");
	} else {
		if (!addr) {
			var errorMsg = '<label class="error" for="'+addrId+'">Please enter your starting address</label>';
			$('#'+addrId).addClass("error").after(errorMsg);
		};
		if (!csv) {
			var errorMsg = '<label class="error" for="'+csvId+'">Please enter your starting city, state, or zip code</label>';
			$('#'+csvId).addClass("error").after(errorMsg);
		}
	}
}
function escapeBlanks(adVal) {
	eVal = '';
	var last = adVal.length;
	for (var i=0; i<last; i++) {
		if (' ' == adVal.charAt(i)) {
			eVal +='+';
		}
		else {
			eVal +=adVal.charAt(i);
		}
	}
	return eVal;
}
