function add_line()
{
	list=document.getElementById("f_calls");

	x=navigator.userAgent;
	y=x.indexOf("IE");	

	sIDX=document.getElementsByName("CALLSIGNS").length;

	newBR=document.createElement("BR");
	list.appendChild(newBR);

	newInput=document.createElement("INPUT");
	list.appendChild(newInput);
	newInput.setAttribute("name","CALLSIGNS");
	newInput.setAttribute("id","CALLSIGNS");
	document.getElementsByName("CALLSIGNS")[sIDX].style.width="95px";
	document.getElementsByName("CALLSIGNS")[sIDX].focus();

	newSpan=document.createElement("SPAN");
	list.appendChild(newSpan);
	newSpan.setAttribute("name","x1");
	newSpan.setAttribute("id","x1");
	document.getElementsByName("x1")[sIDX].innerHTML="&nbsp;x&nbsp;";

	newInput=document.createElement("INPUT");
	list.appendChild(newInput);
	newInput.setAttribute("name","QUAN");
	newInput.setAttribute("id","QUAN");
	newInput.setAttribute("value","1");
	document.getElementsByName("QUAN")[sIDX].style.width="25px";
	document.getElementsByName("QUAN")[sIDX].style.textAlign="right";

	newSpan=document.createElement("SPAN");
	list.appendChild(newSpan);
	newSpan.setAttribute("name","x2");
	newSpan.setAttribute("id","x2");
	document.getElementsByName("x2")[sIDX].innerHTML="&nbsp;x 350 руб.";
}

function count_summa()
{
	sTotal=0;
	sCall="";
	sObj=document.getElementsByName("CALLSIGNS");
	for(i=0;i<sObj.length;i++)
	{
		if(sObj[i].value!="")
		{
			sCall=(sCall!="")?sCall:sObj[i].value;
			sTotal+=Number(document.getElementsByName("QUAN")[i].value);
		}
	}
	document.getElementById("f_quan").innerHTML=sTotal;
	document.getElementById("f_total").innerHTML=sTotal*350;
	document.Reg.CALLSIGN.value=sCall;
	setTimeout(count_summa, 500); 
}

function check()
{
	if(document.getElementById("f_quan").innerHTML==0)
	{
		alert("Укажите позывной для бейсболки.");
		document.getElementsByName("CALLSIGNS")[0].focus();
		return;
	}
	if(document.Reg.CALLSIGN.value=="")
	{
		alert("Пожалуйста, укажите позывной в информации о заказчике.");
		return;
	}
	if(document.Reg.PHONE.value=="")
	{
		alert("Пожалуйста, укажите контактный телефон.");
		return;
	}
	if(document.Reg.EMAIL.value=="")
	{
		alert("Пожалуйста, укажите контактный e-mail.");
		return;
	}

	a=confirm("Отправить ваш заказ?");
	if(a==true)
	{
		document.Reg.submit();
	}
}

function open_order()
{
	document.getElementById("amc_order").style.display="block";
	document.Reg.CALLSIGNS.focus();
	count_summa();
}