// Get the modal
var modal = document.getElementById("myModal");

// Get the image and insert it inside the modal - use its "alt" text as a caption
var img = document.getElementById("previewImg");
var selectType = document.getElementById("cudContentsType");
var modalImg = document.getElementById("img01");
var captionText = document.getElementById("caption");
img.onclick = function(){
	var type = selectType.options[selectType.selectedIndex].value;
	if("TEXT" != type){
	  $('.lnb_menu_btn_area').hide();
	  modal.style.display = "block";
	  modalImg.src = this.src;
	  captionText.innerHTML = this.alt;
	} else {
		swal("해당 이미지는 저장되지 않습니다.",{
			icon:"warning",
			buttons:"확인"
		});
	}
}

// Get the <span> element that closes the modal
var span = document.getElementsByClassName("closeImgModal")[0];

// When the user clicks on <span> (x), close the modal
span.onclick = function() {
  modal.style.display = "none";
  $('.lnb_menu_btn_area').show();
}