/* ===========================================================================================
 VTour Objects

 Author:  Selwyn Wan
 Company: EdgeState Services Inc.

 Copyright © 2008, 2009 EdgeState Services Inc.
 ===========================================================================================
*/

var kVTObjectsVersion = "1.2.9";

var gCaptureXML = false;
var gCapturedXML = "";

var vtcHeader = function(inTag)
{
    this.Name = "";
    this.Value = "";
    this.FromTag = function(inTag)
    {
        if (inTag != null)
        {
            this.Name = vtGetSubTagValue(inTag, "name");
            this.Value = vtGetSubTagValue(inTag, "value");
        }
    }
    
    this.FromTag(inTag);
}

var vtcMedia = function(inTag)
{
    this.Type = 0;
    this.URL = "";
    this.FromTag = function(inTag)
    {
        if (inTag != null)
        {
            this.Type = vtGetSubTagValue(inTag, "type");
            this.URL = vtGetSubTagValue(inTag, "url");
            if (gCaptureXML)
            {
                gCapturedXML += "<media>\r";
                gCapturedXML += "<type>" + this.Type + "</type>\r";
                gCapturedXML += "<url>";
                if (gVTOnline)
                    gCapturedXML += gVTRemoteURL;
                gCapturedXML += this.URL + "</url>\r";
                gCapturedXML += "</media>\r";
            }
        }
    }
    
    this.FromTag(inTag);
}

var gCoord2DListIsRectangle = false;

var vtcCoord2D = function(inTag)
{
    this.Type = 0;
    this.X = 0;
    this.Y = 0;
    this.FromTag = function(inTag)
    {
        if (inTag != null)
        {
            if (gCaptureXML)
                gCapturedXML += "<CoordStruct2D>\r";
                
            this.Type = vtGetSubTagValue(inTag, "type");
            this.X = vtGetSubTagValue(inTag, "x");
            this.Y = vtGetSubTagValue(inTag, "y");
            // Hack to account for bug in Map SWF
            if (gCoord2DListIsRectangle == true && this.Type == 1)
            {
                this.X -= 5;
                this.Y -= 5;
            }
            if (gCaptureXML)
            {
                gCapturedXML += "<type>" + this.Type + "</type>\r";
                gCapturedXML += "<x>" + this.X + "</x>\r";
                gCapturedXML += "<y>" + this.Y + "</y>\r";
            }
            
            if (gCaptureXML)
                gCapturedXML += "</CoordStruct2D>\r";
        }
    }
    
    this.FromTag(inTag);
}

var vtcCoord2DList = function(inTag)
{
    this.Coord2DList = new Array();
    this.length = function()
    {
        return this.Coord2DList.length;
    }
    this.GetByIndex = function(inIndex)
    {
        return this.Coord2DList[inIndex];
    }
    this.Add = function(inCoord2D)
    {
        this.Coord2DList[this.Coord2DList.length] = inCoord2D;
    }
    this.FromTag = function(inTag)
    {
        if (inTag != null)
        {
            if (gCaptureXML)
                gCapturedXML += "<CoordList2D>\r";
            
            var lTag;
            var lTags = inTag.getElementsByTagName("CoordStruct2D");
            if (lTags != null && lTags.length > 0)
            {
                // Hack to account for bug in Map SWF
                gCoord2DListIsRectangle = (lTags.length == 2);
                for (var idx = 0; idx < lTags.length; idx++)
                    this.Coord2DList[this.Coord2DList.length] = new vtcCoord2D(lTags[idx]);
            }

            if (gCaptureXML)
                gCapturedXML += "</CoordList2D>\r";
        }
    }
    
    this.FromTag(inTag);
}

var vtcCoord3D = function(inTag)
{
    this.Type = 0;
    this.X = 0;
    this.Y = 0;
    this.Z = 0;
    this.FromTag = function(inTag)
    {
        if (inTag != null)
        {
            this.Type = vtGetSubTagValue(inTag, "type");
            this.X = vtGetSubTagValue(inTag, "x");
            this.Y = vtGetSubTagValue(inTag, "y");
            this.Z = vtGetSubTagValue(inTag, "z");
        }
    }
    
    this.FromTag(inTag);
}

