//Copyright 1999, 2004, 2008 by Greg Costikyan

function findSubw (myavenoo,mystreet) {
  if (myavenoo == "9th")  { myavenoo = "8th"}
  if (myavenoo == "10th")  { myavenoo = "8th"}
  if (myavenoo == "11th")  { myavenoo = "8th"}

  if (myavenoo == "B")  { myavenoo = "A"}
  if (myavenoo == "C")  { myavenoo = "A"}
  if (myavenoo == "D")  { myavenoo = "A"}

  if (myavenoo == "Amsterdam")  { myavenoo = "Bway"}
  if (myavenoo == "Audobon")  { myavenoo = "Stni"}
  if (myavenoo == "Broadway")  { myavenoo = "Bway"}
  if (myavenoo == "Central Park West")  { myavenoo = "8th"}
  if (myavenoo == "Columbus")  { myavenoo = "8th"}
  if (myavenoo == "Convent")  { myavenoo = "Stni"}
  if (myavenoo == "East+End")  { myavenoo = "Lexi"}
  if (myavenoo == "Frederick+Douglass+Blvd")  { myavenoo = "8th"}
  if (myavenoo == "Edgecomb")  { myavenoo = "Stni"}
  if (myavenoo == "Ft+Washington+Ave")  { myavenoo = "Bway"}
  if (myavenoo == "Malcolm+X+Blvd")  { myavenoo = "7th"}
  if (myavenoo == "Lexington") { myavenoo = "Lexi"}
  if (myavenoo == "Madison") { myavenoo = "Lexi"}
  if (myavenoo == "Manhattan+Ave") { myavenoo = "8th"}
  if (myavenoo == "Park+Ave")  { myavenoo = "Lexi"}
  if (myavenoo == "Park+Ave+S")  { myavenoo = "Lexi"}
  if (myavenoo == "Pleasant+Ave")  { myavenoo = "Lexi"}
  if (myavenoo == "Adam+Clayton+Powell+Jr+Blvd")  { myavenoo = "7th"}
  if (myavenoo == "Riverside+Dr")  { myavenoo = "Bway"}
  if (myavenoo == "St+Nicholas+Ave")  { myavenoo = "Stni"}
  if (myavenoo == "Wadsworth+Ave")  { myavenoo = "Stni"}
  if (myavenoo == "West+End+Ave")  { myavenoo = "Bway"}
  if (myavenoo == "York+Ave")  { myavenoo = "Lexi"}

		if (myavenoo =="A") {
			if (mystreet <= 5) {
				subwSt = "2nd Ave";
				subwLine = "FV";
				}
			else {
				subwSt = "1st Ave";
				subwLine = "L";
				}
		}
		else {

		if (myavenoo == "4th") {
			if (mystreet <= 11) {
				subwSt = "Astor Pl";
				subwLine = "6";
			}
			else {
				subwSt="14th St/Union Sq";
				subwLine = "LNQRW456";
				}
		}

		else {
			if (myavenoo == "1st") {
				if (mystreet <= 5) {
					subwSt = "2nd Ave";
					subwLine = "FV";
				}
				else if (mystreet <= 20) {
				 	subwSt = "1st Ave";
					subwLine = "L";
				}
				else myavenoo = "Lexi";
			}
			if (myavenoo == "2nd") {
			
				if (mystreet <= 3) {
					subwSt = "2nd Ave";
					subwLine = "FV";
				}
				else if (mystreet <= 11) {
					subwSt = "Astor Pl";
					subwLine = "6";
				}
				else if (mystreet <= 19) {
					subwSt = "3rd Ave";
					subwLine = "L";
				}
				else myavenoo = "Lexi";
			}

			if (myavenoo == "5th") {
				if (mystreet <= 37) myavenoo = "Bway";
				else if (mystreet <= 44) {
					subwSt = "42nd St/Fifth Ave";
					subwLine = "7BDFV";
				}
				else if (mystreet <= 51) {
					subwSt = "47th-50th Sts/Rockefeller Ctr";
					subwLine = "BDFV";
				}
				else if (mystreet <= 56) {
					subwSt = "Fifth Ave";
					subwLine = "EV";
				}
				else if (mystreet <= 62) {
					subwSt = "Fifth Ave";
					subwLine = "NRW";
				}
				else myavenoo = "Lexi";
			}


			if (myavenoo == "Lexi") {
				if (mystreet <= 18)	{	
					subwSt = "14th St - Union Sq";
					subwLine = "456LNQRW";
				}
				else if (mystreet <= 25) {
					subwSt = "23rd St";
					subwLine = "6";
				}
				else if (mystreet <= 30) {
					subwSt = "28th St";
					subwLine = "6";
				}
				else if (mystreet <= 37) {
					subwSt = "33rd St";
					subwLine = "6";
				}
				else if (mystreet <= 46) {
					subwSt = "42nd St - Grand Central";
					subwLine = "4567S";
				}
				else if (mystreet <= 55) {
					subwSt = "51st/53rd St - Lexington Ave";
					subwLine = "6EV";
				}
				else if (mystreet <= 63) {
					subwSt = "59th St";
					subwLine = "456NRW";
				}
				else if (mystreet <= 72) {
					subwSt = "68th St";
					subwLine = "6";
				}
				else if (mystreet <= 81) {
					subwSt = "77th St";
					subwLine = "6";
				}
				else if (mystreet <= 91) {
					subwSt = "86th St";
					subwLine = "456";
				}
				else if (mystreet <= 99) {
					subwSt = "96th St";
					subwLine = "6";
				}
				else if (mystreet <= 106) {
					subwSt = "103rd St";
					subwLine = "6";
				}
				else if (mystreet <= 113) {
					subwSt = "110th St";
					subwLine = "6";
				}
				else if (mystreet <= 120) {
					subwSt = "116th St";
					subwLine = "6";
				}
				else {
					subwSt = "125th St";
					subwLine = "456";
				}
			}

			if (myavenoo == "6th") {
			//we know we're above Wash place
				if (mystreet <= 9) {
					subwSt = "W 4th St";
					subwLine = "ABCDEFV";
				}
				else if (mystreet <= 18) {
					subwSt = "14th St";
					subwLine = "FVL PATH, transfer to 1239";
				}
				else if (mystreet <= 28) {
					subwSt = "23rd St";
					subwLine = "FV PATH";
				}
				else if (mystreet <= 37) {
					subwSt = "34th St";
					subwLine = "BDFNQRVW PATH";
				}
				else if (mystreet <= 44) {
					subwSt = "42nd St";
					subwLine = "BDFV, transfer to 7";
				}
				else if (mystreet <= 53) {
					subwSt = "47-50th St/Rockefeller Ctr";
					subwLine = "BDFV";
				}
				else if (mystreet <= 59) {
					subwSt = "57th St";
					subwLine = "F";
				}
				else avenoo = "7th";
			}

			if (myavenoo == "7th") {
				if (mystreet <= 12) {
					subwSt = "Christopher St";
					subwLine = "19";
				}
		
				else if (mystreet <= 16) {
					subwSt = "14th St";
					subwLine = "1239, transfer to FVL";
				}
				else if (mystreet <= 20) {
					subwSt = "18th St";
					subwLine = "19";
				}
				else if (mystreet <= 25) {
					subwSt = "23rd St";
					subwLine = "19";
				}
				else if (mystreet <= 30) {
					subwSt = "28th St";
					subwLine = "19";
				}
				else if (mystreet <= 37) {
					subwSt = "34th St";
					subwLine = "1239";
				}
				else if (mystreet <= 45) {
					subwSt = "42nd St/Times Sq";
					subwLine = "12379NQRSW";
				}
				else if (mystreet <= 51) {
					subwSt = "49th St";
					subwLine = "NRW";
				}
				else if (mystreet <= 55) {
					subwSt = "7th Ave";
					subwLine = "BDE";
				}
				else if (mystreet <= 86) {
					subwSt = "57th St";
					subwLine = "NQRW";
				}
				else if (mystreet <= 113) {
					subwSt = "Central Park No/110th St";
					subwLine = "23";
				}
				else if (mystreet <= 120) {
					subwSt = "116th St";
					subwLine = "23";
				}
				else if (mystreet <= 129) {
					subwSt = "125th St";
					subwLine = "23";
				}
				else if (mystreet <= 140) {
					subwSt = "135th St";
					subwLine = "23";
				}
				else if (mystreet <= 146) {
					subwSt = "145th St";
					subwLine = "3";
				}
				else {
					subwSt = "148th St/Harlem";
					subwLine = "3";
				}
			}

			if (myavenoo == "Stni") {
				if (mystreet <= 149) avenoo = "8th";
				else if (mystreet <= 158) {
					subwSt = "155th St";
					subwLine = "C";
				}
				else if (mystreet <= 165) {
					subwSt = "163rd St";
					subwLine = "C";
				}
				else if (mystreet <= 171) {
					subwSt = "168th St/Washington Heights";
					subwLine = "AC19";
				}
				else if (mystreet <= 177) {
					subwSt = "175th St";
					subwLine = "A";
				}
				else if (mystreet <= 185) {
					subwSt = "181st St";
					subwLine = "19";
				}
				else if (mystreet <= 196) {
					subwSt = "191st St";
					subwLine = "19";
				}
				else if (mystreet <= 204) {
					subwSt = "Dyckman St";
					subwLine = "1";
				}
				else if (mystreet <= 210) {
					subwSt = "207th St";
					subwLine = "9 rush, 1 other time";
				}
				else {
					subwSt = "215th St";
					subwLine = "1";
				}
			}

			if (myavenoo == "8th") {
				if (mystreet <= 18) {
					subwSt = "14th St/8th Ave";
					subwLine = "ACEL";
				}
				else if (mystreet <= 28) {
					subwSt = "23rd St";
					subwLine = "CE";
				}
				else if (mystreet <= 37) {
					subwSt = "34th St/Penn Sta";
					subwLine = "ACE";
				}
				else if (mystreet <= 46) {
					subwSt = "42nd St/Port Authority";
					subwLine = "ACE, transfer to NQRSW12379";
				}
				else if (mystreet <= 54) {
					subwSt = "50th St";
					subwLine = "CE";
				}
				else if (mystreet <= 65) {
					subwSt = "59th St/Columbus Cir";
					subwLine = "ABCD19";
				}
				else if (mystreet <= 76) {
					subwSt = "72nd St";
					subwLine = "BC";
				}
				else if (mystreet <= 83) {
					subwSt = "81st St/Museum of Natural History";
					subwLine = "BC";
				}
				else if (mystreet <= 90) {
					subwSt = "86th St";
					subwLine = "BC";
				}
				else if (mystreet <= 99) {
					subwSt = "96th St";
					subwLine = "BC";
				}
				else if (mystreet <= 106) {
					subwSt = "103rd St";
					subwLine = "BC";
				}
				else if (mystreet <= 112) {
					subwSt = "110th St/Cathedral Pkwy";
					subwLine = "BC";
				}
				else if (mystreet <= 120) {
					subwSt = "116th St";
					subwLine = "BC";
				}
				else if (mystreet <= 130) {
					subwSt = "125th St";
					subwLine = "ABCD";
				}
				else if (mystreet <= 139) {
					subwSt = "135th St";
					subwLine = "BC";
				}
				else if (mystreet <= 149) {
					subwSt = "145th St";
					subwLine = "ABCD";
				}
				else  {
					subwSt = "155th St";
					subwLine = "BD";
				}
			}
			if (myavenoo == "Bway") {
				
				if (mystreet <= 10) {
					subwSt = "8th St";
					subwLine = "NRW";
				}
				else if (mystreet <= 18) {
					subwSt = "14th St";
					subwLine = "LNQRW456";
				}
				else if (mystreet <= 25) {
					subwSt = "23rd St";
					subwLine = "NRW";
				}
				else if (mystreet <= 30) {
					subwSt = "28th St";
					subwLine = "NRW";
				}
				else if (mystreet <= 37) {
					subwSt = "34th St/Herald Sq";
					subwLine = "BDFNQRVW";
				}
				else if (mystreet <= 46) {
					subwSt = "42nd St/Times Sq";
					subwLine = "NQRSW12379";
				}
				else if (mystreet <= 54) {
					subwSt = "50th St";
					subwLine = "19";
				}
				else if (mystreet <= 62) {
					subwSt = "59th St/Columbus Cir";
					subwLine = "ABCD19";
				}
				else if (mystreet <= 68) {
					subwSt = "66th St/Lincoln Ctr";
					subwLine = "19";
				}
				else if (mystreet <= 75) {
					subwSt = "72nd St";
					subwLine = "1239";
				}
				else if (mystreet <= 82) {
					subwSt = "79th St";
					subwLine = "19";
				}
				else if (mystreet <= 90) {
					subwSt = "86th St";
					subwLine = "19";
				}
				else if (mystreet <= 99) {
					subwSt = "96th St";
					subwLine = "1239";
				}
				else if (mystreet <= 106) {
					subwSt = "103rd St";
					subwLine = "19";
				}
				else if (mystreet <= 112) {
					subwSt = "110th St/Cathedral Pkwy";
					subwLine = "19";
				}
				else if (mystreet <= 120) {
					subwSt = "116th St/Columbia Univ";
					subwLine = "19";
				}
				else if (mystreet <= 130) {
					subwSt = "125th St";
					subwLine = "19";
				}
				else if (mystreet <= 140) {
					subwSt = "137th St/City College";
					subwLine = "19";
				}
				else if (mystreet <= 150) {
					subwSt = "145th St";
					subwLine = "9 rush, 1 other times";
				}
				else if (mystreet <= 162) {
					subwSt = "157th St";
					subwLine = "1";
				}
				else if (mystreet <= 171) {
					subwSt = "168th St/Washington Heights";
					subwLine = "AC19";
				}
				else if (mystreet <= 177) {
					subwSt = "175th St";
					subwLine = "A";
				}
				else if (mystreet <= 185) {
					subwSt = "181st St";
					subwLine = "A";
				}
				else if (mystreet <= 195) {
					subwSt = "190th St";
					subwLine = "A";
				}
				else if (mystreet <= 202) {
					subwSt = "Dyckman St";
					subwLine = "A";
				}
				else if (mystreet <= 211) {
					subwSt = "207th St";
					subwLine = "A";
				}
				else if (mystreet <= 221) {
					subwSt = "215th St";
					subwLine = "1";
				}
				else if (mystreet <= 227) {
					subwSt = "225th St/Marble Hill, Bronx";
					subwLine = "19";
				}
				else if (mystreet <= 234) {
					subwSt = "231st St, Bronx";
					subwLine = "19";
				}
				else if (mystreet <= 239) {
					subwSt = "238th St, Bronx";
					subwLine = "1";
				}
				else  {
					subwSt = "242nd St/Van Cortlandt Pk, Bronx";
					subwLine = "19";
				}
			}
		}
	}
	document.daForm.stop.value = subwSt;
	document.daForm.line.value = subwLine;
}
	//close function



