function hl(ele) {
	ele.style.backgroundColor = '#E7EDF3';
}
function dhl(ele) {
	ele.style.backgroundColor = '#FFFFFF';
}
function del(ctrl, id, del_item, redir_to) {
	if (cfm_del(del_item, false)) {
		window.location.href = '/ctrl/' + ctrl + '/delete/id:' + id + (redir_to ? '?redir_to=' + redir_to : '');
	}
	else {
		return false;
	}
}
function cfm_del(del_item, ask_twice) {
	return cfm_action(del_item, ask_twice, '削除');
}
function cfm_action(del_item, ask_twice, action) {
	if (!del_item) del_item = '';
	if (!ask_twice) ask_twice = false;
	if (!action) action = '削除';
	var msg = (del_item != '' ? ' ' + del_item + ' を' : '') + action + 'してもよろしいですか？' + "\n" + 'このアクションは取り消しができません。';
	var msg_2 = 'これが最後の確認です。本当に' + action + 'してしまってよろしいですか？';
	if (ask_twice) {
		if (confirm(msg)) {
			return confirm(msg_2);
		}
		else {
			return false;
		}
	}
	else {
		return confirm(msg);
	}
}
function magnify(ele) {
	ele.style.width = '600px';
	ele.style.height = '400px';
}

function sync_datetime(from_d, to_d) {
	if ($(from_d + '__year')) $(to_d + '__year').value = $(from_d + '__year').value;
	if ($(from_d + '__month')) $(to_d + '__month').value = $(from_d + '__month').value;
	if ($(from_d + '__day')) $(to_d + '__day').value = $(from_d + '__day').value;
	if ($(from_d + '__hour')) $(to_d + '__hour').value = $(from_d + '__hour').value;
	if ($(from_d + '__minute')) $(to_d + '__minute').value = $(from_d + '__minute').value;
	if ($(from_d + '__second')) $(to_d + '__second').value = $(from_d + '__second').value;
}

function sub_win(url, w, h, bln, bln_scr) {
	var sub_win = window.open(url,'','width=' + w + ',height=' + h + ',scrollbars=' + bln_scr + ',top=100,left=100,resizable=' + bln + ',menubar=' + bln + ',toolbar=' + bln + ',status=' + bln + ',location=' + bln);
}