﻿function TerraExplorerFramework() { }

TerraExplorerFramework.prototype.ITerraExplorer51 = null;

TerraExplorerFramework.prototype.TerraExplorer = null;
TerraExplorerFramework.prototype.TerraExplorerWindow = null;

TerraExplorerFramework.prototype.BorderStyle = 0;
TerraExplorerFramework.prototype.Heigth = "100%";
TerraExplorerFramework.prototype.Width = "100%";

TerraExplorerFramework.prototype.CreateWindow = function(id, silent)
{
    var container = document.getElementById(id);

    container.style.display = "inline";
    
    this.TerraExplorerWindow = document.createElement("object");
    this.TerraExplorerWindow.setAttribute("classid", "clsid:3a4f9192-65a8-11d5-85c1-0001023952c1");
    this.TerraExplorerWindow.setAttribute("height", this.Heigth);
    this.TerraExplorerWindow.setAttribute("width", this.Width);
    this.TerraExplorerWindow.setAttribute("borderstyle", this.BorderStyle);
    
    container.appendChild(this.TerraExplorerWindow);

    if (silent)
        container.style.display = "none";
                        
    this.Initialize();
}

TerraExplorerFramework.prototype.GetVersion = function()
{
    return GetTEVersion(this.ITerraExplorer51);
}

TerraExplorerFramework.prototype.Initialize = function()
{
    this.TerraExplorer = document.createElement("object");
    this.TerraExplorer.setAttribute("classid", "clsid:3a4f9191-65a8-11d5-85c1-0001023952c1");
    
    this.ITerraExplorer51 = this.TerraExplorer.interface("ITerraExplorer51");
}

TerraExplorerFramework.prototype.IsInitialized = function()
{
    return this.TerraExplorer != null;
}

TerraExplorerFramework.prototype.IsValidVersion = function(major, minor, build)
{
    return IsValidTEVersion(this.ITerraExplorer51, major, minor, build);
}