	jQuery(function($){
		//화면사이즈에 따라 컨트롤 resize
		$(window).on('load resize',function(){		
           wh=$(window).height();
			
            var max=(wh-115);
            $('body').height(max);
            $('#page').height(max);
			$('#maincontent').height(max);
			$('.tabDepth1>.tab-content').height(max-40);
			$('.patientList').height(max-245);
			var basic=$('.tabDepth1>.tab-content').height();
			$('.fat-ov-container.patient-info-1').height((basic/2)-100);
			$('.fat-ov-container.patient-info-2').height((basic/2)-60);	
			if($('#sidebar a.active').length>0){
				if($('#sidebar a.active')[0].id=='menuOutpatient'){
					$('.fat-ov-container.fat-ov-container-1').height(basic-355);
				}else{
					$('.fat-ov-container.fat-ov-container-1').height(basic-300);
				};
			};
			$('.fat-ov-container.fat-ov-container-2').height(basic-60);
			$('.fat-ov-container.fat-ov-container-3').height(basic-155);
			$('#consentImgBox').height(max);
        });
		//버튼그룹, 현재  환자별/ 주치의별에 사용중
		$(".btn-group button").click(function(){
			$(".btn-group button").removeClass('active')
			$(this).addClass('active')
		});
		
		//동의서검색 체크박스 제어
		$('.consentSearchBox input[type=checkbox]').on('change', function(e){
			if(e.currentTarget.value=='ALL'&&e.currentTarget.checked==true){
				$('.consentSearchBox input[type=checkbox][value="ALL"]').prop("checked", true);
				$('.consentSearchBox input[type=checkbox][value!="ALL"]:checked').prop("checked", false);
			}else if(e.currentTarget.value!='ALL'&&e.currentTarget.checked==true){
				if($('.consentSearchBox input[type=checkbox][value!="ALL"]:checked').length==$('.consentSearchBox input[type=checkbox]').length-1){
					$('.consentSearchBox input[type=checkbox][value="ALL"]').prop("checked", true);
					$('.consentSearchBox input[type=checkbox][value!="ALL"]:checked').prop("checked", false);
				}else if($('.consentSearchBox input[type=checkbox][value="ALL"]').prop("checked")){
					$('.consentSearchBox input[type=checkbox][value="ALL"]').prop("checked", false);
				}
			}else if(e.currentTarget.value!='ALL'&&e.currentTarget.checked==false){
				$('.consentSearchBox input[type=checkbox][value="ALL"]').prop("checked", false);
			}
		});
		//동의서삭제 사유 선택란 textarea readonly제어
		$('#mplusConsentDeleteForm input[name=consentDeleteRadio]').on('change', function(e){
			if(e.currentTarget.value=="slt4"){
				$('#consentDeleteTextarea').removeAttr("readonly");
			}else{
				$('#consentDeleteTextarea').attr("readonly", "true");
			}
		});
		//동의서 삭제사유 선택 모달 닫힐때 초기화
		$('#mplusConsentDeleteForm').on('hidden.bs.modal', function () {
			$('#mplusConsentDeleteForm input[name=consentDeleteRadio][value="slt1"]').click();
			$('#consentDeleteTextarea').val("");
		});
		// 동의서이미지 조회 모달 열릴떄 스크롤 제일 위로 이동
		$('#mplusConsentImageForm').on('shown.bs.modal', function (e) {
			$('#consentImgBox').scrollTop(0);
		})
    });