var vtcCoord3DList = function(inTag)
{
    this.Coord3DList = new Array();
    this.length = function()
    {
        return this.Coord3DList.length;
    }
    this.GetByIndex = function(inIndex)
    {
        return this.Coord3DList[inIndex];
    }
    this.Add = function(inCoord3D)
    {
        this.Coord3DList[this.CoordVRList.length] = inCoord3D;
    }
    this.FromTag = function(inTag)
    {
        if (inTag != null)
        {
            var lTag;
            var lTags = inTag.getElementsByTagName("CoordStruct3D");
            if (lTags != null && lTags.length > 0)
            {
                for (var idx = 0; idx < lTags.length; idx++)
                    this.Coord3DList[this.Coord3DList.length] = new vtcCoord3D(lTags[idx]);
            }
        }
    }
    
    this.FromTag(inTag);
}

var kVTCoordVRType_Default = 1;
var kVTCoordVRType_Enter = 2;
var kVTCoordVRType_Exit = 3;

var vtcCoordVR = function(inTag)
{
    this.Type = 0;
    this.Pan = 0;
    this.Tilt = 0;
    this.FOV = 0;
    this.FromTag = function(inTag)
    {
        if (inTag != null)
        {
            this.Type = vtGetSubTagValue(inTag, "type");
            this.Pan = vtGetSubTagValue(inTag, "pan");
            this.Tilt = vtGetSubTagValue(inTag, "tilt");
            this.FOV = vtGetSubTagValue(inTag, "FOV");
        }
    }
    
    this.FromTag(inTag);
}

var vtcCoordVRList = function(inTag)
{
    this.CoordVRList = new Array();
    this.length = function()
    {
        return this.CoordVRList.length;
    }
    this.GetByIndex = function(inIndex)
    {
        return this.CoordVRList[inIndex];
    }
    this.Add = function(inCoordVR)
    {
        this.CoordVRList[this.CoordVRList.length] = inCoordVR;
    }
    this.FromTag = function(inTag)
    {
        if (inTag != null)
        {
            var lTag;
            var lTags = inTag.getElementsByTagName("CoordStructVR");
            if (lTags != null && lTags.length > 0)
            {
                for (var idx = 0; idx < lTags.length; idx++)
                    this.CoordVRList[this.CoordVRList.length] = new vtcCoordVR(lTags[idx]);
            }
        }
    }
    
    this.FromTag(inTag);
}

var vtcParamList = function(inTag)
{
    this.ParamList = new Array();
    this.length = function()
    {
        return this.ParamList.length;
    }
    this.GetByIndex = function(inIndex)
    {
        return this.ParamList[inIndex];
    }
    this.Add = function(inParam)
    {
        this.ParamList[this.ParamList.length] = inParam;
    }
    this.FromTag = function(inTag)
    {
        var bOK = false;
        
        if (inTag != null)
        {
            if (gCaptureXML)
                gCapturedXML += "<ParamList>\r";
                
            var lTag;
            var lTags = inTag.getElementsByTagName("param");
            if (lTags != null && lTags.length > 0)
            {
                for (var idx = 0; idx < lTags.length; idx++)
                {
                    if (lTags[idx].childNodes.length > 0)
                    {
                        this.ParamList[this.ParamList.length] = lTags[idx].childNodes[0].nodeValue;
                        if (gCaptureXML)
                            gCapturedXML += "<param>" + lTags[idx].childNodes[0].nodeValue + "</param>\r";
                    }
                    else
                    {
                        this.ParamList[this.ParamList.length] = "";
                        if (gCaptureXML)
                            gCapturedXML += "<param></param>\r";
                    }
                }
            }
            
            if (gCaptureXML)
                gCapturedXML += "</ParamList>\r";
        }
        
        return bOK;
    }
    
    this.FromTag(inTag);
}

