
	window.onload=Startup;

	var barmax;
	var comment;

	function Startup()
	{
		barmax=GO('menu-bar');

		if(barmax)
		{
			barmax=barmax.value;
			Bar(0);
		}

		comment=GO('comment-active');

		if(comment)
		{
			comment=comment.value;
			setTimeout('Comments()', 3000);
		}
	}



	function Bar(val)
	{
		CCS('menu-bar-bcg', 'width', (++val - 1) + 'px');

		var perc=Math.ceil(val / 2);
		perc=perc - Math.ceil(perc / 20);
		perc+='%';

		GO('menu-bar-perc').innerHTML=perc;
		GO('menu-bar-perc-2').innerHTML=perc;

		if(val <= barmax)
		{
			setTimeout('Bar(' + val + ')', 10);
		}
	}


	var comment_force=false;
	var comment_mode=2;

	function Comments(open, force)
	{
		if(force)
		{
			if(comment_mode == 1) return;
			if(force == comment) return;

			GO('comment-i-' + comment).className='white-comments-0' + comment;
			BHV('comment-' + comment);

			comment_force=force;
		}

		if(open && comment_force)
		{
			comment=comment_force;
		}
		else if(comment_force)
		{
			return;
		}

		BHV('comment-' + comment);

		if(open)
		{
			comment_mode=2;

			GO('comment-i-' + comment).className='white-comments-0' + comment + 'a';

			if(!comment_force)
			{
				setTimeout('Comments()', 12000);
			}
		}
		else
		{
			comment_mode=1;

			GO('comment-i-' + comment).className='white-comments-0' + comment;

			comment++;
			if(comment > 4) comment=1;
		}
	}










	var BH=Array();
	BH['maxa']=Array(0, 112);
	BH['runs']=0;

	function BHV(elem, max, speed)
	{
		idm=elem;

		if(!BH[idm]) BH[idm]=Array();

		if(BH[idm]['run']) return;

		BH['runs']++;

		BH[idm]['max']=BH[idm]['height']=false;

		BH[idm]['run']=true;
		BH[idm]['elem']=GO(elem);
		//BH[idm]['back']=(BH[idm]['elem'].style.display == 'none') ? false : true;
		BH[idm]['back']=BH[idm]['elem'].offsetHeight ? true : false;
		BH[idm]['elem'].blur();
		BH[idm]['speed']=speed ? speed : 35;

		if(max && BH['maxa'])
		{
			BH[idm]['max']=BH['maxa'][max];

			BH[idm]['height']=BH[idm]['back'] ? (BH[idm]['elem'].offsetHeight ? BH[idm]['elem'].offsetHeight : BH[idm]['max']) : 0;
		}
		else
		{
			if(BH[idm]['back'])
			{
				BH[idm]['height']=BH[idm]['max']=BH[idm]['elem'].offsetHeight;
			}
			else
			{
				CCS(elem, 'display', 'block');
				BH[idm]['max']=BH[idm]['elem'].offsetHeight;
				BH[idm]['height']=0;
				CCS(elem, 'display', 'none');
			}
		}

		CCS(BH[idm]['elem'], 'overflow', 'hidden');
		CCS(BH[idm]['elem'], 'height', BH[idm]['height'] + 'px');
		CCS(BH[idm]['elem'], 'display', 'block');

		if(BH[idm]['elem'].id == 'login')
		{
			if(BH[idm]['back'])
			{
				CCS('login-close', 'display', 'none');
			}
		}

		BHV_Go(idm);
	}



	function BHV_Go(idm)
	{
		var plus=BH[idm]['back'] ? Math.ceil(BH[idm]['height'] / BH[idm]['speed']) : Math.ceil((BH[idm]['max'] - BH[idm]['height']) / BH[idm]['speed']);

		BH[idm]['height']=BH[idm]['back'] ? (BH[idm]['height'] - plus) : (BH[idm]['height'] + plus);

		if((BH[idm]['back'] && (BH[idm]['height'] <= 0)) || (!BH[idm]['back'] && (BH[idm]['height'] >= BH[idm]['max'])))
		{
			if(BH[idm]['back'])
			{
				CCS(BH[idm]['elem'], 'display', 'none');
				CCS(BH[idm]['elem'], 'height', 'auto');
			}
			else
			{
				CCBD();
				if(CCBIE6)
				{
					// IE 6 neumi height auto
					//CCS(BH[idm]['elem'], 'height', 'auto');
				}
				else
				{
					CCS(BH[idm]['elem'], 'height', 'auto');
				}
			}

			if(BH[idm]['elem'].id == 'login')
			{
				if(!BH[idm]['back'])
				{
					CCS('login-close', 'display', 'block');
				}

			}

			BH[idm]['run']=false;
			BH['runs']--;

			if(BH[idm]['back'] && comment)
			{
				Comments(true);
			}

			if(BH[idm]['back'] && BH[idm]['function_end'])
			{
				setTimeout(BH[idm]['function_end'], 1);
			}
		}
		else
		{
			CCS(BH[idm]['elem'], 'height', BH[idm]['height'] + 'px');
			setTimeout('BHV_Go(\'' + idm + '\');', 7);
		}
	}
