var highhits=0;
var map;

function show_points() {
    var i;
    var points = new Array();
    var pt;
    var startico;
    var endico;
    var mrk = new Array;
    var m;
    startico = new GIcon();
    if(highhits==0) {
        startico.shadow = 'shadow50.png';
        startico.image = 'dd-start.png';
    }
    else {
        startico.shadow = 'http://www.google.com/mapfiles/shadow50.png';
        startico.image = 'http://www.google.com/mapfiles/dd-start.png';
    }
    startico.iconSize = new GSize(20,34);
    startico.shadowSize = new GSize(37,34);
    startico.iconAnchor = new GPoint(9,34);
    startico.infoWindowAnchor = new GPoint(5, 1);
    endico = new GIcon(startico);
    if(highhits==0) {
        endico.image = 'dd-end.png';
    }
    else {
        endico.image = 'http://www.google.com/mapfiles/dd-end.png';
    }
    for(i=0;i<pts.length;i++) {
        pt = new GPoint(pts[i][0], pts[i][1] );
        points.push(pt);
        if(i==0) {
            m = new GMarker(pt,startico);
            map.recenterOrPanToLatLng(pt);
        }
        else {
            if(i==pts.length-1) {
                m = new GMarker(pt,endico);
            }
            else {
                m = new GMarker(pt);
            }
        }
        m.txt = pts[i][2];

        map.addOverlay(m);
        GEvent.addListener(
                m, 'click', function() {
                this.openInfoWindowHtml(this.txt);
                }
                );
    }
    var ovl = new GPolyline(points);
    map.addOverlay(ovl);

} // show_points

if (GBrowserIsCompatible()) {
    var mapdiv=document.getElementById('map');
    setmapsize();
    map = new GMap(mapdiv);
    map.addControl(new GLargeMapControl());
    map.addControl(new GMapTypeControl());
    map.centerAndZoom(new GPoint(-95, 40), 13);
    show_points();
}

window.onresize=setmapsize;

function setmapsize() {
    var mapdiv=document.getElementById('map');
    var h;
    var w;
    var d=document;
    if (typeof window.innerWidth != "undefined") {
        w=window.innerWidth;
        h=window.innerHeight;
    }
    else if(d.documentElement && typeof d.documentElement.offsetWidth != "undefined" && d.documentElement.offsetWidth != 0) {
        w=d.documentElement.offsetWidth;
        h=d.documentElement.offsetHeight;
    }
    else if (d.body && typeof d.body.offsetWidth != "undefined")
    {
        w = d.body.offsetWidth ;
        h = d.body.offsetHeight ;
    };
    mapdiv.style.height = (h-120) + 'px';
    mapdiv.style.width = (w*0.70) + 'px';
}


function zoomtopoint(num) {
    if(pts[num]) {
        map.recenterOrPanToLatLng(new GPoint(pts[num][0],pts[num][1]) );
    }
}