var kVTActionType_ShowText = 1;
var kVTActionType_GoBrowserURL = 2;
var kVTActionType_PlayVideo = 3;
var kVTActionType_LoadVRContent = 4;
var kVTActionType_LoadPlace = 5;
var kVTActionType_ShowImage = 6;
var kVTActionType_HLMapMarker = 7;
var kVTActionType_LoadPlaceWithTransition = 8;
var kVTActionType_LoadMap = 9;
var kVTActionType_LoadVideoURL = 10;
var kVTActionType_ShowPOV = 11;

var vtcAction = function(inTag)
{
    this.Type = "";
    this.ParamListObj = null;
    this.FromTag = function(inTag)
    {
        var bOK = false;
        
        if (inTag != null)
        {
            if (gCaptureXML)
                gCapturedXML += "<ActionObj>\r";
                
            bOK = true;
            
            var lTag;
            
            if ((this.Type = vtGetSubTagValue(inTag, "type")) == null)
                bOK = false;
            {
                if (gCaptureXML)
                    gCapturedXML += "<type>" + this.Type + "</type>\r";
            }
            if (bOK && (lTag = vtGetSubTagTag(inTag, "ParamList")) != null)
                this.ParamListObj = new vtcParamList(lTag);
            else
                bOK = false;
                
            if (gCaptureXML)
                gCapturedXML += "</ActionObj>\r";
        }
        
        return bOK;
    }
    
    this.FromTag(inTag);
}

var vtcActionList = function(inTag)
{
    this.ActionList = new Array();
    this.length = function()
    {
        return this.ActionList.length;
    }
    this.GetByIndex = function(inIndex)
    {
        return this.ActionList[inIndex];
    }
    this.Add = function(inAction)
    {
        this.ActionList[this.ActionList.length] = inAction;
    }
    this.FromTag = function(inTag)
    {
        var bOK = false;
        
        if (inTag != null)
        {
            if (gCaptureXML)
                gCapturedXML += "<ActionList>\r";
                
            var lTag;
            var lTags = inTag.getElementsByTagName("ActionObj");
            if (lTags != null && lTags.length > 0)
            {
                for (var idx = 0; idx < lTags.length; idx++)
                    this.ActionList[this.ActionList.length] = new vtcAction(lTags[idx]);
            }
            
            if (gCaptureXML)
                gCapturedXML += "</ActionList>\r";
        }
        
        return bOK;
    }
    
    this.FromTag(inTag);
}

var kVTCondActionType_MouseClick = 1;
var kVTCondActionType_MouseEnter = 2;
var kVTCondActionType_MouseExit = 3;
var kVTCondActionType_MouseDown = 4;
var kVTCondActionType_MouseUp = 5;
var kVTCondActionType_MouseMoved = 6;
var kVTCondActionType_Loaded = 7;

var vtcCondAction = function(inTag)
{
    this.Type = "";
    this.ActionListObj = null;
    this.FromTag = function(inTag)
    {
        var bOK = false;
        
        if (inTag != null)
        {
            if (gCaptureXML)
                gCapturedXML += "<CondActionObj>\r";
                
            bOK = true;
            
            var lTag;
            
            if ((this.Type = vtGetSubTagValue(inTag, "type")) == null)
                bOK = false;
            else
            {
                if (gCaptureXML)
                    gCapturedXML += "<type>" + this.Type + "</type>\r";
            }
            if (bOK && (lTag = vtGetSubTagTag(inTag, "ActionList")) != null)
                this.ActionListObj = new vtcActionList(lTag);
            else
                bOK = false;

            if (gCaptureXML)
                gCapturedXML += "</CondActionObj>\r";
        }
        
        return bOK;
    }
    
    this.FromTag(inTag);
}