function findAveAddr() {
	result = 0;
	numba = parseInt(document.daForm.number.value);
	subwSt = "";
	subwLine = "";
	aveArray = "3 3 10 8 F X S 9 13 14 15 3 3 3 3 59 165 B C 59 127 79 9 134 158 10 22 27 100 34 8 101 S R 110 173 59 4".split(" ");
	aveval = aveArray[document.daForm.avenoo.selectedIndex];
	 //this is the value used for calculating street for the avenue selected by the user; it's a string.

	document.daForm.st.value = "";
	document.daForm.stop.value = "";
	document.daForm.line.value = "";



	//Fifth avenue
	if (aveval == "F") {

	
	  if (numba < 62)  result = (numba/20) + 8; 
	  	else if (numba <= 108) result = (numba/20) + 11; 
	  		else   if (numba <= 200) result = (numba/20) + 13;
	  			else  if (numba <= 400) result = (numba/20) + 16; 
	  				else  if (numba <= 600) result = (numba/20) + 18; 
	  					else   if (numba <= 775) result = (numba/20) + 20; 
	  						else  if (numba <= 1309) result = (numba/10) - 18; 
	  							else  result = (numba/10) - (20 + ((numba - 1310)/20) ); 

	 }
	 

	//Seventh avenue	
	else if (aveval == "S") {

	 	if (numba <= 1800) result = (numba/20) + 12;
	 	else result = (numba/20) + 20;
	}

	//Central Park West	
	else if (aveval == "C") result = (numba/10) + 60;
	

	//Broadway	
	else if (aveval == "B") {	
	 	if (numba <= 800) {
	 	
		 	result = -1;
		 	if (numba <= 40) {
		 		document.daForm.st.value = "Beaver St";
		 		document.daForm.stop.value = "Bowling Green";
		 		document.daForm.line.value = "45";
		 	}	
		 	else if (numba <= 65) {
		 		document.daForm.st.value = "Exchange Pl";
		 		document.daForm.stop.value = "Wall Street";
		 		document.daForm.line.value = "45";
		 	}
		 	else if (numba <= 99) {
		 		document.daForm.st.value = "Rector St";
		 		document.daForm.stop.value = "Wall Street";
		 		document.daForm.line.value = "45";
		 	}
		 	else if (numba <= 120){
		 		document.daForm.st.value = "Pine St";
		 		document.daForm.stop.value = "Wall Street";
		 		document.daForm.line.value = "45";
		 	}
		 	else if (numba <= 155) {
		 	document.daForm.st.value = "Liberty St";
		 		document.daForm.stop.value = "Cortlandt St";
		 		document.daForm.line.value = "RW";
		 	}
		 	else if (numba <= 200) {
		 		document.daForm.st.value = "John St";
		 		document.daForm.stop.value = "Cortlandt St";
		 		document.daForm.line.value = "RW";
		 	}
		 	else if (numba <= 222) {
		 		document.daForm.st.value = "Fulton St";
		 		document.daForm.stop.value = "Fulton St - Broadway Nassau";
		 		document.daForm.line.value = "ACJMZ2345";
		 	}
		 	else if (numba <= 225) {
		 		document.daForm.st.value = "Vesey St";
		 		document.daForm.stop.value = "Fulton St - Broadway Nassau";
		 		document.daForm.line.value = "ACJMZ2345";
		 	}
		 	else if (numba <= 260) {
		 		document.daForm.st.value = "Park Pl";
		 		document.daForm.stop.value = "Park Pl";
		 		document.daForm.line.value = "23";
		 	}
		 	else if (numba <= 280) {
		 		document.daForm.st.value = "Chambers St";
		 		document.daForm.stop.value = "City Hall";
		 		document.daForm.line.value = "RW";
		 	}
		 	else if (numba <= 300) {
		 		document.daForm.st.value = "Duane St";
		 		document.daForm.stop.value = "City Hall";
		 		document.daForm.line.value = "RW";
		 	}
		 	else if (numba <= 335) {
		 		document.daForm.st.value = "Worth St";
		 		document.daForm.stop.value = "City Hall";
		 		document.daForm.line.value = "RW";
		 	}
		 	else if (numba <= 380) {
		 		document.daForm.st.value = "Franklin St";
		 		document.daForm.stop.value = "Franklin St";
		 		document.daForm.line.value = "19";
		 	}
		 	else if (numba <= 461) {
		 		document.daForm.st.value = "Canal St";
		 		document.daForm.stop.value = "Canal St";
		 		document.daForm.line.value = "JMNQRWZ6";
		 	}
		 	else if (numba <= 500) {
		 		document.daForm.st.value = "Broome St";
		 		document.daForm.stop.value = "Canal or Prince";
		 		document.daForm.line.value = "NRW";
		 	}
		 	else if (numba <= 550) {
		 		document.daForm.st.value = "Spring St";
		 		document.daForm.stop.value = "Prince St";
		 		document.daForm.line.value = "NRW";
		 	}
		 	else if (numba <= 575) {
		 		document.daForm.st.value = "Prince St";
		 		document.daForm.stop.value = "Prince St";
		 		document.daForm.line.value = "NRW";
		 	}
		 	else if (numba <= 620) {
		 		document.daForm.st.value = "Houston St";
		 		document.daForm.stop.value = "Broadway-Lafeyette/Bleecker St";
		 		document.daForm.line.value = "BDFV6";
		 	}
		 	else if (numba <= 650) {
		 		document.daForm.st.value = "Bleecker St";
		 		document.daForm.stop.value = "Broadway-Lafeyette/Bleecker St";
		 		document.daForm.line.value = "BDFV6";
		 	}
		 	else if (numba <= 680) {
		 		document.daForm.st.value = "3rd St";
		 		document.daForm.stop.value = "Broadway-Lafeyette/Bleecker St";
		 		document.daForm.line.value = "BDFV6";
		 	}
		 	else if (numba <= 700) {
		 		document.daForm.st.value = "4th St";
		 		document.daForm.stop.value = "8th St";
		 		document.daForm.line.value = "NRW";
		 	}
		 	else if (numba <= 726){
		 		document.daForm.st.value = "Washington Pl";
		 		document.daForm.stop.value = "8th St";
		 		document.daForm.line.value = "NRW";
		 	}
		 	else if (numba <= 769){
		 		document.daForm.st.value = "Astor Pl";
		 		document.daForm.stop.value = "8th St";
		 		document.daForm.line.value = "NRW";
		 	}
		 	else {
		 		document.daForm.st.value = "9th St";
		 		document.daForm.stop.value = "8th St";
		 		document.daForm.line.value = "NRW";
		 	}
	 	
	 	}
	 	
	 	//else means: a numbered street off Broadway
	 	else if (numba <= 846) result = (numba/20) - 29;
	 			else if (numba <= 953) result = (numba/20) - 25;
	 			    else  result = (numba/20) - 31;
			
	}

	
	//Riverside
	else if (aveval == "R") {

	 	if (numba <= 567) result = (numba/10) + 72;
	 	else result = (numba/10) + 78;
	}
	
	//Sixth Avenue
	else if (aveval == "X") {
		if (numba <= 399)
		{
			result = -1;
			if (numba <= 30) {
				document.daForm.st.value = "White St";
				document.daForm.stop.value = "Franklin";
				document.daForm.line.value = "19";
			}
			else if (numba <= 90) {
				document.daForm.st.value = "Canal St";
				document.daForm.stop.value = "Canal St";
				document.daForm.line.value = "ACE";
			}
			else if (numba <= 135) {
				document.daForm.st.value = "Broome St";
				document.daForm.stop.value = "Canal St";
				document.daForm.line.value = "ACE";
			}
			else if (numba <= 170) {
				document.daForm.st.value = "Spring St";
				document.daForm.stop.value = "Spring St";
				document.daForm.line.value = "CE";
			}
			else if (numba <= 230) {
				document.daForm.st.value = "Prince St";
				document.daForm.stop.value = "Spring St";
				document.daForm.line.value = "CE";
			}
			else if (numba <= 260) {
				document.daForm.st.value = "Houston St";
				document.daForm.stop.value = "W 4th St";
				document.daForm.line.value = "ABCDEFV";
			}
			else if (numba <= 310) {
				document.daForm.st.value = "Bleecker St";
				document.daForm.stop.value = "W 4th St";
				document.daForm.line.value = "ABCDEFV";
			}
			else if (numba <= 340) {
				document.daForm.st.value = "3rd St";
				document.daForm.stop.value = "W 4th St";
				document.daForm.line.value = "ABCDEFV";
			}

			else {
				document.daForm.st.value = "Washington Pl";
				document.daForm.stop.value = "W 4th St";
				document.daForm.line.value = "ABCDEFV";
			}

		}
		else result = (numba/20) - 12;
	}


	//normal street
	else result = (numba/20) + parseInt(aveval);



	//it ain't Bway or 6th downtown, which we has already handled, if result != -1	
	
	if (! (result == -1)) {
		
		if (!(result > 0)) {
		document.daForm.st.value = "I don't understand that number.";
		return;
		}	
	

		else {
			result = Math.round(result);
			if (result > 220) {
				document.daForm.st.value = "That ain't in Manhattan.";
				return;
			}			
			
			findSubw(document.daForm.avenoo.options[document.daForm.avenoo.selectedIndex].value,result);
			//figure out nearest subway; options value is avenue, result has street #
	
	
		
			
			if ((result % 10) >= 4) result += "th";			
			else if ((result % 10) == 0) result += "th";
			else if ( ((result % 100) > 9) && ((result % 100) < 20) ) result += "th";
			else if ((result % 10) == 1) result += "st";
			else if ((result % 10) == 2) result += "nd";
			else if ((result % 10) == 3) result += "rd";
			
			result += " St";
			document.daForm.st.value = result;	
		 }
		
	}
 
}


