function LoadSizecol(numsize, adr, dop)
{
	if (numsize>0) 
	{
		if (dop=='') {location.href=adr+'?kolvo='+numsize;}
		else {location.href=adr+'?'+dop+'&kolvo='+numsize;}
	}
	else
	{
		if (dop=='') {location.href=adr;}
		else {location.href=adr+'?'+dop;}
	}
}

function podschet(tovarid, cena, koeficient, kolichestvo)
{
	var a='stoimost['+tovarid+']';
	var b='count1['+tovarid+']';
	var c='count2['+tovarid+']';
	var namefm='form_add'+tovarid;
	var tov=document.forms[namefm];

	if (kolichestvo>=0 && koeficient>0) 
	{
		tov[c].value=(kolichestvo/koeficient).toFixed(2);
		tov[a].value=(cena*kolichestvo).toFixed(2);
	}
	else 
	{
		if (tov[c].value>=0) 
		{
			tov[b].value=(tov[c].value*koeficient).toFixed(2);
		}
		else 
		{
			tov[b].value='';
			tov[c].value='';
			tov[a].value='';
		}
	}
	if (tov[a].value==0) tov[a].value='';
	if (tov[b].value==0) tov[b].value='';
	if (tov[c].value==0) tov[c].value='';
}

function pereschet(tovarid, cena, koeficient, kolichestvo)
{
	var a='stoimost['+tovarid+']';
	var b='count1['+tovarid+']';
	var c='count2['+tovarid+']';
	var namefm='form_add'+tovarid;
	var tov=document.forms[namefm];

	if (kolichestvo>=0 && koeficient>0) 
	{
		tov[b].value=(kolichestvo*koeficient).toFixed(2);
		tov[a].value=(cena*tov[b].value).toFixed(2);
	}
	else 
	{
		if (tov[b].value>=0) 
		{
			tov[c].value=(tov[b].value*koeficient).toFixed(2);
		}
		else 
		{
			tov[c].value='';
			tov[b].value='';
			tov[a].value='';
		}
	}
	if (tov[a].value==0) tov[a].value='';
	if (tov[b].value==0) tov[b].value='';
	if (tov[c].value==0) tov[c].value='';
}

function podschet_b(tovarid, cena, koeficient, kolichestvo)
{
	var b='count1['+tovarid+']';
	var c='count2['+tovarid+']';

	if (kolichestvo>=0 && koeficient>0) 
	{

	}
	else 
	{
		if (document.basketizm[c].value>=0) 
		{
			document.basketizm[b].value=(document.basketizm[c].value*koeficient).toFixed(2);
		}
		else 
		{
			document.basketizm[b].value=0;
		}
	}

	location.href='basket.php?change='+tovarid+'&newval='+document.basketizm[b].value;
}

function pereschet_b(tovarid, cena, koeficient, kolichestvo)
{
	var b='count1['+tovarid+']';
	var c='count2['+tovarid+']';

	if (kolichestvo>=0 && koeficient>0) 
	{
		document.basketizm[b].value=(kolichestvo*koeficient).toFixed(2);
	}
	else 
	{
		if (document.basketizm[b].value>=0) 
		{

		}
		else 
		{
			document.basketizm[b].value=0;
		}
	}

	location.href='basket.php?change='+tovarid+'&newval='+document.basketizm[b].value;
}

function provank(form)
{
	var j, txt;

	j=0;
	txt='';

	if (form.fio_basket.value=='') 
	{
		txt+='Не указано имя!\n';
		j=1;
	}
	if (form.phone_basket.value=='' && form.mail_basket.value=='') 
	{
		txt+='Не указана контактная информация!\n';
		j=1;
	}
	if (form.question_basket.value=='') 
	{
		txt+='Не указаны комментарии к заказу!\n';
		j=1;
	}

	if (j>0)
	{
		alert(txt);
		return false;
	}
	else 
	{
		return true;
	}
}

function vp(vv)
{
	var vo = vv.id;
	vo = "o" + vo.substring(1);
	var vi = document.getElementById(vo);
	if (vi.className=="answerotvet1") 
	{
		vi.className = "answerotvet2";
		vv.className = "answervopros2";
	}
	else 
	{
		vi.className = "answerotvet1";
		vv.className = "answervopros1";
	}
}

function vsep(aa)
{
	var vo = aa.id;
	var voy = document.getElementById(vo);
	var vi = "";
	var viy = "";
	var vq = "";
	var vqy = "";
	var va = "";
	var vay = "";
	if (vo=="vs1")
	{
		vi = "vs2";
		for (var i=1; i<9; i++)
		{
			vq="a"+i;
			vqy = document.getElementById(vq);
			vqy.className = "answervopros2";
			va="o"+i;
			vay = document.getElementById(va);
			vay.className = "answerotvet2"
		}
	}
	else 
	{
		vi = "vs1";
		for (var i=1; i<9; i++)
		{
			vq="a"+i;
			vqy = document.getElementById(vq);
			vqy.className = "answervopros1";
			va="o"+i;
			vay = document.getElementById(va);
			vay.className = "answerotvet1"
		}
	}
	viy = document.getElementById(vi);
	voy.className = "answervse2";
	viy.className = "answervse1";

}

function comta(tt)
{

	if (tt.className=="answervopros1") 
	{
		var vg = "";
		var vgy = "";
		var vt = "";
		var vty = "";
		for (var i=1; i<4; i++)
		{
			vg="cat"+i;
			vgy = document.getElementById(vg);
			vgy.className = "answervopros1";
			vt="town"+i;
			vty = document.getElementById(vt);
			vty.className = "nostrela"
		}

		var vo = tt.id;
		vo = "town" + vo.substring(3);
		var vi = document.getElementById(vo);
		vi.className = "yesstrela";
		tt.className = "answervopros2";
	}
}

function goaction()
{
	document.location.href="sale.php";
}
