﻿var v;
var f;

$(function () {
	f = $("#aspnetForm");
	// Mask
	$(".DatePicker").mask("9999-99-99");
	$(".Date").mask("9999-99-99");

	// Css
	//=================================================================================================================================
	// Class 별 Attribute 추가
	//=================================================================================================================================
	$(".readonly").attr("readonly", "true");

	// jQuery.DatePicker Class
	//=================================================================================================================================
	// 유효성 검사 추가
	//=================================================================================================================================
	$(".DatePicker").datepicker({
		defaultDate: new Date(),
		showOn: "both", // focus, button, both
		showAnim: "blind", // blind, clip, drop, explode, fold, puff, slide, scale, size, pulsate, bounce, highlight, shake, transfer
		showOptions: { direction: 'horizontal' },
		duration: 200
	});
});

// jQuery.Table List Width
//=================================================================================================================================
// 유효성 검사 추가
//=================================================================================================================================
function GetTableWidth()
{
	var tableWidth = 0;
	$("td", "#TableList").each(function(i)
	{
		tableWidth += parseInt($(this).width());
	});
	return tableWidth;
}

// jQuery.Validator Add
//=================================================================================================================================
// 유효성 검사 추가
//=================================================================================================================================
$.validator.addMethod("alphanumeric", function (value, element) {
	return this.optional(element) || /^\w[\w\s]*$/.test(value);
}, "알파벳 또는 숫자만 입력 가능합니다.");

$.validator.addMethod("numeric", function (value, element) {
	return this.optional(element) || /^\w[\w\s]*$/.test(value);
}, "숫자만 입력 가능합니다.");

$.validator.addMethod("selected", function (value, element, param) {
	return value != "0";
}, $.format("{0} 선택하세요."));

// Input의 테두리를 초기화 한다
function ClearInputField(el) {
	$("#" + el).css(
	{
		borderStyle: "solid",
		borderWidth: "1px",
		borderColor: "#7f9db9",
		padding: "1px"
	});
}

// datepicker
//=================================================================================================================================
// datepicker 기본값 설정
//=================================================================================================================================

$.datepicker.setDefaults({
	monthNames: ['년 1월', '년 2월', '년 3월', '년 4월', '년 5월', '년 6월', '년 7월', '년 8월', '년 9월', '년 10월', '년 11월', '년 12월'],
	dayNamesMin: ['일', '월', '화', '수', '목', '금', '토'],
	showMonthAfterYear: true,
	dateFormat: 'yy-mm-dd',
	buttonImageOnly: true,
	buttonText: "달력",
	buttonImage: "../img/Common/Button/Calendar_scheduleHS.png"
});


// Post Json
//=================================================================================================================================
// getJSON의 Post 형태로 사용 가능하게 지원하는 함수
//=================================================================================================================================
$.postJSON = function (url, data, func)
{
	$.post(url + (url.indexOf("?") == -1 ? "?" : "&") + "callback=?", data, func, "json");
}