function findNumStrAddr() {
	building = parseInt(document.daForm.bldg.value);
	if (document.daForm.eorw.options[document.daForm.eorw.selectedIndex].value == "E") eside = true;
	else eside = false;
	street = parseInt(document.daForm.str.value);


	document.daForm.ave.value = "";
	document.daForm.stop.value = "";
	document.daForm.line.value = "";
	
	//basic error checking

	if (!(street > 0)) {
		document.daForm.ave.value = "I don't understand that street.";
		return;
	} 

	if (street > 220) {
		document.daForm.ave.value = "That ain't in Manhattan.";
		return;
	}
	if ( !eside && ((street < 3) || ( (street >= 5) && (street <= 7)))) {
		document.daForm.ave.value = "That street's only on the east side.";
		return;
	}
	if ( eside && (street > 139)) {
		document.daForm.ave.value = "That street's only on the west side.";
		return;
	}
	if (building > 999) {
		document.daForm.ave.value = "Ain't no such block.";
		return;
	}
	
	bIndex = Math.floor((building/100));
	

	
	//below 14th is wonky
	if (street <= 14) {
		if (eside) {
		
			//define avenue and subway Arrays
			if (street < 7) {
				aveArray = "Broadway,Bowery,Bowery,2nd,1st,Ave A,Ave B,Ave C,Ave D,the FDR,".split(",");
				subwArray = "Bway,2nd,2nd,2nd,1st,A,A,A,A,A,".split(",");
			}
			else if (street == 7) {
				aveArray = "Broadway,4th,3rd,2nd,1st,Ave A,Ave B,Ave C,Ave D,the FDR,".split(",");
				subwArray = "Bway,4th,3rd,2nd,1st,A,A,A,A,A,".split(",");
			}
			else {
				aveArray = "5th,4th,3rd,2nd,1st,Ave A,Ave B,Ave C,Ave D,the FDR,".split(",");
				subwArray = "5th,4th,3rd,2nd,1st,A,A,A,A,A,".split(",");
			}
			
			//do streets; numbering scheme screwed for most in EVil.
			
			
			if (street == 1) {
				if (building < 29) bIndex = 2;
				else if (building < 76) bIndex = 3;
				else if (building < 150) bIndex = 4;
				else bindex = 10;
				//forces errmsg
			}
			
			
			//2nd & 3rd sts are about the same
			else if (street <= 3) {
				if (building < 40) bIndex = 2;
				else if (building < 84) bIndex = 3;
				else if (building < 148) bIndex = 4;
				else if (building < 203) bIndex = 5;
				else if (building < 270) bIndex = 6;
				else if (building < 400) bIndex = 7;
				else bIndex = 8;	
			}
			
			else if (street == 4) {
				if (building < 40) bIndex = 0;
				else if (building < 86) bIndex = 2;
				else if (building < 138) bIndex = 3;
				else if (building < 181) bIndex = 4;
				else if (building < 244) bIndex = 5;
				else if (building < 301) bIndex = 6;
				else if (building < 361) bIndex = 7;
				else bIndex = 8;
			}
			
			//5th & 6th behave almost normally
			else if (street < 7) {
				if (building < 200) {
					document.daForm.ave.value = "Ain't no such block.";
					return;
				}
			}
			
			//7th's another wonky street
			else if (street == 7) {
				if (building < 8) bIndex = 1;
				else if (building < 48) bIndex = 2;
				else if (building < 90) bIndex = 3;
				else if (building < 131) bIndex = 4;
				else if (building < 181) bIndex = 5;
				else if (building < 230) bIndex = 6;
				else if (building < 400) bIndex = 7;
				else bIndex = 10;
			}
			
			else if (street == 8) {
				if (building > 100) {
					if (building < 300) {
						document.daForm.ave.value = "Ain't no such block.";
						return;
					}
					else if (building < 344) bIndex = 6;
					else if (building < 460) bIndex = 7;
					else if (building < 500) bIndex = 8;
					else bIndex = 10;
				}
			}
			
			//our last screwy street; 9, 11-14 are okay
			else if (street == 10) {
				if (building < 68) bIndex = 0;
				else if (building < 100) bIndex = 1;
				else if (building < 196) bIndex = 2;
				else if (building < 243) bIndex = 3;
				else if (building < 289) bIndex = 4;
				else if (building < 339) bIndex = 5;
				else if (building < 395) bIndex = 6;
				else if (building < 450) bIndex = 7;
				else if (building < 500) bIndex = 8;
				else bIndex = 10;
			}
			
			else if ((street > 10) && (bIndex == 0) && (building > 70)) bIndex ++;
				//4th Ave is slanty, this handles a few weird addresses

					
			
		}
		
		//now do west side, below 14th; nonexistent sts already excluded.
		else {
			if (street == 3) {
				aveArray = "Broadway,La Guardia,6th,,,,,,,,".split(",");
				subwArray = "Bway,6th,6th,6th,6th,6th,6th,6th,6th,6th,".split(",");
			}
			else if (street == 4) {
				aveArray = "Broadway,La Guardia,6th,7th Ave S,8th Ave,13th St,,,,,".split(",");
				subwArray = "Bway,6th,6th,7th,8th,8th,8th,8th,8th,8th,".split(",");
			}
			//8+, others excluded
			else {
				subwArray = "6th,6th,7th,8th,8th,8th,8th,8th,8th,8th,".split(",");
				//8-13, 10-12 slanty past 6th
			 	if (street < 13) aveArray = "5th,6th,7th Ave S,Hudson St,the River,,,,,,".split(",");
			 	//13+
				else aveArray = "5th,6th,7th,8th,9th,10th,the River,,,,".split(",");
			}
			
			if (street == 3) {
				if (building < 64) bIndex = 0;
				else if (building < 200) bIndex = 1;
				else bIndex = 5;
				//forces errmsg later
			}
			
			else if (street == 4) {
				if (building < 68) bIndex = 0;
				else if (building < 100) bIndex = 1;
				else if (building < 200) bIndex = 2;
				else if (building < 300) bIndex = 3;
				else if (building < 400) bIndex = 4;
				else bIndex = 5;
			}
			
			//8th and 9th only go to 6th ave
			else if (street < 10) {
				if (building > 99) bIndex = 5;
				//forces errmsg
			}
			
			else if (street == 10) {
				if (building > 100) {
					if (building < 184) bIndex = 1;
					else if (building < 250) bIndex = 2;
					else if (building < 400) bIndex = 3;
					else bIndex = 5;
				}
			}
			
			else if ((street == 11) && (building > 170) && (building < 200)) bIndex = 2;

			//everything else normal

			
				
		
		}
		//end wside

		if ((aveArray[bIndex + 1] == "") || (aveArray[bIndex] == "")) {
			document.daForm.ave.value = "Ain't no such block.";
			return;
		}
		
		document.daForm.ave.value = aveArray[bIndex] + " & " + aveArray[bIndex + 1];
		findSubw(subwArray[bIndex],street);
	}
	//end below 14th
	
	//above 14th on the east side
	else if (eside) {
		if ((street > 52) && (street < 60)) aveArray = "5th,Park,3rd,2nd,1st,Sutton Pl,the FDR,,,,".split(",");
		else if ((street > 59) && (street < 93)) {
			if ((street > 78) && (street < 91)) aveArray = "5th,Park,3rd,2nd,1st,York,East End Ave,the FDR,,,".split(",");
			else aveArray = "5th,Park,3rd,2nd,1st,York,the FDR,,,,".split(",");
		}
		else if ((street > 113) && (street < 121)) aveArray = "5th,Park,3rd,2nd,1st,Pleasant Ave,the FDR,,,,".split(",");
		else if (street == 127) aveArray = "5th,Park,3rd,2nd,the FDR,,,,,,".split(",");
		else if ((street > 127) && (street < 132)) aveArray = "5th,Park,3rd,the East River,,,,,,".split(",");
		else if (street > 131) aveArray = "5th,Park,the East River,,,,,,,".split(",");
		else aveArray = "5th,Park,3rd,2nd,1st,the FDR,,,,,".split(",");
		
		subwArray = "5th,Lexi,Lexi,Lexi,Lexi,Lexi,Lexi,Lexi,Lexi,Lexi,".split(",");

		if ((aveArray[bIndex + 1] == "") || (aveArray[bIndex] == "")) {
			document.daForm.ave.value = "Ain't no such block.";
			return;
		}
		
		//handle Madison
		if ((bIndex == 0) && (street > 22)) {
			if (building <= 25) document.daForm.ave.value = "5th & Madison";
			else document.daForm.ave.value = "Madison & Park";

		}
		//handle Lex
		else if (bIndex == 1) {
			if (building < 134) {
				if (street <21) document.daForm.ave.value = "Park Ave So. & Irving Pl";
				else document.daForm.ave.value = "Park & Lexington";
			}
			else document.daForm.ave.value = "Lexington & 3rd";
		}
		//all others
		
		else document.daForm.ave.value = aveArray[bIndex] + " & " + aveArray[bIndex + 1];
		findSubw(subwArray[bIndex],street);
	}
	
	//west side, above 14th		

	else {
		if (street < 60) {
			subwArray = "5th,6th,7th,8th,8th,8th,8th,8th,8th,8th,".split(",");
			if (street < 23) aveArray = "5th,6th,7th,8th,9th,10th,the Hudson,,,,".split(",");
			else aveArray = "5th,6th,7th,8th,9th,10th,11th,the Hudson,,,".split(",");
		}
		
		else if (street < 110) {
			subwArray = "8th,8th,Bway,Bway,Bway,Bway,Bway,Bway,Bway,Bway,".split(",");
			if (street < 72) aveArray = "Central Park W,Columbus,Amsterdam,West End Ave,the Hudson,,,,,,".split(",");
			else aveArray = "Central Park W,Columbus,Amsterdam,West End Ave,Riverside Dr,the Hudson,,,,,".split(",");
		}
		else if (street < 125) {
			aveArray = "5th,Lenox,Adam Clayton Powell Jr Blvd,Frederick Douglass Blvd,Morningside,Amsterdam,Broadway,Riverside,,,".split(",");
			subwArray = "7th,7th,7th,8th,Bway,Bway,Bway,Bway,Bway,Bway,".split(",");
		}
		else if (street < 155){
			subwArray = "7th,7th,7th,Stni,Stni,Bway,Bway,Bway,Bway,Bway,".split(",");		
			if (street < 139) aveArray = "5th,Lenox,Adam Clayton Powell Jr Blvd,Frederick Douglass Blvd,St. Nicholas,Amsterdam,Broadway,Riverside,,,".split(",");
			else if (street < 148) aveArray = "the Harlem River,Lenox,Adam Clayton Powell Jr Blvd,Frederick Douglass Blvd,St. Nicholas,Amsterdam,Broadway,Riverside,,,".split(",");
			else aveArray= ",the Harlem River,Adam Clayton Powell Jr Blvd,Frederick Douglass Blvd,St. Nicholas,Amsterdam,Broadway,Riverside,,,".split(",");
		}
		else if (street < 168) {
			aveArray = ",,the Harlem River,Edgecombe,St. Nicholas,Amsterdam,Broadway,Riverside,,,".split(",");
			subwArray = "Stni,Stni,Stni,Stni,Stni,Bway,Bway,Bway,Bway,Bway,".split(",");		
		}
		else {
			subwArray = "Stni,Stni,Stni,Stni,Stni,Stni,Bway,Bway,Bway,Bway,".split(",");	
			if (street < 200) aveArray = ",,,the Harlem River,St. Nicholas,Amsterdam,Broadway,Riverside,,,".split(",");
			else aveArray = ",,,the Harlem River,9th Ave,10th Ave,Broadway,Inwood Park,,,".split(",");
		}
	
		if ((aveArray[bIndex + 1] == "") || (aveArray[bIndex] == "")) {
			document.daForm.ave.value = "Ain't no such block.";
			return;
		}
		
		document.daForm.ave.value = aveArray[bIndex] + " & " + aveArray[bIndex + 1];
		findSubw(subwArray[bIndex],street);
	}
	
}


