$(function()
{
	$(".item-image").css("border", "solid 1px #cccccc");
	
	// ログイン
	$("#frmLogin").submit(function()
	{
		var d = zen_make_params("#frmLogin", "login");
		$.post(
			location.href,
			d,
			function (ret)
			{
				if (ret.status == "SUCCESS")
				{
					location.href= location.href;
				}
				else
				{
					alert(ret.msg);
				}
			},
			"json"
		);
		return false;
	});
	
	// ログアウト
	$("#frmLogout").submit(function()
	{
		var d = zen_make_params("#frmLogout", "logout");
		$.post(
			location.href,
			d,
			function (ret)
			{
				if (ret.status == "SUCCESS")
				{
					location.href = "/";
				}
				else
				{
					alert(ret.msg);
				}
			},
			"json"
		);
		return false;
	});
});


//
// FORM内の全コントロール値をJSON化する
//
function zen_make_params(id, cmd)
{
	var j = {};
	if(cmd){ j['cmd-'+cmd]=1; }
	var str = 'frm input,frm textarea,frm select';
	$(str.replace(/frm/g, id)).each(
		function(i)
		{
			if (this.type.match(/(radio|checkbox)/))
			{
				if (this.checked)
				{
					j[this.name] = this.value;
				}
			}
			else
			{
				j[this.name] = this.value;
			}
		}
	);
	return j;
}

var calconfig = { 
	"clearText" : "クリア",
	"closeText" : "取消",
	"prevText" : "前月",
	"nextText" : "次月",
	"currentText" : "今月",
	"dayNames" : ["水", "月", "土", "木", "火", "日", "金"],
	"monthNames" : [' 1月', ' 2月', ' 3月', ' 4月', ' 5月', ' 6月', ' 7月', ' 8月', ' 9月', '10月', '11月', '12月'],
	"dateFormat" : "YMD/",
	"speed" : "",
	"firstDay" : "1"
};
