
var tk_googleMap = new GoogleMap();
var tk_g_timer = null;

function tk_initialize()
{
	tk_Func_SelectMap(g_mapType);
}
function tk_initAllMap()
{
	tk_googleMap.map = null;
}
function tk_Func_SelectMap(index)
{
	var divObj = document.getElementById("mapTracking");
	divObj.innerHTML = "";
	tk_initAllMap();
	switch(g_mapType)
	{
		case 0:
			tk_googleMap.initMap(divObj);	
			break;	
		
	}
	
}

function tk_globalSelectedVehicleInformation(imei)
{
	
	
	tk_removeAllObject();
	localDataInfo.getVehicleInfo(imei);
	
}
function tk_globalPlay()
{

	if(tk_g_timer != null)
	{
		clearInterval(tk_g_timer);
		//g_playIndex = 0;
	}
	g_currentVehicleInfo = [];
	tk_trackingTimerFunc();
	tk_g_timer = setInterval(tk_trackingTimerFunc, g_interval * 1000);
}	

function tk_globalPause()
{
	clearInterval(tk_g_timer);
}
function tk_globalDrawPolyLineOnMap()
{
	
	switch(g_mapType)
	{
		case 0:
			tk_googleMap.drawPolyLine();	
			break;	
		
	}
}


function tk_removeAllObject()
{
	switch(g_mapType)
	{
		case 0:
			tk_googleMap.removeMarker();
			tk_googleMap.removePolyLine();
			break;	
		
	}
}

function tk_globaldrawMarker(index)
{
	
	g_playIndex = index;
	switch(g_mapType)
	{
		case 0:
			tk_googleMap.drawMarker(index);	
			break;	
		
	}
}
function tk_trackingTimerFunc()
{
	
	localDataInfo.getTrackingVehicleInfo(imei_tracking);
	console.info(imei_tracking+":"+g_currentVehicleInfo.length)

	if(g_currentVehicleInfo.length > 0)	
		tk_globaldrawMarker(g_currentVehicleInfo.length - 1);
}