var ia=500;
var ib=500;
var ic=500;
var ig=500;

function chaq()
{
if(ia == 0)
{

	if(ib == 0)
	{

		if(ic == 0)
		{
		
			if(ig == 0)
			{
			ia=500;
			ib=500;
			ic=500;
			ig=500;
			scrla.style.width=500;
			scrlb.style.width=500;
			scrlc.style.width=500;
			scrlg.style.width=500;
			clearTimeout(tmk);
			var tmk = setTimeout("chkea()",5000);
			}
			else 
			{
			if(ig == 500)
			{
			clearTimeout(tmk);
			ig=ig-5;
			var tmk = setTimeout("chkeg()",5000);
			}
			else 
			{
			clearTimeout(tmk);
			ig=ig-5;
			var tmk = setTimeout("chkeg()",100);
			}
			}
		
		//конец g
		}
		else 
		{
		if(ic == 500)
		{
		clearTimeout(tmk);
		ic=ic-5;
		var tmk = setTimeout("chkec()",5000);
		}
		else 
		{
		clearTimeout(tmk);
		ic=ic-5;
		var tmk = setTimeout("chkec()",100);
		}
		}
	//конец c
	}
	else 
	{
	if(ib == 500)
	{
	clearTimeout(tmk);
	ib=ib-5;
	var tmk = setTimeout("chkeb()",5000);
	}
	else 
	{
	clearTimeout(tmk);
	ib=ib-5;
	var tmk = setTimeout("chkeb()",100);
	}
	}
//конец b
}
else 
{
	if(ia == 500)
	{
	clearTimeout(tmk);
	ia=ia-5;
	var tmk = setTimeout("chkea()",5000);
	}
	else 
	{
	clearTimeout(tmk);
	ia=ia-5;
	tmk = setTimeout("chkea()",100);
}
}
}

function chkea() {
scrla.style.width=ia;
chaq()
}

function chkeb() {
scrlb.style.width=ib;
chaq()
}

function chkec() {
scrlc.style.width=ic;
chaq()
}

function chkeg() {
scrlg.style.width=ig;
chaq()
}
