// JavaScript Document
 $(document).ready(function () {
        // Username validation logic
        var validatedomainURL = $('#validatedomainURL');      

		
		$('#subdomain_name').keyup(function () {
            // cache the 'this' instance as we need access to it within a setTimeout, where 'this' is set to 'window'
            var t = this; 
            
            // only run the check if the domainName has actually changed - also means we skip meta keys
            if (this.value != this.lastValue) {
                
                // the timeout logic means the ajax doesn't fire with *every* key press, i.e. if the user holds down
                // a particular key, it will only fire when the release the key.
                                
                if (this.timer) clearTimeout(this.timer);
                
                // show our holding text in the validation message space
                validatedomainURL.removeClass('error').html('checking availability...');
                
                // fire an ajax request in 1/5 of a second
                this.timer = setTimeout(function () {

                    $.ajax({
                        url: ru + 'verify_name.php',
                        data: 'action=check_profileURL&URLValue=' + t.value,
                        dataType: 'json',
                        type: 'post',
                        success: function (data) {
							
                            // put the 'msg' field from the $resp array from check_domainName (php code) in to the validation message
                            validatedomainURL.html(data.msg);
                        }
                    });
                }, 200);
                
                // copy the latest value to avoid sending requests when we don't need to
                this.lastValue = this.value;
            }
        });  
		
		/*		var validatemail = $('#validatemail');      
			$('#email').keyup(function () {
            // cache the 'this' instance as we need access to it within a setTimeout, where 'this' is set to 'window'
            var t = this; 
            
            // only run the check if the domainName has actually changed - also means we skip meta keys
            if (this.value != this.lastValue) {
                
                // the timeout logic means the ajax doesn't fire with *every* key press, i.e. if the user holds down
                // a particular key, it will only fire when the release the key.
                                
                if (this.timer) clearTimeout(this.timer);
                
                // show our holding text in the validation message space
                validatemail.removeClass('error').html('checking availability...');
                
                // fire an ajax request in 1/5 of a second
                this.timer = setTimeout(function () {
                    $.ajax({

                        url: ru+ 'verify_name.php',
                        data: 'action=check_email&email=' + t.value,
                        dataType: 'json',
                        type: 'post',
                        success: function (data) {
						
                            // put the 'msg' field from the $resp array from check_domainName (php code) in to the validation message
                            validatemail.html(data.msg);
                        }
                    });
                }, 200);
                
                // copy the latest value to avoid sending requests when we don't need to
                this.lastValue = this.value;
            }
        });   */
        
    });
 
