function Lltr(lltrXML, index, imgroot_in)
{    
    this.index = index;
    this.guid = lltrXML.getAttribute("guid") + "-" + index;
    this.date = lltrXML.getAttribute("date");
    this.code = lltrXML.getAttribute("code");
    this.efftimes = lltrXML.getAttribute("efftimes");
    this.color = lltrXML.getAttribute("color");
    this.weight = lltrXML.getAttribute("weight");
    this.opacity = lltrXML.getAttribute("opacity");
    this.fillcolor = lltrXML.getAttribute("color");    
    this.coordinatesXMLElements = lltrXML.getElementsByTagName("coordinates");
    //this.segments = lltrXML.getElementsByTagName("segments");
    this.maxwidth = lltrXML.getAttribute("maxwidth");
    this.owner = lltrXML.getAttribute("owner");
    this.aglaltitude = lltrXML.getAttribute("aglaltitude");
    this.mslaltitude = lltrXML.getAttribute("mslaltitude");
    this.lltrimagesXMLElements = lltrXML.getElementsByTagName("lltrimage");
}

Lltr.prototype.guid = null;
Lltr.prototype.date = null;
Lltr.prototype.code = null;
Lltr.prototype.efftimes = null;
Lltr.prototype.visible = false;
Lltr.prototype.color = null;
Lltr.prototype.weight = null;
Lltr.prototype.opacity = null;
Lltr.prototype.coordinatesXMLElements = null;
Lltr.prototype.points = null;
//Lltr.prototype.segments = null;
Lltr.prototype.maxwidth = null;
Lltr.prototype.owner = null;
Lltr.prototype.aglaltitude = null;
Lltr.prototype.mslaltitude = null;
Lltr.prototype.index = null;
Lltr.prototype.lltrimagesXMLElements = null;

Lltr.prototype.show = function(b_show)
{    
    
    var points = this.createPointsArray(this.coordinatesXMLElements[this.index]);

    var lltr = this.createlltr(points);
    if (lltr != null)
    {
        map.addOverlay(lltr);            
    }
    else
    {
        alert("In Lltr.prototype.show:  the lltr is null!");
    }

    
    this.visible = b_show;
}

Lltr.prototype.createPointsArray = function(coordinatesXMLElement)
{    
    var points = new Array();
    if (null == points)
    {
        alert('points is null in createPointsArray()');
    }
    
    if (coordinatesXMLElement != null)
    {
        var lat = null;
        var lng = null;
        var coordinateXMLElements = coordinatesXMLElement.getElementsByTagName("coordinate");
        var coordinateXMLElement = null;
        
        if (coordinateXMLElements != null)
        {
            for(var i = 0; i < coordinateXMLElements.length; i++)
            {
                coordinateXMLElement = coordinateXMLElements[i];
                if (null != coordinateXMLElement)
                {
                    lat = parseFloat(coordinateXMLElement.getAttribute("lat"));
                    lng = parseFloat(coordinateXMLElement.getAttribute("lng"));
                    if (null != lat && null != lng)
                    {
                        points.push(new GLatLng(lat, lng));                        
                    }
                    else
                    {
                        alert('lat or lng is null');
                    }
                }
            }
        }
    }
    else
    {
        alert('coordinatesXMLElement is null in createPointsArray()');
    }
 
    return points;   
}

//add a new field to gpolygon to store the moa info
GPolyline.prototype.lltr = null;

Lltr.prototype.createlltr = function(points)
{   
    
    lltr = new GPolyline(points, this.color, this.weight, this.opacity);
    
    if (lltr != null)
    {
        if (lltr_markers)
        {   
            this.points = points;
            lltr.lltr = this;     
            lltr_markers[lltr_markers.length] = lltr;	
            lltr_guids[this.guid] = this;	                    
	    }
	}
    
    return lltr;
}