
    $(document).ready(function () {
        // Username validation logic
         $("#domain").click(function(){

               if( $("#domain").val() == 'enter a domain name')
                     $("#domain").val('');
            });
 
        var validateDomain = $('#validate_domain');
            $("#check").click(function(){
 
            // cache the 'this' instance as we need access to it within a setTimeout, where 'this' is set to 'window'
            var t = $("#domain");
          
             
                // show our holding text in the validation message space
           
                //validateDomain.removeClass('error').html('<img src="/wp-content/plugins/ajaxwhois/img/ajax-loader.gif" height="16" width="16" /> checking availability...');
                validateDomain.html('');
                validateDomain.addClass('loading');
                // fire an ajax request in 1/5 of a second
                
                    $.ajax({
                        url: '/wp-content/plugins/ajaxwhois/check.php',
                        data: 'action=check&domain=' + t.val(),
                        dataType: 'json',
                        type: 'post',
                        success: function (j) { 
                            validateDomain.removeClass('loading');
                            // put the 'msg' field from the $resp array from check_username (php code) in to the validation message
                            validateDomain.html(j.msg);
                        }
                    });
               
            return false;
            
        });

       
    });
