
Gen.prototype.m_initIndex = function()
{
	
    var l_html = "";
    for (var i in this.m_routeList)
    {
        var l_route = this.m_routeList[i];
        l_html += l_route.m_getIndexHtml();
        
    }
    eID("indexDiv").innerHTML = l_html;
    
    var l_poiHtml = "";
    var l_cityHtml = "";
    for (var i in this.m_placeList)
    {
        var l_place = this.m_placeList[i];
        
        if (l_place.m_category == "city")
            l_cityHtml += l_place.m_getIndexHtml();        
        else
            l_poiHtml += l_place.m_getIndexHtml();
    }
    
    eID("poiIndexDiv").innerHTML = l_poiHtml;
    eID("cityIndexDiv").innerHTML = l_cityHtml;
}

function routeClick(id)
{

	idroute ="&idroute="+ id;

    // find route
    var l_route = gen.m_routeList[id];
    // display route marker and video
    if (l_route)
    {
		 
        var l_point = l_route.m_points[0]; 
		       
        l_route.m_showInfo(l_point, true);
    }
     // ?? l_route.m_updateMarker(0, 0, l_route.m_);  
	 location.href ="#?tab="+tab+cat+idroute+idcity+idpoi;
}

function placeClick(id)
{
    PauseVideo();   // if playing 
    
    // find route
    var l_place = gen.m_placeList[id];

    
    // display route marker and video
    if (l_place)
    {
        l_place.m_showInfo(l_place.m_point, true);
    }
	idpoi = "&idpoi="+id;
	location.href ="#?tab="+tab+cat+idroute+idcity+idpoi;
}

function cityClick(id)
{
	
	document.getElementById("poiIndexDiv").style.display = "block";
	document.getElementById("cityIndexDiv").style.display = "none";
    PauseVideo();   // if playing 
    
    // find route
    var l_place = gen.m_placeList[id];

    // zoom in
    var l_bounds = l_place.m_bounds;

    var pt = l_bounds.getCenter();
    var z = map.getBoundsZoomLevel(l_bounds);
    
    if (z < gen.m_midRouteZoom) // set zoom so routes are visible
    {
        z = gen.m_midRouteZoom;
    }
    map.setCenter(pt,z);
    
    // GLog.write("zoom in " + l_place.m_name + " bounds = " + l_place.m_bounds);    
	idcity = "&idcity="+id;
	location.href ="#?tab="+tab+cat+idroute+idcity+idpoi;
}


