function list_onover(id)
{
	$('#'+id+' > td').css('background-color', '#f1f1f1');
}

function list_onout(id)
{
	$('#'+id+' > td').css('background-color', '#ffffff');
}

	function edit_user_event(id, ndate, periodic, frequency, type, periodic_ndate)
	{
		control_div = document.getElementById('user_event_controls_'+id);
		edit_div = document.getElementById('user_event_edit_'+id);
		out_div = document.getElementById('user_event_output_'+id);
		name_div = document.getElementById('user_event_name_'+id);
		text_div = document.getElementById('user_event_text_'+id);

		if(out_div) out_div.style.display='none';
		if(control_div) control_div.style.display='none';

		if(name_div)
			_name = name_div.innerHTML;

		if(text_div)
			_text = text_div.innerHTML;

		str = "<form action='' method=post><input type='hidden' name='edit_user_event_id' value='"+id+"'><table cellspacing='3'><tr><td>Дата:</td><td colspan='2'><input type='text' name='event_ndate' id='id_event_ndate' value='"+ndate+"' size='10'> <img src='img/calendar2.gif' onclick='displayCalendar(document.getElementById(\"id_event_ndate\"),\"dd.mm.yyyy\",this)' style='border:0px;cursor:pointer;vertical-align:bottom;'></td></tr><tr><td>Название:</td><td colspan='2'><input type='text' name='event_name' value='"+_name+"' size='60'></td></tr><tr><td valign='top'>Описание:</td><td colspan='2'><textarea name='event_text' cols=60 rows=7>"+_text+"</textarea></td></tr><tr><td> </td><td><input type=checkbox name='event_periodic' "+(periodic ? "checked" : "")+"> Повторять каждых: <input type=text name=event_periodic_frequency value='"+frequency+"' size=4> <select name=event_periodic_type><option value=0 "+(type==0 ? "selected" : "")+">День<option value=1 "+(type==1 ? "selected" : "")+">Неделя<option value=2 "+(type==2 ? "selected" : "")+">Месяц</option></select><br>Дата начала: <input type='text' name='event_periodic_ndate' id='id_event_periodic_ndate' value='"+periodic_ndate+"' size='10'> <img src='img/calendar2.gif' onclick='displayCalendar(document.getElementById(\"id_event_periodic_ndate\"),\"dd.mm.yyyy\",this)' style='border:0px;cursor:pointer;vertical-align:bottom;'></td></tr><tr><td> </td><td><input type='submit' class='btn' value='Сохранить'</td><td align='right'><input type='button' class='btn' value='Отменить' onClick='close_edit_user_event("+id+")'></td></tr></table></form>";

		//str = "<table cellpadding='0' cellspacing='0' class='left_table_block'><tr><td class='left_table_content'>"+str+"</td><td class='left_table_right'>&nbsp;</td></tr><tr><td align='right' colspan=2 valign='top'><img src='img/teni2r.gif'></td></tr></table>";

		edit_div.innerHTML = str;
	}

	function close_edit_user_event(id)
	{
		control_div = document.getElementById('user_event_controls_'+id);
		edit_div = document.getElementById('user_event_edit_'+id);
		out_div = document.getElementById('user_event_output_'+id);
		name_div = document.getElementById('user_event_name_'+id);
		text_div = document.getElementById('user_event_text_'+id);

		if(control_div) control_div.style.display="block";
		if(out_div) out_div.style.display="block";
		if(edit_div) edit_div.innerHTML="";
	}

	function checkCalendarEvent()
	{
		_n = document.getElementById('id_event_name');
		if(_n && _n.value=='') {alert('Укажите название события'); return false;}
		_periodic = document.getElementById('id_event_periodic');
		_periodic_ndate = document.getElementById('id_event_periodic_ndate');
		if(_periodic.checked && _periodic_ndate.value=='')
			{alert('Укажите дату начала для повторов.'); return false;}
		return true;
	}