
function clearForm() {
	if (document.getElementById('Admin_Form')) {
		var fields = document.getElementById('Admin_Form').elements;
		var field_name = '';
		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':
						document.getElementById(field_name).value = '';
				break;
				case 'textarea':	
					if(editor != ''){
						editor.html.set('');
					}
					if(document.getElementById(field_name)){									
						$('#' + field_name).val('');
					}
				break;
				case 'select-one':
					$('#' + field_name).prop('selectedIndex', 0);
					break;
				case 'checkbox':
					if (document.getElementById(field_name).checked == true) {
						$('#' + field_name).prop('checked', false);
					}
					break;
				case 'hidden':
					if (field_name != 'Id') {
						if(!$('#DropZone')){
							document.getElementById(field_name).value = '';
						}else{
							if(field_name != 'Option' && field_name != 'Clear'){
								document.getElementById(field_name).value = '';
							}
						}
					}
					break;
				case 'radio':
					var rdoBtns = document.getElementById('Admin_Form').elements[field_name];
					for (var k = 0; k < rdoBtns.length; k++) {
						rdoBtns[k].checked = false;
					}
					break;
				case 'password':
					document.getElementById(field_name).value = '';
					break;
				case 'file':
					if(!($('#DropZone').length > 0)){
						document.getElementById(field_name).value = '';
						var fieldLabel = document.getElementsByClassName('fileInputLabel');
						if (field_name == 'Image') {
							fieldLabel[0].innerHTML = 'Listing Photo';
						} else if (field_name == 'PDF') {
							fieldLabel[0].innerHTML = 'PDF Document';
						} else if (field_name == 'Doc') {
							fieldLabel[0].innerHTML = '.csv Document';
						}
						fieldLabel[0].style.backgroundColor = '#c42503';
					}
					break;
			}
		}
	}
}