//Code from: http://gmaps.yellowbkpk.com/jared/browser/mozilla/js/walk.directions.js
/********************************************\
* code for info balloons with pull down menu *
\********************************************/
DIRECTION_TYPE_FROM = " From ";
DIRECTION_TYPE_TO = " To ";
DIRECTION_TYPE = "endDirection";
LOCATION_DIRECTIONS = "locationDirections";
SEARCH_DIRECTIONS = "searchDirections";
LOCATION_VALUE = "locationValue";
SEARCH_VALUE = "searchValue";


function getDirections(button, id, title, lat, lng)
{
    var to = document.getElementById(DIRECTION_TYPE).innerHTML == DIRECTION_TYPE_TO ?
        true : false;
   // var l1 = getLocationById(id);
   // var loc1 = l1.point.y + "," + l1.point.x + "+(" + title + ")";
    var loc1 = lat + "," + lng + "+(" + title + ")";
    var loc2 = button.id == LOCATION_DIRECTIONS ?
        document.getElementById(LOCATION_VALUE).value :
        document.getElementById(SEARCH_VALUE).value;
    
    if (loc2 == "") return;
        
    var query = new Array();
    query[query.length] = "http://maps.google.com/maps?saddr=";
    
    if (to) 
    {
        query[query.length] = loc1;
    }
    else
    {
        query[query.length] = loc2;
    }
    
    query[query.length] = "&daddr=";
    
    if (to) 
    {
        query[query.length] = loc2;
    }
    else
    {
        query[query.length] = loc1;
    }
    window.open(query.join(""),'','scrollbars=yes,menubar=no,height=600,width=800,resizable=yes,toolbar=no,location=no,status=no');
}

/*************************************************/
function switchToFrom(a, b)
{
    var c = document.getElementById(a);
    var d = document.getElementById(b);
    if (c.style.textDecoration == "none") return;
    
    var styles = ["textDecoration", "fontWeight", "color"];
    
    for (var i=0; i<styles.length; i++)
    {
        var e = c.style[styles[i]];
        c.style[styles[i]] = d.style[styles[i]];
        d.style[styles[i]] = e;
    }
    
    c.blur();
    d.blur();
    
    document.getElementById(DIRECTION_TYPE).innerHTML = d.innerHTML;
}














