    $(document).ready(function () {
	
		$("form").attr({
			 autocomplete: "off",
		});

		var validateName = $('#validateName');
		var validateCompanyName = $('#validateCompanyName');
		var validateEmail = $('#validateEmail');
		var validateTel = $('#validateTel');
		var validateNameB = $('#validateNameB');
		var validateCompanyNameB = $('#validateCompanyNameB');
		var validateEmailB = $('#validateEmailB');
		var validateTelB = $('#validateTelB');
		var validateNameC = $('#validateNameC');
		var validateCompanyNameC = $('#validateCompanyNameC');
		var validateEmailC = $('#validateEmailC');
		var validateTelC = $('#validateTelC');

        $('#atta_name').keyup(function () {
            var t = this; 
            if (this.value != this.lastValue) {
                if (this.timer) clearTimeout(this.timer);
                validateName.removeClass('error').html('<img src="/img/ajax-loader.gif" height="16px" width="16px" alt="loader" />');
                this.timer = setTimeout(function () {
                    $.ajax({
                        url: '/ajax.php',
                        data: 'action=check_name&name=' + t.value,
                        dataType: 'json',
                        type: 'post',
                        success: function (j) {
                            validateName.html(j.msg);
                        }
                    });
                }, 1000);
                this.lastValue = this.value;
            }
        });

        $('#atta_company_name').keyup(function () {
            var t = this; 
            if (this.value != this.lastValue) {
                if (this.timer) clearTimeout(this.timer);
                validateCompanyName.removeClass('error').html('<img src="/img/ajax-loader.gif" height="16px" width="16px" alt="loader" />');
                this.timer = setTimeout(function () {
                    $.ajax({
                        url: '/ajax.php',
                        data: 'action=check_company_name&company_name=' + t.value,
                        dataType: 'json',
                        type: 'post',
                        success: function (j) {
                            validateCompanyName.html(j.msg);
                        }
                    });
                }, 1000);
                this.lastValue = this.value;
            }
        });

        $('#atta_email').keyup(function () {
            var t = this; 
            if (this.value != this.lastValue) {
                if (this.timer) clearTimeout(this.timer);
                validateEmail.removeClass('error').html('<img src="/img/ajax-loader.gif" height="16px" width="16px" alt="loader" />');
                this.timer = setTimeout(function () {
                    $.ajax({
                        url: '/ajax.php',
                        data: 'action=check_email&email=' + t.value,
                        dataType: 'json',
                        type: 'post',
                        success: function (j) {
                            validateEmail.html(j.msg);
                        }
                    });
                }, 1000);
                this.lastValue = this.value;
            }
        });

        $('#atta_tel').keyup(function () {
            var t = this; 
            if (this.value != this.lastValue) {
                if (this.timer) clearTimeout(this.timer);
                validateTel.removeClass('error').html('<img src="/img/ajax-loader.gif" height="16px" width="16px" alt="loader" />');
                this.timer = setTimeout(function () {
                    $.ajax({
                        url: '/ajax.php',
                        data: 'action=check_tel&tel=' + t.value,
                        dataType: 'json',
                        type: 'post',
                        success: function (j) {
                            validateTel.html(j.msg);
                        }
                    });
                }, 1000);
                this.lastValue = this.value;
            }
        });

        $('#attb_name').keyup(function () {
            var t = this; 
            if (this.value != this.lastValue) {
                if (this.timer) clearTimeout(this.timer);
                validateNameB.removeClass('error').html('<img src="/img/ajax-loader.gif" height="16px" width="16px" alt="loader" />');
                this.timer = setTimeout(function () {
                    $.ajax({
                        url: '/ajax.php',
                        data: 'action=check_name&name=' + t.value,
                        dataType: 'json',
                        type: 'post',
                        success: function (j) {
                            validateNameB.html(j.msg);
                        }
                    });
                }, 1000);
                this.lastValue = this.value;
            }
        });

        $('#attb_company_name').keyup(function () {
            var t = this; 
            if (this.value != this.lastValue) {
                if (this.timer) clearTimeout(this.timer);
                validateCompanyNameB.removeClass('error').html('<img src="/img/ajax-loader.gif" height="16px" width="16px" alt="loader" />');
                this.timer = setTimeout(function () {
                    $.ajax({
                        url: '/ajax.php',
                        data: 'action=check_company_name&company_name=' + t.value,
                        dataType: 'json',
                        type: 'post',
                        success: function (j) {
                            validateCompanyNameB.html(j.msg);
                        }
                    });
                }, 1000);
                this.lastValue = this.value;
            }
        });

        $('#attb_email').keyup(function () {
            var t = this; 
            if (this.value != this.lastValue) {
                if (this.timer) clearTimeout(this.timer);
                validateEmailB.removeClass('error').html('<img src="/img/ajax-loader.gif" height="16px" width="16px" alt="loader" />');
                this.timer = setTimeout(function () {
                    $.ajax({
                        url: '/ajax.php',
                        data: 'action=check_email&email=' + t.value,
                        dataType: 'json',
                        type: 'post',
                        success: function (j) {
                            validateEmailB.html(j.msg);
                        }
                    });
                }, 1000);
                this.lastValue = this.value;
            }
        });

        $('#attb_tel').keyup(function () {
            var t = this; 
            if (this.value != this.lastValue) {
                if (this.timer) clearTimeout(this.timer);
                validateTelB.removeClass('error').html('<img src="/img/ajax-loader.gif" height="16px" width="16px" alt="loader" />');
                this.timer = setTimeout(function () {
                    $.ajax({
                        url: '/ajax.php',
                        data: 'action=check_tel&tel=' + t.value,
                        dataType: 'json',
                        type: 'post',
                        success: function (j) {
                            validateTelB.html(j.msg);
                        }
                    });
                }, 1000);
                this.lastValue = this.value;
            }
        });

		$('#attc_name').keyup(function () {
            var t = this; 
            if (this.value != this.lastValue) {
                if (this.timer) clearTimeout(this.timer);
                validateNameC.removeClass('error').html('<img src="/img/ajax-loader.gif" height="16px" width="16px" alt="loader" />');
                this.timer = setTimeout(function () {
                    $.ajax({
                        url: '/ajax.php',
                        data: 'action=check_name&name=' + t.value,
                        dataType: 'json',
                        type: 'post',
                        success: function (j) {
                            validateNameC.html(j.msg);
                        }
                    });
                }, 1000);
                this.lastValue = this.value;
            }
        });

        $('#attc_company_name').keyup(function () {
            var t = this; 
            if (this.value != this.lastValue) {
                if (this.timer) clearTimeout(this.timer);
                validateCompanyNameC.removeClass('error').html('<img src="/img/ajax-loader.gif" height="16px" width="16px" alt="loader" />');
                this.timer = setTimeout(function () {
                    $.ajax({
                        url: '/ajax.php',
                        data: 'action=check_company_name&company_name=' + t.value,
                        dataType: 'json',
                        type: 'post',
                        success: function (j) {
                            validateCompanyNameC.html(j.msg);
                        }
                    });
                }, 1000);
                this.lastValue = this.value;
            }
        });

        $('#attc_email').keyup(function () {
            var t = this; 
            if (this.value != this.lastValue) {
                if (this.timer) clearTimeout(this.timer);
                validateEmailC.removeClass('error').html('<img src="/img/ajax-loader.gif" height="16px" width="16px" alt="loader" />');
                this.timer = setTimeout(function () {
                    $.ajax({
                        url: '/ajax.php',
                        data: 'action=check_email&email=' + t.value,
                        dataType: 'json',
                        type: 'post',
                        success: function (j) {
                            validateEmailC.html(j.msg);
                        }
                    });
                }, 1000);
                this.lastValue = this.value;
            }
        });

        $('#attc_tel').keyup(function () {
            var t = this; 
            if (this.value != this.lastValue) {
                if (this.timer) clearTimeout(this.timer);
                validateTelC.removeClass('error').html('<img src="/img/ajax-loader.gif" height="16px" width="16px" alt="loader" />');
                this.timer = setTimeout(function () {
                    $.ajax({
                        url: '/ajax.php',
                        data: 'action=check_tel&tel=' + t.value,
                        dataType: 'json',
                        type: 'post',
                        success: function (j) {
                            validateTelC.html(j.msg);
                        }
                    });
                }, 1000);
                this.lastValue = this.value;
            }
        });

    });
