/********************************************************************
 *
 * Contains the javascript code for the HAR audio.
 * Author: TxDOT
 * Leobardo J. Landeros
 * Shamelessly Borrowed by Michael Montgomery for use by TTI-El Paso
 *
 *******************************************************************/
var HARReloadTime = 60000;
var veLayerHAR = new VEShapeLayer();

/*
 * Adds the layer to the map.
 * Author: Leobardo J. Landeros
 */
function showHARRSS()
{
	veLayerHAR.DeleteAllShapes();
	var veShapeSpec = new VEShapeSourceSpecification(VEDataType.GeoRSS,"RSS/HARRSS.xml?" + Math.random(), veLayerHAR);
    map.ImportShapeLayerData(veShapeSpec, onHARLoad, false);
    setTimeout("showHARRSS()", HARReloadTime);
}


/*
 * Reads the layer.
 * Author: Leobardo J. Landeros
 */
function onHARLoad(layer)
{
	var numShapes = layer.GetShapeCount();
	var s = layer.GetShapeByIndex(0); // Get the only item from the file;	
	var splitter = s.GetTitle().split('~');	
	s.SetTitle (splitter[0]);
	var customIcon = new VECustomIconSpecification();
	customIcon.CustomHTML = "<img alt='HAR' src='../Images/HAR/" + splitter[1] + "' />";
	customIcon.Image = '../Images/HAR/' + splitter[1];
	s.SetCustomIcon (customIcon);	
}