﻿Ext.namespace("TISolution");


TISolution.Default = function() {
    var mapManager = null;
    var dateTime;

    var LoadPontosEstudos = function() {
        Services.GetPontosEstudo(
            function(pontos_JSON) {
                var ponto;

                var pontos = Sys.Serialization.JavaScriptSerializer.deserialize(pontos_JSON);

                for (var i = 0; i < pontos.length; i++) {
                    ponto = new TISolution.Model.PontoEstudo(pontos[i]);
                    ponto.SetVisible(true);
                }

                ponto = new TISolution.Model.PontoEstudo(
                    {
                        Tipo: 'v',
                        Nome: "Video",
                        Latitude: -23.3823,
                        Longitude: -51.0815,
                        Video: {
                            Url: "http://www.youtube.com/watch?v=5s-yfquvjc4&feature=related"
                        }
                    });
                ponto.SetVisible(true);
            });
    }

    return {
        init: function() {
            mapManager = new TISolution.Map.Manager("map");
            LoadPontosEstudos();
        },

        GetMapManager: function() {
            return mapManager;
        }
    };
} ();

document.namespaces;

Ext.onReady(TISolution.Default.init, TISolution.Default);


//MyNewClass = Ext.extend(Object, (function()
//{
//    var privateString = "nobody else can access this";
//    
//    function privateFn()
//    {
//    }

//    return {
//        constructor: function(haha)
//        {
//        },
//        
//        newPublicFn: function()
//        {
//            console.log("Private string = " + privateString);

//            //          Invoke the private function as if it were a member. "this" will be this object.
//            privateFn(this);
//        }
//    };
//})());

//Person = Ext.extend(Object, {
//    constructor: function(first, last){
//        this.firstName = first;
//        this.lastName = last;
//    },

//    getName: function(){
//        return this.firstName + ' ' + this.lastName;
//    }
//});

//var teste = new MyNewClass();
//teste.newPublicFn();
