FrameManager = {
    HashAtual: null,
    Init: function()
    {
        this.HashAtual = location.hash;
    },
    GetCookieResize: function()
    {
        var valoresCookies = {};
        if (!document || !document.cookie) return;
        if (document.cookie.length > 0)
        {
            var arr = document.cookie.split(';');
            for (var i = 0; i < arr.length; i++)
            {
                arr2 = arr[i].split('&');
                for (var j = 0; j < arr2.length; j++)
                {
                    var str = arr2[j];
                    if (str.indexOf('=') == -1) continue;
                    name = str.substr(0, str.indexOf('=')).replace(/^[ ]+/g, '');
                    value = str.substr(str.indexOf('=') + 1);
                    valoresCookies[name] = value;
                }
            }
        }
        return valoresCookies['XDFrameRegister'];
    },
    Refresh: function()
    {
        var hash = this.GetCookieResize();
        //alert(hash);
        if (hash != this.HashAtual)
        {
            if (hash.length < 7) return;
            if (hash.substr(0, 7) == '#resize')
            {
                var parts = hash.substr(1).split('_');
                if (parts.length < 3 || !document.getElementById(parts[1])) return;
                if (document.getElementById(parts[1]).height != parseInt(parts[2]))
                    document.getElementById(parts[1]).height = parseInt(parts[2]);
            }
            this.HashAtual = hash;
        }
    },
    Controller: setInterval('FrameManager.Refresh();', 3000)
}
