﻿function checkNumberInput(e) {
	var keynum;

	if (e.keyCode) keynum = e.keyCode;
	else if (e.which) keynum = e.which;

	/*
	* keyDown event keyCode
	* 상단 숫자키 : 48~57
	* Del키 : 46
	* 키패드 숫자키 : 96 ~ 105
	* 백스페이스 : 8
	* 방향키 : 37 ~ 40
	* 대쉬 : 상단대쉬 189, 숫자패드 109
	* 탭키 : 9
	* Ctrl키 : 17
	*/

	//복사 및 잘라내기 허용
	if (e.ctrlKey && e.keyCode != 17 && (e.keyCode == 67 || e.keyCode == 88)) {
		return true;
	}

	if ((keynum >= 48 && keynum <= 57) ||
			(keynum >= 96 && keynum <= 105) ||
			(keynum >= 37 && keynum <= 40) ||
			keynum == 8 ||
			keynum == 46 ||
			keynum == 9) {
		return true;
	}
	else {
		return false;
	}
}

//특수문자 사용하면 false을 반환
//special : '특수'라는 의미
function checkSpecial(obj) {
	if (obj.val().length > 0) {
		var regExp = /^[^~`!@#$%^&*()_+\-=\[\]{};\':\"<>?,.\/]*$/;
		if (!regExp.test(obj.val())) {
			alert("특수문자를 사용하실수 없습니다");
			obj.val("");
			obj.focus();
			return false;
		}
	}
	return true;
}

function showLayerPopup(Url, Width, Height) {
	var marginTop = 0;
	var marginLeft = 0;

	marginTop = -(Height / 2) + "px";
	marginLeft = -(Width / 2) + "px";

	$('#LayerPopup #Popup iframe')
				.attr('src', Url)
				.css({
					"width": Width + "px",
					"height": Height + "px"
				});
	$('#Popup').css({
		"width": Width + "px",
		"height": Height + "px",
		"margin-top": marginTop,
		"margin-left": marginLeft
	});
	$("#blackbackground").css({
		"width": window.document.body.offsetWidth + "px",
		"height": (window.document.body.scrollHeight + 60) + "px"
	});
	$('#LayerPopup').show();
	$("#wrapper").css({ 'z-index': '-1' });
	$("#footer").css({ 'z-index': '-1' });
	$("#wrapFooter").css({ 'z-index': '-1' });
}

function hideLayerPopup() {
	$('#LayerPopup #Popup iframe').attr('src', 'about:blank');
	$('#LayerPopup').hide();
	$("#wrapContent").css({ 'z-index': '500' });
}

function hideLayerPopup2(Url) {
	$('#LayerPopup #Popup iframe').attr('src', 'about:blank');
	$('#LayerPopup').hide();
	$("#wrapContent").css({ 'z-index': '500' });
	location.href = Url;
}
function OpenLayer(filepath, name, pwidth, pheight, leftMargin, topMargin) {
	window.open(filepath, name, 'scrollbars = yes, width =' + pwidth + ', height = ' + pheight + 'location=no, directories=no, resizable=no, status=no, toolbar=no, menubar=no, left=' + leftMargin + ', top=' + topMargin);
}
