function checkform() {
var doc=document.getElementById("name1");
var mssrr=""
	
	if (doc != null)
		if (doc.value == null || doc.value == "") mssrr+="Не заполнено поле: \"Имя\"\n";
	
	doc=document.getElementById("mail");
	if (doc != null) 
		if (!(/^\w+[-_\.]*\w+@\w+-?\w+\.[a-z,\.]{2,8}$/.test(doc.value)) )
		{
		   if (doc.value==null || doc.value=="")	mssrr+="Не заполнено поле: \"Электронная почта\"\n";
		  else mssrr+="Электронный адрес заполнен не правильно\n";
		}


	doc=document.getElementById("mssg");
	if (doc != null)
		if (doc.value == null || doc.value == "") mssrr+="Нет текста сообщения\n";

	doc=document.getElementById("name");
	if (doc != null)
		if (doc.value == null || doc.value == "") mssrr+="Не заполнено поле: \"ФИО\"\n";

	doc=document.getElementById("tel");
	if (doc != null) {
		if (doc.value != "") {
			var tel = parseInt(doc.value);
			if (!tel) mssrr+="Номер телефона заполнен не правильно\n";
		}
		else mssrr+="Не заполнено поле: \"Номер телефона\"\n";
	}

if (mssrr != "") {
		alert(mssrr);
		return false;
	}
	else return true;
	
}

function doTotal(iterations) {
	if(document.getElementById) {
		var total = 0;
		for(var i=1; i <= iterations; i++) {
			var field = document.getElementById("cart2set" + i);
			var n = parseInt(field.value);
			if (isNaN(n)) {
				n = 0;
			}
			var price = parseFloat(new String(document.getElementById("price" + i).value).replace(" ",""));
			if (isNaN(price)) {
				price = 0;
			}
			var sum = price * n;
			document.getElementById("sum" + i).value = sum;
			total += sum;
		}
		document.cartform2.sum.value = total;
	}
}
