// Yahoo Maps Javascript

//Create a URL string for Yahoo maps and load the new URL in a new window
	function getAddress(location){
	
	var donorBuilding, mapForm;
	
	switch(location){
		//Location 1 = 500 Chipeta Way, SLC
		//Location 2 = 5201 S Green St., Murray
		
		case 1:
			donorBuilding = "500+chipeta+way%2C+salt+lake+city%2C+ut&q1=";
			mapForm = document.frmSLC;
			break;
		case 2:
			donorBuilding = "9786+south+500+west+sandy%2C+ut&q1=";
			mapForm = document.frmMurray;
			break;
		default:
			donorBuilding = "9786+south+500+west%2C+sandy%2C+ut&q1=";	
			mapForm = document.frmSLC;
	}

	var newAddress = mapForm.Address.value.replace(/ /g,"+");
	var newCity = mapForm.City.value.replace(/ /g, "+");

	newCity = newCity.replace(/\,/g, "%2C");
	newCity = newCity.replace(/\./g, "");
	
	newAddress = newAddress.replace(/\./g, "");
	newAddress = newAddress.replace(/\'/g, "");
	newAddress = newAddress.replace(/\,/g, "");
	
	newAddress = newAddress + "%2C"+ newCity;
	
	var targetURL = "http://maps.yahoo.com/#mvt=m&q2=" + donorBuilding + newAddress + "&trf=0&mag=7";
	
	window.open(targetURL)
	}