var vtcCondList = function(inTag)
{
    this.CondList = new Array();
    this.length = function()
    {
        return this.CondList.length;
    }
    this.GetByIndex = function(inIndex)
    {
        return this.CondList[inIndex];
    }
    this.Add = function(inCondAction)
    {
        this.CondList[this.CondList.length] = inCondAction;
    }
    this.FromTag = function(inTag)
    {
        var bOK = false;
        
        if (inTag != null)
        {
            if (gCaptureXML)
                gCapturedXML += "<CondList>\r";
                
            var lTag;
            var lTags = inTag.getElementsByTagName("CondActionObj");
            if (lTags != null && lTags.length > 0)
            {
                for (var idx = 0; idx < lTags.length; idx++)
                    this.CondList[this.CondList.length] = new vtcCondAction(lTags[idx]);
            }

            if (gCaptureXML)
                gCapturedXML += "</CondList>\r";
        }
        
        return bOK;
    }
    
    this.FromTag(inTag);
}

var vtcRow = function(inTag)
{
    this.ID = 0;
    this.Type = "";
    this.Header = null;
    this.Caption = "";
    this.CondListObj = null;
    this.FromTag = function(inTag)
    {
        var bOK = false;
        
        if (inTag != null)
        {
            bOK = true;
            
            var lTag;
            
            if ((this.ID = vtGetSubTagValue(inTag, "id")) == null)
                bOK = false;
            if (bOK && (this.Type = vtGetSubTagValue(inTag, "type")) == null)
                bOK = false;
            if (bOK && (lTag = vtGetSubTagTag(inTag, "header")) != null)
                this.Header = new vtcHeader(lTag);
            else
                bOK = false;
            if (bOK && (this.Caption = vtGetSubTagValue(inTag, "caption")) == null)
                bOK = false;
            if (bOK && (lTag = vtGetSubTagTag(inTag, "CondList")) != null)
                this.CondListObj = new vtcCondList(lTag);
            else
                bOK = false;
        }
        
        return bOK;
    }
    
    this.FromTag(inTag);
}

var vtcRowList = function(inTag)
{
    this.RowList = new Array();
    this.length = function()
    {
        return this.RowList.length;
    }
    this.GetByIndex = function(inIndex)
    {
        return this.RowList[inIndex];
    }
    this.Add = function(inRow)
    {
        this.RowList[this.RowList.length] = inRow;
    }
    this.FromTag = function(inTag)
    {
        if (inTag != null)
        {
            var lTag;
            var lTags = inTag.getElementsByTagName("row");
            if (lTags != null && lTags.length > 0)
            {
                for (var idx = 0; idx < lTags.length; idx++)
                    this.RowList[this.RowList.length] = new vtcRow(lTags[idx]);
            }
        }
    }
    
    this.FromTag(inTag);
}

var vtcMarker = function(inTag)
{
    this.ID = 0;
    this.Type = "";
    this.Category = 0;
    this.Coord2DListObj = null;
    this.CondListObj = null;
    this.FromTag = function(inTag)
    {
        var bOK = false;
        
        if (inTag != null)
        {
            bOK = true;
            
            var lTag;
            
            if (gCaptureXML)
                gCapturedXML += "<MarkerObj>\r";
                
            if ((this.ID = vtGetSubTagValue(inTag, "id")) == null)
                bOK = false;
            else
            {
                if (gCaptureXML)
                    gCapturedXML += "<id>" + this.ID + "</id>\r";
            }
            if (bOK && (this.Type = vtGetSubTagValue(inTag, "type")) == null)
                bOK = false;
            else
            {
                if (gCaptureXML)
                    gCapturedXML += "<type>" + this.Type + "</type>\r";
            }
            if (bOK && (lTag = vtGetSubTagTag(inTag, "CoordList2D")) != null)
                this.Coord2DListObj = new vtcCoord2DList(lTag);
            else
                bOK = false;
            if (bOK && (this.Category = vtGetSubTagValue(inTag, "category")) == null)
                bOK = false;
            else
            {
                if (gCaptureXML)
                    gCapturedXML += "<category>" + this.Category + "</category>\r";
            }
            if (bOK && (lTag = vtGetSubTagTag(inTag, "CondList")) != null)
                this.CondListObj = new vtcCondList(lTag);
                
            if (gCaptureXML)
                gCapturedXML += "</MarkerObj>\r";
        }
        
        return bOK;
    }
    
    this.FromTag(inTag);
}

