/**
 * Generates the code to insert a link to a MAP 
 *
 * linkText	text to appear in the link
 * address, [city], [state]      The street address, [city name | "newton"], [state code| "ma"] 
 * 
 * (<a target="_blank" href="http://www.mapquest.com/maps/map.adp?formtype=search&countryid=250
 * &addtohistory=&country=US&address=472+Massachusetts+ave&city=Cambridge&state=ma
 * &zipcode=&historyid=&submit=Get+Map">Map</a>)
 */
function makeMapLink(wholeAddress, linkText )
{
    //alert(wholeAddress + " is whole address string");
    var wholeAddress_array = wholeAddress.split( ","); 
    //alert (wholeAddress_array[0] + " is street address string");
    var address_array = wholeAddress_array[0].split(" ") ;
    var city = wholeAddress_array[1] ? wholeAddress_array[1]: "newton";
    var state = wholeAddress_array[2] ? wholeAddress_array[2] : "ma" ;

    //alert (state + " is state and " + city + " is city"); 
    if ( linkText == null  ) linkText = "Map of Location" ; ; 
    //alert ('state = ' + state + "  city = " + city);
    var mapString = '(<a target="_blank" href="http://www.mapquest.com/maps/map.adp?' ;
    mapString +=  'formtype=search&countryid=250&addtohistory=&country=US&address=';
    address_index = 0;
    //alert (mapString);
    while (address_index < address_array.length)
      {
      mapString += address_array[address_index] + "+" ;
      //alert (mapString);
      address_index += 1;
      }
    mapString +=  '&city=' + city + '&state=' + state + '&zipcode=&historyid=&submit=Get+Map">';
    mapString += linkText + '</a>)' ; 
     //alert (mapString);
     document.write(mapString);
}

function SomethingNew(){
// place holder for future capability

}