/*
© koroCode
*/

var closetimer	= 0;
var openDay = 0;

function kc_tabswap(o) {
	var dt = o.parentNode;
	var dd = dt.nextSibling;
	var div = dt.parentNode.parentNode.childNodes;
	if (!dt || !dd) return false;
	if (dd.nodeType == 3) dd = dd.nextSibling;
	if (dt.nodeType == 3) dt = dt.nextSibling;
	for (var i=0; i<div.length; i++) {
		var g = div[i];
		if (g.tagName == 'DL') {
			var a = g.firstChild;
			if (a.nodeType == 3) a = a.nextSibling;
			a = a.firstChild;
			if (a.tagName == 'A') {
				if (g.nodeType == 3) g = g.nextSibling;
				for (j=0; j<g.childNodes.length; j++) {
					var r = g.childNodes[j];
					if (r.tagName == 'DD') r.className = 'hide';
				}
			}
		}
	}
	dd.className = '';
	return true;
}

function kc_notice(o) {
	
	mcancelclosetime();
	var s = o.parentNode;
	if (s.className == 'today') s = s.parentNode;
	var p = s.nextSibling;
	if (p.nodeType == 3) p = p.nextSibling;
	
	if(openDay) mclose();

	// get new layer and show it
	s.className = (s.className == 'hasnotice') ? s.className+' on' : 'hasnotice';
	//p.className = (p.className == 'notice') ? p.className+' active' : 'notice';
	p.className = p.className+' active';
	p.style.visibility = 'visible';
	openDay = p;
}

function kc_setAction(action,form) {
	var f = document.forms[form];
	f.action = action;
	f.submit();
}

function kc_marit(o) {
	var h5 = o.parentNode;
	var p = h5.nextSibling;
	if (p.nodeType == 3) p = p.nextSibling;
	if (p.tagName == 'H5') {
		p = p.nextSibling;
		if (p.nodeType == 3) p = p.nextSibling;
	}
	p.className = (p.className == '') ? 'blue' : '';
}

function mclose()
{
	if(openDay) openDay.style.visibility = 'hidden';
}

// go close timer
function mclosetime()
{
	closetimer = window.setTimeout(mclose, 500);
}

// cancel close timer
function mcancelclosetime()
{
	if(closetimer)
	{
		window.clearTimeout(closetimer);
		closetimer = null;
	}
}
document.onclick = mclose; 