var vtcMarkerList = function(inTag)
{
    this.MarkerList = new Array();
    this.length = function()
    {
        return this.MarkerList.length;
    }
    this.GetByIndex = function(inIndex)
    {
        return this.MarkerList[inIndex];
    }
    this.Add = function(inMarker)
    {
        this.MarkerList[this.MarkerList.length] = inMarker;
    }
    this.FromTag = function(inTag)
    {
        if (inTag != null)
        {
            if (gCaptureXML)
                gCapturedXML += "<MarkerList>\r";
        
            var lTag;
            var lTags = inTag.getElementsByTagName("MarkerObj");
            if (lTags != null && lTags.length > 0)
            {
                for (var idx = 0; idx < lTags.length; idx++)
                    this.MarkerList[this.MarkerList.length] = new vtcMarker(lTags[idx]);
            }
            
            if (gCaptureXML)
                gCapturedXML += "</MarkerList>\r";
        }
    }
    
    this.FromTag(inTag);
}

var vtcMap = function(inTag)
{
    this.ID = 0;
    this.Title = "";
    this.Type = "";
    this.Media = null;
    this.MarkerListObj = null;
    this.MapXML = "";
    this.FromTag = function(inTag)
    {
        var bOK = false;
        
        if (inTag != null)
        {
            bOK = true;
            
            var lTag;
            
            gCaptureXML = true;
            gCapturedXML = "";
            
            gCapturedXML += "<MapObj>\r";
            
            if ((this.ID = vtGetSubTagValue(inTag, "id")) == null)
                bOK = false;
            else
            {
                if (gCaptureXML)
                    gCapturedXML += "<id>" + this.ID + "</id>\r";
            }
            
            if (bOK && (this.Title = vtGetSubTagValue(inTag, "title")) == null)
                bOK = false;
            else
            {
                if (gCaptureXML)
                    gCapturedXML += "<title>" + this.Title + "</title>\r";
            }
            if (bOK && (this.Type = vtGetSubTagValue(inTag, "type")) == null)
                bOK = false;
            else
            {
                if (gCaptureXML)
                    gCapturedXML += "<type>" + this.Type + "</type>\r";
            }
            if (bOK && (lTag = vtGetSubTagTag(inTag, "media")) != null)
                this.Media = new vtcMedia(lTag);
            else
                bOK = false;
            if (bOK && (lTag = vtGetSubTagTag(inTag, "MarkerList")) != null)
                this.MarkerListObj = new vtcMarkerList(lTag);
            else
                bOK = false;
                
            gCapturedXML += "</MapObj>\r";
    
            this.MapXML = gCapturedXML;            
            gCaptureXML = false;
            gCapturedXML = "";
        }
        
        return bOK;
    }
    
    this.FromTag(inTag);
}

var kVTTabTypeUnknown = 0;
var kVTTabTypeSummary = 1;
var kVTTabTypeMap = 2;
var kVTTabTypeDetails = 3;
var kVTTabTypeProximity = 4;
var kVTTabTypeSearch = 5;

