Destinations.blogger = function() {
    Destinations.register("blogger");
    
    var dimensions = {
        'header': [460, 200],
        'content': [425, 262],
        'footer': [660, 200],
        'sidebar': [210, 160]
    };
    
    return {
        id: 'blogger',
        displayName: 'Blogger Widget',
        select: function() {
            $('#blogger-title').val(Wall.getProp('title'));
            $('#blogger-location').change();
        },
        
        init: function() {
            $("#bloggerForm").submit(function(){
                Builder.trackState(true);
                $("#bloggerText").text(Wall.getEmbedCode());
            });

            $('#blogger-location').change(function(event){
                var location = $(this).val();
                $("#tab-where-blogger .layout-option").hide();
                $("#tab-where-blogger .tip-" + location).show();
                $(".layout").hide();
                $("#blog-" + location).show();
                if (location == 'content') {
                    $("#bloggerForm .get-code").show();
                }
                else {
                    $("#bloggerForm .install-widget").show();
                }

                Wall.setProp('width', dimensions[location][0]);
                Wall.setProp('height', dimensions[location][1]);
            });
        }
    };
}();
