Destinations.typepad = function() {
    Destinations.register("typepad");
    
    var dimensions = {
        'content': [425, 262],
        'sidebar': [300,250]
    };
    
    return {
        id: 'typepad',
        displayName: 'Typepad Widget',
        
        select: function() {
            $('#typepad-location').change();
            $('#typepad-title').val(Wall.getProp('title'));
        },
        
        init: function() {
            $("#typepadForm").submit(function(){
                Builder.trackState(true);
                $("#typepadText").text(Wall.getEmbedCode());
            });

            $('#typepad-location').change(function(event){
                var location = $(this).val();
                $("#tab-where-typepad .layout-option").hide();
                $("#tab-where-typepad .tip-" + location).show();
                $(".layout").hide();
                $("#blog-" + location).show();
                if (location == 'content') {
                    $("#typepadForm .get-code").show();
                }
                else {
                    $("#typepadForm .install-widget").show();
                }
                
                Wall.setProp('width', dimensions[location][0]);
                Wall.setProp('height', dimensions[location][1]);
            });
        }
    };
}();
