$(document).ready(function() {
  var selected  = 'view';
  var inputs    = $('div.html-embed-content input');
  
  $('ul.html-embed-size li a').click(function(event) {
    
    var el = $(this);
    
    event.preventDefault();
    
    inputs.each(function() {
      var value = $(this).val().replace(selected, el.attr('id'));
      
      $(this).val(value);
    });
    
    selected = el.attr('id');
  });
  
  $('a#show-html-embed-content').click(function(event)
  {
    event.preventDefault();
    
    var content = $(this).find('span').html();
    
    if(content == '+')
    {
      $(this).find('span').html('-');
    }
    else
    {
      $(this).find('span').html('+');
    }
    
    $('div.html-embed-content').toggle();
    
    var height = $('html').height();
    
    $('html').animate({scrollTop: height + 'px'}, 400);
  });
});