<!--

function ShowItem(item_id, shop_alias) {
	if (shop_alias == "") {
		url = "http://www.positronica.ru/goods/catalog/" + item_id + "/";
	} else {
		url = "http://" + shop_alias +".positronica.ru/shop/catalog/" + item_id + "/";
	}

	Win=window.open(url, item_id,  'toolbar=0,scrollbars=1,location=0,directories=0,status=0,menubar=0,resizable=1,width=850,height=550,border=thin,top=50,left=50,help=0');
	Win.focus();
}

function ShowItemBuy(item_id, shop_alias) {
	if (shop_alias == "") {
		url = "http://www.positronica.ru/goods/catalog/" + item_id + "/buy/";
	} else {
		url = "http://" + shop_alias +".positronica.ru/shop/catalog/" + item_id + "/buy/";
	}

	Win=window.open(url, item_id,  'toolbar=0,scrollbars=1,location=0,directories=0,status=0,menubar=0,resizable=1,width=850,height=550,border=thin,top=50,left=50,help=0');
	Win.focus();
}

var DOM = (typeof(document.getElementById) != 'undefined'); 

function SelectAll(Name){
	if (DOM) {
		thisCheckBoxes = document.getElementsByTagName('input');

		for (i = 1; i < thisCheckBoxes.length; i++) {
			if (thisCheckBoxes[i].name == Name){
				thisCheckBoxes[i].checked = true;
			}
		}
	}
}

function UnSelectAll(Name){
	if (DOM) {
		thisCheckBoxes = document.getElementsByTagName('input');

		for (i = 1; i < thisCheckBoxes.length; i++) {
			if (thisCheckBoxes[i].name == Name){
				thisCheckBoxes[i].checked = false;
			}
		}
	}
}

function getSpisok(arr){
//	alert(arr+' | '+arr.length);
//	len = arr.length;
//	alert(arr[1]+' | '+ arr[0] +' | '+arr.length );
	if (arr.length) {s=''; for (i=0;i<arr.length;i++) s=s+','+arr[i];if (s!='') s=s.substr(1);}
	else s = arr[0];
//	alert("meee:"+s);
	return (s);
}

function mgetSpisok(oform,name,arr,checked){
//alert([oform,name,arr,checked])
//alert(oform.name);
	if (arr.length) {
///*
		s='';
//		alert(arr);
	        j=0;
		for (i=0;(i<arr.length);i++) {
		
			el=(name+'['+arr[i]+']');
//			alert(el);
//			alert(oform.elements[el]);
			if (oform.elements[el] && oform.elements[el].checked==checked) {s=s+','+arr[i];	j++;}
		}
		if ((s!='' && j<=10 && oform.name =='ItemList') || (s!='' && oform.name != 'ItemList')) s=s.substr(1);
		else if (s!='') s=-1;
//			alert(s);
	  }
//*/
	return (s);

}

// Используется в форме сравнения товаров
function refresher(field1,field2,field3){
// вызов (поле1,поле2,поле3)
if (field1!='' && field1!=-1 && field2!='' && field2!=-1) {
	if (field1 == 'none') field1 = ''; // значение none используется для сравнения товаров, не имеющих заполненных свойств (все поля пустые)
	document.forms['refresher'].property_ids.value=field1;
	document.forms['refresher'].item_ids.value=field2;
	document.forms['refresher'].sorting.value=field3;
//alert(field1+' | '+field2+' | '+field3);
	document.forms['refresher'].submit();
} else { 
	alert('Результатом операции будет пустая таблица. Пожалуйста, измените условия фильтрации.'); 
	}
}

// Используется в форме сравнения товаров
function DeleteRow(i,arr,arr1){
//alert('3');
	s='';
	for (j=0;j<arr.length;j++) if (arr[j]!=i) s=s+','+arr[j];
	if (s!='') s=s.substr(1);
	s1='';
	for (j=0;j<arr1.length;j++) s1=s1+','+arr1[j];	
	if (s1!='') s1=s1.substr(1);
	refresher(s,s1,document.forms['refresher'].sorting.value);
}

// Используется в форме сравнения товаров
function DeleteColumn(i,arr,arr1){
	s='';
	for (j=0;j<arr.length;j++) s=s+','+arr[j];
	if (s!='') s=s.substr(1);
	s1='';
	for (j=0;j<arr1.length;j++) if (arr1[j]!=i) s1=s1+','+arr1[j]; 
	if (s1!='') s1=s1.substr(1);
	refresher(s,s1,document.forms['refresher'].sorting.value);
}

//-->