function findNameStrAddr() {
	stArray = document.daForm.street.value.split(" ");
	myst = stArray[0].toUpperCase();
	if (stArray.length > 1) {
		myst2 = stArray[1].toUpperCase();
		myst2 = myst2.substring(0,2);

		//handle pecular st names
		if ((myst == "SOUTH") || (myst == "S")) {
			if (myst2 == "EN") myst += "_END";
			else if (myst2 == "ST") myst += "_ST";
		}
		else if ((myst == "NORTH") || (myst == "N")) {
			if (myst2 == "MO") myst = "MOORE";
			else if (myst2 == "EN") myst = "NORTH_END";
		}
		else if ((myst == "EAST") || (myst == "E")) {
			if (myst2 == "BR") myst = "E_BWAY";
			else if (myst2 == "HO") myst = "E_HOUSTON";
			else if (myst2 == "TO") myst = "E_TOWER";
		}
		else if ((myst == "WEST") || (myst == "W")) {
			if (myst2 == "BR") myst = "W_BWAY";
			else if (myst2 == "HO") myst = "W_HOUSTON";
			else if (myst2 == "WA") myst = "WASHINGTON";
		}	
		else if (myst == "OLD") {
			 if (myst2 == "SL") myst +="_SLIP";
			 else if (myst2 == "BR") myst +="_BWAY";
		}
		else if (myst == "BEEKMAN") {
			if (myst2 == "PL") myst += "_PL";
			else if (myst == "ST") myst += "_ST";
		}
		else if (myst == "PARK") {
			if (myst2 == "RO") myst += "_ROW";
			else if (myst2 == "PL") myst += "_PL";
			else if (myst2 == "ST") myst += "_ST";
			else if (myst2 == "TE") myst += "_TERR";
			else if (myst2 == "AV") myst += "_AVE";
		}
		else if (myst == "RIVER") {
			if (myst2 == "TE") myst += "_TERR";
		}
		else if ((myst == "ST") || (myst == "ST.") || (myst == "SAINT")) {
			if (myst2 == "JO") myst = "ST_JOHNS";
			else if (myst2 == "JA") myst = "ST_JAMES";
			else if (myst2 == "MA") myst = "ST_MARKS";
			else if (myst2 == "CL") myst = "ST_CLAIR";
			else if (myst2 == "NI") myst = "ST_NICHOLAS";
		}
		else if (myst == "YORK") {
			if (myst2 == "ST") myst += "_ST";
			if (myst2 == "AV") myst += "_AVE";
		}
		else if ((myst == "AVE") || (myst == "AVENUE")) {
			if (myst2 == "OF") myst = "AVE_FINEST";
			else myst = "AVENUE";
			//also strongest, etc.
		} 
		else if (myst == "CATHERINE") {
			if (myst2 == "ST") myst += "_ST";
			else if ((myst2 == "LA") || (myst2 == "LN")) myst += "_LN";
		}
		else if (myst == "LA") {
			if (myst2 == "GU") myst = "LAGUARDIA";
			else myst = "Whazzat";
		}
		else if ((myst == "WASHINGTON") && (myst2 == "ST")) myst += "_ST";
		else if ((myst == "GREENWICH") && (myst2 == "ST")) myst += "_ST"; 
		//else leave em alone, and it's in the vil.
		
		else if (myst == "HAVEN") {
			if (myst2 == "PL") myst += "_PL";
			else if (myst2 == "AV") myst += "_AVE";
		}
		else if (myst == "COOPER") {
			if (myst2 == "PL") myst += "_PL";
			else if (myst2 == "ST") myst += "_ST";
		}
	}	
	
	
	//financial district
	if ("STATE WATER BRIDGE PEARL WALL WHITEHALL STONE CORTLANDT COENTIES WILLIAM MARKETFIELD BEAVER NEW_ST HANOVER OLD_SLIP EXCHANGE FRONT GOUVERNEUR TRINITY MORRIS CEDAR MAIDEN FLETCHER PLATT JOHN DEY DUTCH FULTON BEEKMAN_ST CLIFF ANN GOLD PECK DOVER FRANKFORT SPRUCE".indexOf(myst) >= 0) {
		document.daForm.area.value = "the Wall Street area.";
		document.daForm.stop.value = "Fulton St/Bway-Nassau on ACJMZ2345";
	
	}
	
	//financial district OR BPC
	else if ("THAMES LIBERTY ALBANY RECTOR BATTERY VESEY".indexOf(myst) >= 0) {
		document.daForm.area.value = "the Wall Street area or Battery Park City.";
		document.daForm.stop.value = "Cortlandt or Rector on 19RW; WTC on E";
	}
	
	//BPC
	else if ("SOUTH_END NORTH_END RIVER_TERR".indexOf(myst) >= 0) {
		document.daForm.area.value = "Battery Park City.";
		document.daForm.stop.value = "Cortlandt on 19RW; WTC on E; Chambers on 1239 or AC";
	
	}

	//BPC or Tribeca
	else if ("PARK_PL MURRAY WARREN CHAMBERS".indexOf(myst) >= 0) {
		document.daForm.area.value = "Battery Park City or Tribeca.";
		document.daForm.stop.value = "Chambers on 1239 or AC";
	}
	
	//Tribeca
	else if ("BARCLAY BISHOPS CHURCH THOMAS LEONARD FRANKLIN WHITE MOORE WALKER LISPENARD ST_JOHNS YORK_ST ERICSSON COLLISTER HUBERT LAIGHT VESTRY DESBROSSES WATTS BEACH HARRISON STAPLES".indexOf(myst) >= 0) {
		document.daForm.area.value = "Tribeca.";
		document.daForm.stop.value = "Franklin on 19; Chambers on 1239 or AC";
	
	}
	
	//Tribeca or govt
	else if ("READE DUANE WORTH CENTRE CENTER".indexOf(myst) >= 0) {
		document.daForm.area.value =  "Tribeca or the City Hall area.";
		document.daForm.stop.value = "Chambers on AC or City Hall on RW";	
	}
	
	//govt district
	else if ("ST_JAMES PARK_ROW CARDINAL PARK_ST JAMES POLICE ELK AVE_FINEST FOLEY FEDERAL HOGAN'S HOGANS".indexOf(myst) >= 0) {
		document.daForm.area.value = "the City Hall area.";
		document.daForm.stop.value = "City Hall on RW; Brooklyn Bridge on 456; Chambers on JMZ";
	}
	
	//two bridges
	else if ("E_BWAY OLIVER CATHERINE_ST CHERRY PIKE MONROE MADISON HENRY RUTGERS JEFFERSON MONTGOMERY MONROE MARGINAL SAMUEL JACKSON".indexOf(myst) >= 0) {
		document.daForm.area.value = "Two Bridges (near the Manhattan Bridge).";
		document.daForm.stop.value = "East Broadway on the F";
	}

	//chinatown & little ital
	else if ("CATHERINE_LN BENSON BAXTER MULBERRY MOTT PELL DOYERS DIVISION ELIZABETH HOWARD".indexOf(myst) >= 0) {
		document.daForm.area.value = "Chinatown/Little Italy.";
		document.daForm.stop.value = "Canal St, JMNQRWZ6";
	}
	
	//loisaida
	else if ("ORCHARD LUDLOW ESSEX WILLET ABRAHAM LEWIS E_HOUSTON CANNON DELANCEY HESTER ALLEN ELDRIDGE FORSYTH CHRYSTIE ATTORNEY RIVINGTON NORFOLK SUFFOLK CLINTON RIDGE PITT COLUMBIA BARUCH MANGIN STANTON SHERIFF".indexOf(myst) >= 0) {
		document.daForm.area.value = "the Lower East Side.";
		document.daForm.stop.value = "Delancey/Essex FJMZ; Grand St BD; 2nd Ave FV";
	}
	
	//loisaida or soho or lit it
	else if ("GRAND BROOME".indexOf(myst) >= 0) {
		document.daForm.area.value = "the Lower East Side or Soho or Little Italy.";
		document.daForm.stop.value = "Spring St 6 or CE; Prince St NRW";
	}
	
	//SOHO
	else if ("KENMARE PRINCE SPRING HOUSTON W_HOUSTON JERSEY CLEVELAND CROSBY WOOSTER DOMINICK RENWICK VAN CHARLTON KING".indexOf(myst) >= 0) {
		document.daForm.area.value = "Soho.";
		document.daForm.stop.value = "Spring St 6 or CE; Prince St NRW";
	}
	
	//Soho or Vil
	else if ("MERCER THOMPSON SULLIVAN GREENE LAFAYETTE".indexOf(myst) >= 0) {
		document.daForm.area.value = "Soho or the Village";
		document.daForm.stop.value = "Spring St 6 or CE; Prince St NRW; W 4th St ABCDEFV";
	
	}
	
	//GVil
	else if ("BLEECKER JONES GREAT SHINBONE UNIVERSITY BOND ASTOR WAVERLY WASHINGTON MINETTA LAGUARDIA MACDOUGAL GAY DOWNING CARMINE LEROY MORTON CORNELIA GROVE BEDFORD COMMERCE CHRISTOPHER BARROW CHARLES PERRY BANK BETHUNE JANE HORATIO GANSEVOORT LITTLE PATCHIN WANAMAKER".indexOf(myst) >= 0) {
		document.daForm.area.value = "the Village.";
		document.daForm.stop.value = "W 4th St ABCDEFV; Christopher St 19; 8th St NRW; Astor Pl & Bleecker 6";
	}
	
	//EVIL
	else if ("ST_MARKS SZOLD HAVEN_PL COOPER_PL STUYVESANT".indexOf(myst) >= 0) {
		document.daForm.area.value = "the East Village.";
		document.daForm.stop.value = "Bleecker or Astor Pl 6; Bway/Lafayette BDFV; 2nd Ave FV; 3rd Ave L";
	}
	
	//Lincoln Tunnel
	else if ("DYER".indexOf(myst) >= 0) {
		document.daForm.area.value = "the Lincoln Tunnel area.";
		document.daForm.stop.value = "34th or 42nd on ACE";
	}
	
	//Grand Central
	else if ("VANDERBILT".indexOf(myst) >= 0) {
		document.daForm.area.value = "the Grand Central area.";
		document.daForm.stop.value = "Grand Central 4567S";
	}
	
	//dad's
	else if ("BEEKMAN_PL SUTTON MITCHELL RIVERVIEW".indexOf(myst) >= 0) {
		document.daForm.area.value = "the 50s, East of 1st Ave.";
		document.daForm.stop.value = "51st/Lexington Ave EV6";	
	}
	
	//Lincoln Center
	else if ("THELONIUS FREEDOM E_TOWER".indexOf(myst) >= 0) {
		document.daForm.area.value = "the area west of Lincoln Center";
		document.daForm.stop.value = "66th St 19";
	}

	//morningside
	else if ("MORNINGSIDE CATHEDRAL REINHOLD CLAREMONT LASALLE TIEMANN".indexOf(myst) >= 0) {
		document.daForm.area.value = "Morningside Heights.";
		document.daForm.stop.value = "Cathedral Pkwy or 116th on the 19 or BC";
	}
	
	//Manhattanville
	else if ("ST_CLAIR OLD_BWAY HAMILTON CONVENT".indexOf(myst) >= 0) {
		document.daForm.area.value = "Manhattanville (north of Columbia).";
		document.daForm.stop.value = "137th St 19, 135th St BC";
	}
	
	//Harlem
	else if ("PALADINO MARCUS MARTIN LANGSTON MANHATTAN BRADHURST".indexOf(myst) >= 0) {
		document.daForm.area.value = "Harlem.";
		document.daForm.stop.value = "110th to 125th St 456; 110th thru 145th 23";
	}
	
	//Manhattanville or Wash Hts
	else if (myst == "ST_NICHOLAS") {
		document.daForm.area.value = "try the Avenue page w/St Nicholas Ave.";
		document.daForm.stop.value = "anywhere from 125th to 191st on the 19 or AC";
	}
	
	//Wash Hts
	else if ("AUDUBON EDGECOMBE FT FORT HAVEN_AVE JUMEL WADSWORTH LAUREL PINEHURST CABRINI OVERLOOK BENNETT FAIRVIEW MARGARET".indexOf(myst) >= 0) {
		document.daForm.area.value = "Washington Heights.";
		document.daForm.stop.value = "168th St 19AC";	
	}
	
	//Inwood
	else if ("BOGARDUS HILLSIDE NAGLE ELLWOOD SICKLES SHERMAN DONGAN ARDEN TRAYER DYCKMAN VERMILYEA COOPER_ST SEAMAN PAYSON POST EXTERIOR ISHAM PARK_TERR INDIAN EMERSON".indexOf(myst) >= 0) {
		document.daForm.area.value = "Inwood.";
		document.daForm.stop.value = "Dyckman St, A or 1";
	}
	
	else if ("GREENWICH_ST WASHINGTON_ST HUDSON".indexOf(myst) >= 0) {
		document.daForm.area.value = "World Trade Center area thru the Village";
		document.daForm.stop.value = "Lots.";
	}

	else if (myst == "W_BWAY") {
		document.daForm.area.value = "World Trade Center area thru Soho.";
		document.daForm.stop.value = "Lots.";
	}

	else if (myst == "VARICK") {
		document.daForm.area.value = "Tribeca & Soho.";
		document.daForm.stop.value = "Houston or Canal on the 19.";
	}
	else if (myst == "SOUTH_ST") {
		document.daForm.area.value = "runs from the Battery thru Loisaida";
		document.daForm.stop.value = "Fulton St/Bway-Nassau ACJMZ2345 for the Seaport.";
	}
	else if (myst == "CANAL") {
		document.daForm.area.value = "How can you not know where Canal is?";
		document.daForm.stop.value = "Canal St on 19 or ACE or JMNQRWZ6";
	}
	else if (myst == "BOWERY") {
		document.daForm.area.value = "Chinatown, Lower East Side, East Village";
		document.daForm.stop.value = "Grand St BD, Bowery JMZ, 2nd Ave FV";
	}
	else if ("PARK_AVE LEXINGTON MADISON AVENUE YORK_AVE AMSTERDAM COLUMBUS CENTRAL BROADWAY RIVERSIDE MANHATTAN PLEASANT ADAM FREDERICK MALCOLM".indexOf(myst) >= 0) {
		document.daForm.area.value = "Try the Avenue page.";
		document.daForm.stop.value = "Click below.";
	}
	else {
		document.daForm.area.value = "I don't know that one.";
		document.daForm.stop.value = "Sorry.";
	}

}



