Dropzone.autoDiscover = false;
$(document).ready(function(){
var DropZone = new Dropzone('#DropZone',{				
				maxFiles: 10,
				paramName: "Files", // The name that will be used to transfer the file
				maxFilesize: 2, // MB
				dictDefaultMessage: '<input type="button" value="SELECT FILES" class="fileInputBtn"/><p style="width:100%; padding:0; text-align:center;">Or Drag And Drop Files Here</p>',
				uploadMultiple: true,
				previewsContainer: ".dropzone-previews",
				createImageThumbnails: false,
				addRemoveLinks: false,
				autoProcessQueue: false,
				autoQueue: true,
				url: "includes/ajax/processing-scripts/process-form.php",
				acceptedFiles: "image/*,.pdf",
				init: function() {
					this.on("addedfile", function(file) { 
						//do nothing
					});
					this.on("sending", function(file, xhr, formData){
						var now = new Date();
						if (document.getElementById('Admin_Form')) {
							var fields = document.getElementById('Admin_Form').elements;
							var field_name = '';
							var field_value = '';
							var field_type = '';
							var field_choice = '';
							for (var i = 0; i < fields.length; i++) {
								field_name = fields[i].name;
								field_type = fields[i].type;		
								switch (field_type) {
									case 'text':					
										field_value = document.getElementById(field_name).value;
										formData.append(field_name, field_value);
									break;
									case 'textarea':
										field_value = document.getElementById(field_name).value;
										formData.append(field_name, field_value);
					
									break;
									case 'select-one':
										field_choice = document.getElementById(field_name).selectedIndex;
										field_value = document.getElementById(field_name).options[field_choice].value;
										formData.append(field_name, field_value);
									break;
									case 'checkbox':
										if (document.getElementById(field_name).checked == true) {
											field_value = document.getElementById(field_name).value;
										} else {
											field_value = '';
										}
										formData.append(field_name, field_value);
									break;
									case 'radio':
										var rdoBtns = document.getElementById('Admin_Form').elements[field_name];
										for (var k = 0; k < rdoBtns.length; k++) {
											if (rdoBtns[k].checked) {
												field_value = rdoBtns[k].value;
												break;
											}
										}
										formData.append(field_name, field_value);
									break;
									case 'hidden':
										field_value = document.getElementById(field_name).value;
										formData.append(field_name, field_value);
									break;
									case 'password':
										field_value = document.getElementById(field_name).value;
										formData.append(field_name, field_value);
									break;
								}
							}
						}
						formData.append('Now', now);
					});
				},
				success: function (file, response) {										
					if (document.getElementById('Animation')) {
						document.getElementById('Animation').style.display = 'none';
						if (document.getElementById('Submit_Paragraph')) {
							document.getElementById('Submit_Paragraph').style.display = 'block';
						}
					}
					if (document.getElementById('Result')) {
						let option = document.getElementById('Option').value;
						let clear = document.getElementById('Clear').value;
						const result = JSON.parse(response);
						this.removeAllFiles();						
						formEnder(result,option,clear);
					}
				}
		});					
	});