﻿var FBUI = function() {
    return {
    GetTotalFBAlbumTopicResponse: function(result, string1, string2) {
            //alert("GetTotalFBAlbumTopicResponse");
        if (typeof(result[0]) == 'undefined')
            { }
            else if (result[0].aid == "-1") {
                var inner = ' <p><fb:login-button></fb:login-button></p>';
                $.Pop.expand('<div class="little_window_bg"/>' + inner, 420, 150, function() { FB.XFBML.Host.parseDomTree(); });
            }
            else if (result.length == 0 || result[0].aid == "-2") {
            $.Pop.expand('<div class="little_window_bg"/><p>' + string1 + '</p>', 420, 150, function() { });
            }


            else {
                $('.pp_content').css("background-color", "#fff");
                $.Pop.expand('<select id="MyTopic" onchange="FBChangeItem()" style="width:200px;"></select>',
                        300, 50, function(result) {

                            var MyList = document.getElementById("MyTopic");
                            var newoption = document.createElement("option");
                            newoption.text = string2;
                            MyList.options.add(newoption, -1);
                            for (var item in result) {
                                var newoption2 = document.createElement("option");
                                newoption2.text = result[item].name;
                                newoption2.id = result[item].aid;
                                MyList.options.add(newoption2, item);
                            }
                        }, result);

            }
        },
        GetTotalFBAlbumTopicforM: function(result, string1, string2) {
            if (result.length == 0) {
                $.Pop.expand('<div class="little_window_bg"/><p>' + string1 + '</p>', 420, 150, function() { });
            }
            else {
                $.Pop.expand('<div class="little_window_bg_small"/><p><select id="MyTopic" style="width:200px;"></select>' +
                        '<br/><img class="buttonAOK_off" id="savePic" src="../image/buttonAOK_off.png"/></p>',
                        420, 150, function(result) {

                            var MyList = document.getElementById("MyTopic");
                            var newoption = document.createElement("option");
                            newoption.text = string2;
                            MyList.options.add(newoption, -1);
                            for (var item in result) {
                                var newoption2 = document.createElement("option");
                                newoption2.text = result[item].name;
                                newoption2.id = result[item].aid;
                                MyList.options.add(newoption2, item);
                            }
                            $("#savePic").one('click', savePicToServer_Click);
                            //../image/buttonAOK_off.png
                            //savePicToServer_Click
                        }, result);

            }
        }
    };
} ();
