function  sendArhForm()
{
// 	alert($('arhSubmit').disabled);
	if ($('arhSubmit').disabled == false)
	{
		$('arhForm').action = $('arhForm').action + '/month/' + $('month').value + '/year/' + $('year').value;
		$('arhForm').submit();
// 		alert($('arhForm').action);
	}
	else
	{
		alert('Выберите правильную дату!');
	}
}
function reloadMonth()
{
	year = $('year').value;
	$('month').options.length = 0;
	count = eval('date_arr_' + year + '.length');
	for (var i=0; i<count; i++)
	{
// 		new Option("text", "value", isDefaultSelected, isSelected);
		$('month').options.length++;
		$('month').options[i].value = eval('date_arr_' + year + '[' + i + ']');
		$('month').options[i].text = eval('text_arr_' + year + '[' + i + ']');
		$('month').options[i].disabled =  eval('hide_arr_' + year + '[' + i + ']');
		if (sel_mon == i)
		{
			a = i - 1;
			$('month').options[a].selected = true;
		}
	}
	setSubmtBttn();
}

function setSubmtBttn()
{
	selInd = $('month').selectedIndex;
	if ($('month').options[selInd].disabled == true)
	{// заблокировать
		$('arhSubmit').disabled = true;
	}
	else
	{// разблокировать
		$('arhSubmit').disabled = false;
	}
}

function showPage(id, where)
{
	if (where == 'Next')
	{
		var prev_id = id - 1;
		// 	alert(next_id);
		$('page_' + id).style.display = 'block';
		$('link_' + id).style.display = 'none';
		$('page_' + prev_id).style.display = 'none';
		$('l_' + prev_id).style.fontWeight = 'normal';
		$('l_' + prev_id).style.color = '#777777';
		$('l_' + prev_id).style.textDecoration = 'underline';
		$('l_' + prev_id).style.fontSize = '11px';
		
		$('l_' + id).style.fontWeight = 'bold';
		$('l_' + id).style.color = '#8f0502';
		$('l_' + id).style.textDecoration = 'none';
		$('l_' + id).style.fontSize = '13px';
		$('l_' + id).style.marginBottom = '10px';
		
		
	}
	else
	{
		var now_page = id - 1;
		var perv_page = id - 2;
		$('page_' + perv_page).style.display = 'block';
		$('link_' + now_page).style.display = 'block';
		$('page_' + now_page).style.display = 'none';
		
		$('l_' + now_page).style.fontWeight = 'normal';
		$('l_' + now_page).style.color = '#777777';
		$('l_' + now_page).style.textDecoration = 'underline';
		$('l_' + now_page).style.fontSize = '11px';
		
		$('l_' + perv_page).style.fontWeight = 'bold';
		$('l_' + perv_page).style.color = '#8f0502';
		$('l_' + perv_page).style.textDecoration = 'none';
		$('l_' + perv_page).style.fontSize = '13px';
		$('l_' + perv_page).style.marginBottom = '10px';
		
	}
	window.location.href="#top";
}

function showSomePage(id)
{
// 	alert('Now ' + curr_page + '; Load ' + id);
	
	$('page_' + curr_page).style.display = 'none';
	$('page_' + id).style.display = 'block';
	$('l_' + curr_page).style.fontWeight = 'normal';
	$('l_' + curr_page).style.color = '#777777';
	$('l_' + curr_page).style.textDecoration = 'underline';
	$('l_' + curr_page).style.fontSize = '11px';
	
	$('l_' + id).style.fontWeight = 'bold';
	$('l_' + id).style.color = '#8f0502';
	$('l_' + id).style.textDecoration = 'none';
	$('l_' + id).style.fontSize = '13px';
	$('l_' + id).style.marginBottom = '10px';
	
	curr_page = id;
	window.location.href="#top";
// 	alert(curr_page);
}

function loadMiniPage(id)
{
// 	alert($('mini_link_' + id).href);
// 	$('mini_page').innerHTML = 'Загружаются данные...';
	var myAjax = new Ajax.Updater('mini_page', $('mini_link_' + id).href, {method: 'post', parameters: ''});
// 	alert('sadasd');
}

function setPrio(id, unhide, cid)
{
// 	alert(id + ' ' + $('part_' + id).checked);
	if ($('part_' + id).checked == true && unhide == 1)
	{
		$('prio_' + cid).disabled = false;
// 		$('prio_' + cid).checked = true;
	}
	else
	{
// 		$('prio_' + cid).disabled = true;
// 		$('prio_' + cid).checked = false;
		var s = false;
		for (var i = 0; i < cat[cid].length; i++)
		{
			if ($('part_' + cat[cid][i]).checked == true)
			{
				s = true;
			}
		}
		if (s == false)
		{
			$('prio_' + cid).disabled = true;
			$('prio_' + cid).checked = false;
		}
	}
}


