var groupFx = null;
window.addEvent('domready', function() {
	groupFx = new Fx.Tween('gblock');
	dateFx = new Fx.Tween('gdateblock');
	meetFx = new Fx.Tween('gmblock');
	groupFx.addEvents({
		complete: function() {
			this.cancel();
			if (this.Mystep==0)
			{
				this.Mystep=1;
				this.start('opacity', '1');
				if (this.group_val.id==0)
				{
					$('g_about').set('html', '');
					$('g_logo').src='/_images/t.gif';
				}
				else
				{
					$('g_about').set('html', this.group_val.text+'<br/>');
					al = new Element('a');
					al.set('text','Группа на форуме');
					al.href=this.group_val.link;
					al.target='_blank';
					al.inject('g_about');
					$('g_logo').src=this.group_val.logo;
				}
			}
		}
	});
	if (parseInt($('g_select').value)>0)
	{
		GChange($('g_select').value, first_date);
		if (parseInt(m_date)>0) GetMeets($('g_select').value, m_date)
	}
});
function GChange(group_id, f_date)
{
	if (!f_date) f_date=0;
	new_val=groups[group_id];
	groupFx.Mystep=0;
	groupFx.group_val=new_val;
	groupFx.start('opacity', '0');
	GetCalendar(new_val.id, f_date);

}
function GetCalendar(id, f_date)
{
	new Request.HTML({

		url: '/portal_new/_connectors/meeting_calndar.php?group_id='+id+'&first_date='+f_date,

		onRequest: function(){
			dateFx.start('opacity', '0');
			$('gmblock_spin').removeClass('spinner');
			meetFx.start('opacity', '0');
		},

		onComplete: function(response){
			dateFx.cancel();
			$('gdateblock').empty().adopt(response);
			dateFx.start('opacity', '1');

		}
	}).send();
}
function GetMeets(id, f_date)
{
	new Request.HTML({

		url: '/portal_new/_connectors/meetings.php?group_id='+id+'&date='+f_date+add_param,

		onRequest: function(){
			$('gmblock_spin').addClass('spinner');
			meetFx.start('opacity', '0');
		},

		onComplete: function(response){
			meetFx.cancel();
			$('gmblock').empty().adopt(response);
			meetFx.start('opacity', '1');
		}
	}).send();
	return false;
}

