<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">

<script type="text/javascript">

var ctrlLoaded = false;
var treeReady = false;
var intStateCompl = false;
var thisFrame = this;
var mapFrame = %s;

// public functions -----------------------------------------------
//
function Refresh()
{
    thisFrame.legendScriptFrame.location.replace("%s?MAPNAME=" + encodeURIComponent(GetMapFrame().GetMapName()) + "&SESSION=" + GetMapFrame().GetSessionId() + "&SUMMARY=");
}

function InternalStateComplete()
{
    return thisFrame.intStateCompl;
}

function SetScale(scale)
{
    thisFrame.legendUiFrame.SetScale(scale);
}

function GetLayer(layerId)
{
    return thisFrame.legendUiFrame.GetLayer(layerId);
}

function GetLayers(onlyVisible, onlySelectable)
{
    return thisFrame.legendUiFrame.GetLayers(onlyVisible, onlySelectable);
}

function GetBaseGroups(onlyVisible,scale)
{
    return thisFrame.legendUiFrame.GetBaseGroups(onlyVisible,scale);
}

function ExpandLayerInLegend(layerName, expandInLegend)
{ 
    return thisFrame.legendUiFrame.ExpandLayerInLegend(layerName, expandInLegend);
} 

function ExpandGroupInLegend(groupName, expandInLegend)
{ 
    return thisFrame.legendUiFrame.ExpandGroupInLegend(groupName, expandInLegend);
} 

// private functions -----------------------------------------------
//
function IsUiReady()
{
    return thisFrame.ctrlLoaded;
}

function OnControlLoaded()
{
    thisFrame.ctrlLoaded = true;
}

function OnInternalStateComplete()
{
    thisFrame.intStateCompl = true;
}

function GetMapFrame()
{
    return mapFrame;
}

function OnForwardMouseDown(e)
{
    thisFrame.legendUiFrame.OnForwardMouseDown(e);
}

</script>
</head>

<frameset rows="0,*" frameborder=0 border=0>
    <frame name="legendScriptFrame" src="%s?MAPNAME=%s&LC=0&SESSION=%s" noresize>
    <frame name="legendUiFrame" src="%s?LOCALE=%s" noresize>
</frameset>