function newwindow(name)
{
window.open(name,'_blank');
}

function ow(link,pack)
{
if (link!="") {
	var	kolvo = (+pack,pack);
	link = "cart.php?add="+link+"&kolichestvo="+kolvo;

}
else
{
link = "cart.php";

}
	var win = "width=750,height=400,menubar=no,location=no,resizable=yes,scrollbars=yes";

	newWin = window.open(link,'newWin',win);
	newWin.focus();
	if (pack=="print") {newWin.print();}
}

function Order_shopping() //place order -- close window and continue in the main window
{
	window.opener.location = 'zakaz.php';
	window.close();
}


function kolvo(tovar,kolvo) //place order -- close window and continue in the main window
{
	window.document.getElementById(tovar).value=kolvo;
	document.formochka.submit();
}

// Масоовая установка значений количества в большую/меньшую сторону
function kolvo_all (massiv) //place order -- close window and continue in the main window
{
	massiv=window.document.getElementById(massiv).value;
	mas_array=massiv.split(" ");
	for (i=0; i<mas_array.length; i++)
	{
		b=mas_array[i].split("-");
		window.document.getElementById("count_" + b[0]).value=b[1];
	}
	document.formochka.submit();

}


// Массовая установка в ноль значений, которые нельзя купить

function all_bad_to_null (massiv) //place order -- close window and continue in the main window
{
	massiv=window.document.getElementById(massiv).value;
	mas_array=massiv.split(" ");
	for (i=0; i<mas_array.length; i++)
	{
		//	b=mas_array[i].split("-");
		//window.document.getElementById("count_" + b[0]).value=b[1];
		window.document.getElementById("count_" + mas_array[i]).value=0;
	}
	document.formochka.submit();
}


function proverka2()
{
//	alert(fo.dop_info.value.length);
	if (fo.dop_info.value.length == 117) {alert("Заполните контактную информацию !");return false;}
	if (
	confirm("Заказ полностью сформирован? Отправляем?\nНажмите OK что бы отправить заказ, Cancel - если вы что то забыли.")	) 	{return true;} else {return false;}
	return false;
}

function chek_dostavka(dostavka2)
{
	if (dostavka2.value == "Доставка до вашей транспортной компании")
	{window.document.getElementById("dost_txt").innerHTML ="<span class=r>Обязательно укажите в комментарии, до какой именно транспортной компании</span>";} else {window.document.getElementById("dost_txt").innerHTML ="";}
}

function na_preload_img()
{ 
  var img_list = na_preload_img.arguments;
  if (document.preloadlist == null) 
    document.preloadlist = new Array();
  var top = document.preloadlist.length;
  for (var i=0; i < img_list.length; i++) {
    document.preloadlist[top+i] = new Image;
    document.preloadlist[top+i].src = img_list[i+1];
  } 
}

function na_change_img_src(name, nsdoc, rpath, preload)
{ 
  var img = eval((navigator.appName.indexOf('Netscape', 0) != -1) ? nsdoc+'.'+name : 'document.all.'+name);
  if (name == '')
    return;
  if (img) {
    img.altsrc = img.src;
    img.src    = rpath;
  } 
}

function na_restore_img_src(name, nsdoc)
{
  var img = eval((navigator.appName.indexOf('Netscape', 0) != -1) ? nsdoc+'.'+name : 'document.all.'+name);
  if (name == '')
    return;
  if (img && img.altsrc) {
    img.src    = img.altsrc;
    img.altsrc = null;
  } 
}

