
function AddGeoRSSLayer(layerId, source)
{
  geoRssLayer = new VEShapeLayer();
  geoRssLayer.title = layerId
  var sGeoRssUrl = source
  var geoRssLayerSpec = new VEShapeSourceSpecification(VEDataType.GeoRSS,sGeoRssUrl,geoRssLayer);
  map.ImportShapeLayerData(geoRssLayerSpec, onFeedLoad, false);
}

AddGeoRSSLayerAndCenter
function AddGeoRSSLayerAndCenter(layerId, source)
{
  geoRssLayer = new VEShapeLayer();
  geoRssLayer.title = layerId
  var sGeoRssUrl = source
  var geoRssLayerSpec = new VEShapeSourceSpecification(VEDataType.GeoRSS,sGeoRssUrl,geoRssLayer);
  map.ImportShapeLayerData(geoRssLayerSpec, onFeedLoad, true);
}

function onFeedLoad(layer)
{
     var numShapes = layer.GetShapeCount();
     for(var i=0; i < numShapes; ++i)
    {
        var s = layer.GetShapeByIndex(i);
        s.SetCustomIcon(s.IconId);
    }
    DoAlert('RSS or Collection loaded. There are '+layer.GetShapeCount()+' items in this list.');
}

function DoAlert(text) //this is used for all UI notifications, including the new alerts that contain UI elements.
{
	var d=document.getElementById("alertdiv");
	d.style.visibility="visible";
	document.getElementById("alerttext").innerHTML = document.getElementById("alerttext").innerHTML + "<br \>" + text;
    
    addShim(d,'alertshim');
}
function addShim(el,id) //creates the required 3D shim for an element. Used espcially with the DoAlert() function
{
    var shim = document.getElementById('alertshim');
    if (!shim) 
        shim = document.createElement("iframe"); 
    shim.id = id;         
    shim.frameBorder = "0"; 
    shim.style.position = "absolute";
    shim.style.zIndex = "1";
    shim.style.top  = el.offsetTop + "px";
    shim.style.left = el.offsetLeft + "px";
    shim.style.width  = el.offsetWidth + "px";
    var h = parseInt(document.getElementById("alerttitle").offsetHeight) +
	        parseInt(document.getElementById("alerttext").offsetHeight);
    if (h > 0)
	    shim.style.height = h + "px";
	else
	    shim.style.height = parseInt(document.getElementById("alerttitle").style.height) +
	                        parseInt(document.getElementById("alerttext").style.height) + "px";


    el.shimElement = shim; 
    el.parentNode.insertBefore(shim, el);
}
function HideAlert() //hides the custom Alert box
{
    document.getElementById('alertdiv').style.visibility='hidden';
    var myShim = document.getElementById("alertshim");            
    if (myShim!=null) myShim.parentNode.removeChild(myShim);            
    myShim = null;
}