function changetab (totab) {

    document.getElementById('tabave').style.backgroundColor="#999999";
    document.getElementById('tabnumst').style.backgroundColor="#999999";
    document.getElementById('tabnamest').style.backgroundColor="#999999";
 
    document.getElementById('tab'+totab).style.backgroundColor="black";
 
  if (totab == 'ave') {
    document.getElementById('ave').style.display = '';
    document.getElementById('numst').style.display = 'none';
    document.getElementById('namest').style.display = 'none';
  }

  if (totab == 'numst') {
    document.getElementById('ave').style.display = 'none';
    document.getElementById('numst').style.display = '';
    document.getElementById('namest').style.display = 'none';
  }

    if (totab == 'namest') {
    document.getElementById('ave').style.display = 'none';
    document.getElementById('numst').style.display = 'none';
    document.getElementById('namest').style.display = '';
  }
}


function goGoogle () {

   if (document.getElementById('ave').style.display == '') {
       gotostring="http://maps.google.com/?ie=UTF8&hl=en&q=" + parseInt(document.daForm.number.value) + "+" + document.daForm.avenoo.value + "+,new+york,new+york&f=q&sampleq=1";
   }

   if (document.getElementById('numst').style.display == '') {
      gotostring="http://maps.google.com/?ie=UTF8&hl=en&q=" + parseInt(document.daForm.bldg.value) + "+" + document.daForm.eorw.value + "+" + parseInt(document.daForm.str.value) + "+St,new+york,new+york&f=q&sampleq=1";
   }

   if (document.getElementById('namest').style.display == '') {
      gotostring="http://maps.google.com/?ie=UTF8&hl=en&q=" + document.daForm.street.value + "+,new+york,new+york&f=q&sampleq=1";
   }


   location.href = gotostring;

}