var vtcTab = function(inTag)
{
    this.ID = 0;
    this.Title = "";
    this.Type = "";
    this.Header = null;
    this.RowListObj = null;
    this.MapObj = null;
    this.FromTag = function(inTag)
    {
        var bOK = false;
        
        if (inTag != null)
        {
            bOK = true;
            
            var lTag;
            
            if ((this.ID = vtGetSubTagValue(inTag, "id")) == null)
                bOK = false;
            if (bOK)
                this.Title = vtGetSubTagValue(inTag, "title");
            if (bOK && (this.Type = vtGetSubTagValue(inTag, "type")) == null)
                bOK = false;
            if (bOK && (lTag = vtGetSubTagTag(inTag, "header")) != null)
                this.Header = new vtcHeader(lTag);
            if (bOK)
            {
                if (this.Type == kVTTabTypeMap)
                {
                    if ((lTag = vtGetSubTagTag(inTag, "MapObj")) != null)
                        this.MapObj = new vtcMap(lTag);
                    else
                        bOK = false;
                }
                else
                {
                    if ((lTag = vtGetSubTagTag(inTag, "rowlist")) != null)
                        this.RowListObj = new vtcRowList(lTag);
                    else
                        bOK = false;
                }
            }
        }
        
        return bOK;
    }
    
    this.FromTag(inTag);
}

var vtcTabList = function(inTag)
{
    this.TabList = new Array();
    this.length = function()
    {
        return this.TabList.length;
    }
    this.GetByIndex = function(inIndex)
    {
        return this.TabList[inIndex];
    }
    this.Add = function(inTab)
    {
        this.TabList[this.TabList.length] = inTag;
    }
    this.FromTag = function(inTag)
    {
        if (inTag != null)
        {
            var lTag;
            var lTags = inTag.getElementsByTagName("tab");
            if (lTags != null && lTags.length > 0)
            {
                for (var idx = 0; idx < lTags.length; idx++)
                    this.TabList[this.TabList.length] = new vtcTab(lTags[idx]);
            }
        }
    }
    
    this.FromTag(inTag);
}

var vtcImageList = function(inTag)
{
    this.ImageList = new Array();
    this.length = function()
    {
        return this.ImageList.length;
    }
    this.GetByIndex = function(inIndex)
    {
        return this.ImageList[inIndex];
    }
    this.Add = function(inImage)
    {
        this.ImageList[this.ImageList.length] = inImage;
    }
    this.FromTag = function(inTag)
    {
        if (inTag != null)
        {
            var lTag;
            var lTags = inTag.getElementsByTagName("media");
            if (lTags != null && lTags.length > 0)
            {
                for (var idx = 0; idx < lTags.length; idx++)
                    this.ImageList[this.ImageList.length] = new vtcMedia(lTags[idx]);
            }
        }
    }
    
    this.FromTag(inTag);
}

var vtcHotspot = function(inTag)
{
    this.HotspotID = 0;
    this.RefID = 0;
    this.Title = "";
    this.Category = 0;
    this.CoordVRListObj = null;
    this.Media = null;
    this.CondListObj = null;
    this.FromTag = function(inTag)
    {
        var bOK = false;
        
        if (inTag != null)
        {
            bOK = true;
            
            var lTag;
            
            if ((this.HotspotID = vtGetSubTagValue(inTag, "hotspotID")) == null)
                bOK = false;
            if ((this.RefID = vtGetSubTagValue(inTag, "refID")) == null)
                bOK = false;
            if (bOK && (this.Title = vtGetSubTagValue(inTag, "title")) == null)
                bOK = false;
            if (bOK && (lTag = vtGetSubTagTag(inTag, "CoordListVR")) != null)
                this.CoordVRListObj = new vtcCoordVRList(lTag);
            else
                bOK = false;
            if (bOK && (this.Category = vtGetSubTagValue(inTag, "category")) == null)
                bOK = false;
            if (bOK && (lTag = vtGetSubTagTag(inTag, "media")) != null)
                this.Media = new vtcMedia(lTag);
            if (bOK && (lTag = vtGetSubTagTag(inTag, "CondList")) != null)
                this.CondListObj = new vtcCondList(lTag);
        }
        
        return bOK;
    }
    
    this.FromTag(inTag);
}

