$(document).ready(function() {

            var button = $('#uploadButton'), interval;
			

            $.ajax_upload(button, {
                        action : '/auth/upload.php',
                        name : 'myfile',
                        onSubmit : function(file, ext) {
                            // показываем картинку загрузки файла
                            $("img#load").attr("src", "load.gif");
                            $("#uploadButton font").text('Загрузка');

                            /*
                             * Выключаем кнопку на время загрузки файла
                             */
                            this.disable();

                        },
                        onComplete : function(file, response) {
                            // убираем картинку загрузки файла
                            $("img#load").attr("src", "loadstop.gif");
                            $("#uploadButton font").text('Загрузить');

                            // снова включаем кнопку
                            this.enable();

                            // показываем что файл загружен
							istr = response;
							var reg=/[а-яА-Я]/;
							var result=reg.test(istr) ? "1" : "0";
							if (result == '0'){
							$('#pol_im').val(response);
							$("#files").empty();
                            $("<a href = '"+ response + "' target = '_blank'>" + response + "</a>").appendTo("#files");
							}
							else{
							 alert ('Загрузка не удалась. Имя файла не должно включать русские буквы.');
							}
                        }
                    });
					
					
					var button = $('#uploadButton1'), interval;
					
					 $.ajax_upload(button, {
                        action : '/auth/upload.php',
                        name : 'myfile',
                        onSubmit : function(file, ext) {
                            // показываем картинку загрузки файла
                            $("img#load").attr("src", "load.gif");
                            $("#uploadButton1 font").text('Загрузка');

                            /*
                             * Выключаем кнопку на время загрузки файла
                             */
                            this.disable();

                        },
                        onComplete : function(file, response) {
                            // убираем картинку загрузки файла
                            $("img#load").attr("src", "loadstop.gif");
                            $("#uploadButton1 font").text('Загрузить');

                            // снова включаем кнопку
                            this.enable();

                            // показываем что файл загружен
							
							istr = response;
							var reg=/[а-яА-Я]/;
							var result=reg.test(istr) ? "1" : "0";
							if (result == '0'){
							$('#pol_im1').val(response);
							$("#files1").empty();
                            $("<a href = '"+ response + "' target = '_blank'>" + response + "</a>").appendTo("#files1");
							}
							else{
							 alert ('Загрузка не удалась. Имя файла не должно включать русские буквы.');
							}

                        }
                    });
        });
