function HideBrandsList()
{
	if(document.getElementById('brands_list').style.display=="none")
	{
		document.getElementById('brands_list').style.display = "block";	
		document.getElementById('brands_list_link').innerHTML = '<b>скрыть</b>';
	}	
	else
	{
		document.getElementById('brands_list').style.display = "none";
		document.getElementById('brands_list_link').innerHTML = '<b>показать</b>';
	}	
}
function getParam(sParamName)
{
var Params = location.search.substring(1).split("&"); 
var variable = "";
	 for (var i = 0; i < Params.length; i++){ 
		 if (Params[i].split("=")[0] == sParamName){ 
		 if (Params[i].split("=").length > 1) variable = Params[i].split("=")[1]; 
	 return variable; }}  
return ""; 
}

function isValidInt(str,id)
{   
	for (var i = 0; i < str.length; i++)  { 
	var ch = str.charAt (i); 
		if (ch < "0" || ch > "9") { 
		document.getElementById('number'+id).value='';
		return false; 
		} 
	}
}  

function isValidNotNull(str,id,value)
{   
	for (var i = 0; i < str.length; i++)  { 
	var ch = str.charAt (i); 
		if (ch == "0" && str.length==1) { 
		document.getElementById('number'+id).value=value;
		return false; 
		} 
	}
} 

function flexOptions()
{
	$("#catalog").flexOptions({qtype:qtype,query:query,params:[{name:'price_min', value:price_min },{name:'price_max', value:price_max },{name:'group', value:group}]});
	return true;
}	
	
$(document).ready( function(){
	
		hs.graphicsDir = '/admin/libs/highslide/highslide/graphics/';
		hs.showCredits = 0;

	
		$("#catalog").flexigrid
				({		
				url: 'admin/mods/Catalog/Client/mod_catalog.ajax.php?cmd=CATALOG_GETLIST&section_id=' + getParam('section_id') + '&brand=' + getParam('brand'),
				dataType: 'json',
				colModel: [
					{display: 'Артикул', name : 'article', width : 75, sortable : true, align: 'center'},
					{display: 'Фото', name : 'article', width : 100, sortable : true, align: 'center'},
					{display: 'Наименование', name : 'title', width : 300, sortable : true, align: 'left'},
					{display: 'Брэнд', name : 'brand', width : 80, sortable : true, align: 'center'},
					{display: 'Ед.измерения', name : 'unit', width : 70, sortable : true, align: 'center'},
					{display: 'Цена(руб.)', name : 'price', width : 58, sortable : true, align: 'center'},
					{display: 'Остаток', name : 'rest', width : 51, sortable : true, align: 'center'},
					{display: 'Кол-во', name : 'col', width : 58, sortable : false, align: 'center'}
					],
				searchitems : [
					{display: 'Наименование', name : 'title', isdefault: true},
					{display: 'Брэнд', name : 'brand'},
					{display: 'Артикул', name : 'article'}
					],
				sortname: "",
				sortorder: "",
				usepager: true,
				title: 'Каталог товаров',
				useRp: true,
				rp: 60,
				showTableToggleBtn: true,
				width: 'auto',
				height: 'auto',		
				onSubmit: flexOptions,
				});
				


});
	