var vtcHotspotList = function(inTag)
{
    this.HotspotList = new Array();
    this.length = function()
    {
        return this.HotspotList.length;
    }
    this.GetByIndex = function(inIndex)
    {
        return this.HotspotList[inIndex];
    }
    this.Add = function(inHotspot)
    {
        this.HotspotList[this.HotspotList.length] = inHotspot;
    }
    this.FromTag = function(inTag)
    {
        if (inTag != null)
        {
            var lTag;
            var lTags = inTag.getElementsByTagName("HotspotObj");
            if (lTags != null && lTags.length > 0)
            {
                for (var idx = 0; idx < lTags.length; idx++)
                    this.HotspotList[this.HotspotList.length] = new vtcHotspot(lTags[idx]);
            }
        }
    }
    
    this.FromTag(inTag);
}

var vtcPano = function(inTag)
{
    this.RefID = 0;
    this.NorthAngle = 0;
    this.Title = "";
    this.InitialAngles = null;
    this.Media = null;
    this.HotspotListObj = null;
    this.FromTag = function(inTag)
    {
        var bOK = false;
        
        if (inTag != null)
        {
            bOK = true;
            
            var lTag;
            
            if ((this.RefID = vtGetSubTagValue(inTag, "refID")) == null)
                bOK = false;
            if (bOK && (this.NorthAngle = vtGetSubTagValue(inTag, "NorthAngle")) == null)
                bOK = false;
            if (bOK && (this.Title = vtGetSubTagValue(inTag, "title")) == null)
                bOK = false;
            if (bOK && (lTag = vtGetSubTagTag(inTag, "CoordStructVR")) != null)
                this.InitialAngles = new vtcCoordVR(lTag);
            else
                bOK = false;
            if (bOK && (lTag = vtGetSubTagTag(inTag, "media")) != null)
                this.Media = new vtcMedia(lTag);
            else
                bOK = false;
            if (bOK && (lTag = vtGetSubTagTag(inTag, "HotspotList")) != null)
                this.HotspotListObj = new vtcHotspotList(lTag);
            else
                bOK = false;
        }
        
        return bOK;
    }
    
    this.FromTag(inTag);
}


var vtcBanner = function(inTag)
{
    this.Media = null;
    this.CondListObj = null;
    this.FromTag = function(inTag)
    {
        var bOK = false;
        
        if (inTag != null)
        {
            bOK = true;
            
            var lTag;
            
            if (bOK && (lTag = vtGetSubTagTag(inTag, "media")) != null)
                this.Media = new vtcMedia(lTag);
            else
                bOK = false;
            if (bOK && (lTag = vtGetSubTagTag(inTag, "CondList")) != null)
                this.CondListObj = new vtcCondList(lTag);
        }
        
        return bOK;
    }
    
    this.FromTag(inTag);
}

var vtcInfoTemplate = function(inTag)
{
    this.ID = 0;
    this.Title = "";
    this.TabListObj = null;
    this.PanoObj = null;
    this.BannerObj = null;
    this.ImageListObj = null;
    this.FromTag = function(inTag)
    {
        var bOK = false;
        
        if (inTag != null)
        {
            bOK = true;
            
            var lTag;
            
            if ((this.ID = vtGetSubTagValue(inTag, "id")) == null)
                bOK = false;
            if (bOK && (this.Title = vtGetSubTagValue(inTag, "title")) == null)
                bOK = false;
            if (bOK && (lTag = vtGetSubTagTag(inTag, "TabList")) != null)
                this.TabListObj = new vtcTabList(lTag);
            else
                bOK = false;
            if (bOK && (lTag = vtGetSubTagTag(inTag, "PanoObj")) != null)
                this.PanoObj = new vtcPano(lTag);
            else
                bOK = false;
            if (bOK && (lTag = vtGetSubTagTag(inTag, "BannerObj")) != null)
                this.BannerObj = new vtcBanner(lTag);
            else
                bOK = false;
            if (bOK && (lTag = vtGetSubTagTag(inTag, "ImageList")) != null)
                this.ImageListObj = new vtcImageList(lTag);
            else
                bOK = false;
        }
        
        return bOK;
    }
    
    this.FromTag(inTag);
}


