$(document).ready( 
    function() {

        $('#signup .fancy_button a').click(
            function() {
                $('#form-email-subscribe').submit();
            });

        $('#signup-small').click(
            function() {
                window.location = 'signup-small.html';
            });

        $('#signup-medium').click(
            function() {
                window.location = 'signup-medium.html';
            });

        $('#signup-large').click(
            function() {
                window.location = 'signup-large.html';
            });

        $('#domain-availability-form').submit(
            function() {
                if ($('#new-domain').val() == 'test.com')
                {
                    $('#new-domain-results').html("\
<div class='domain-unavailable'>\
  <input disabled='true' id='test.org' name='test.org' type='checkbox' value='0' />\
  <label for='test.org'>test.org</label>\
</div>\
<div class='domain-unavailable'>\
  <input disabled='true' id='test.net' name='test.net' type='checkbox' value='0' />\
  <label for='test.net'>test.net</label>\
</div>\
<div class='domain-available'>\
  <input checked='checked' id='test.com' name='test.com' type='checkbox' value='1' />\
  <label for='test.com'>test.com</label>\
</div>\
").fadeIn();
                } else {
                    $.get('http://beta.html-hosting.com/domains/availability.json',
                          { domain: 
                            $('#new-domain').val().replace(/\..*$/, '') },
                          function(result) {
                              $('#new-domain-results').html(result).show();
                          });
                }

                // TODO: If any are available:
                //  [ ] Show the google checkout button
                //  [ ] Set focus to it
                $('#checkout').fadeIn();

                return false;
            });
    });

