/********************************************************************
 *
 * Contains the javascript code for the DMS layer.
 * Author: TxDOT
 * Leobardo J. Landeros
 * Modified by Michael Montgomery on 7/9/8
 *
 *******************************************************************/
 
var veLayerClosures = new VEShapeLayer();
var kClosureRSSFile = "RSS/HCRS.XML?";

/**
 * Loads the Closures Layer
 * Author: TxDOT. Leobardo J. Landeros
 * 04/28/08
 */
function onClosuresLoad(layer) //modified
{
    var numShapes = layer.GetShapeCount();		
    var s;
    var customIcon;
	for(var i=0; i < numShapes; ++i)
	{		
		s = layer.GetShapeByIndex(i);			
		customIcon = new VECustomIconSpecification();
		customIcon.CustomHTML = "<img alt='Closures' src='../Images/hcrs.gif'/>";
		customIcon.Image = '../Images/hcrs.gif';
		s.SetCustomIcon(customIcon);
	}
}

/**
 * Shows the Closures layer.
 * Author: TxDOT. Leobardo J. Landeros
 * 04/28/08
 */
function showClosures()
{
	veLayerClosures.DeleteAllShapes();
    var veShapeSpec = new VEShapeSourceSpecification(VEDataType.GeoRSS, 
        kClosureRSSFile + Math.random(), veLayerClosures);
    map.ImportShapeLayerData(veShapeSpec, onClosuresLoad, false);
    hideShowClosures();
}

/**
 * Hides or shows the Closures layer.
 * Author: TxDOT, Leobardo J. Landeros
 * 04/28/08
 */
function hideShowClosures()
{
	var v = document.getElementById('chkClosures').checked;
	if (!v)	
	    veLayerClosures.Hide();	
	else
		veLayerClosures.Show();
}