
function equalsPrevious(i){
	var n=getIndex(i),r=(__products!=null)?__products.getRowNumber():-1;return(r>0&&__rowData[n]==_d[r-1][n])}var __k2i=[];function getIndex(n){if(isNaN(n)){if(__k2i.length==0)for(var i=1;i<_m.length;i++)__k2i[_m[i][4]]=i;n=__k2i[n]}
	return n
	}
function equalsNext(i){
	var n=getIndex(i),r=(__products!=null)?__products.getRowNumber():-1;
	return(r!=-1&&r<(_d.length-1)&&__rowData[n]==_d[r+1][n])
}
function isEmpty(i,type,offset){
	var v=(type!=null&&offset!=null)?fieldIndexed(i,type,offset,true):__rowData[getIndex(i)];
   return(v!=null&&v!='')?(v.replace(/&#160;|&nbsp;|^\\s+|\\s+$/gi,'')==''):true
}

function doCustomSubmit(p){
	var b=false,f=getData();
	if(f!=null){
		b=true;
		f.action=unescape(p);
		f.submit();
	}
	return b
}

function getPI2FI(n){
	if(isNaN(n)){
		if(__k2i.length==0)for(var i=1;i<_m.length;i++)__k2i[_m[i][4]]=i;
		n=__k2i[n]
	}else if(n<=__picRefList.length)n=__picRefList[n-1];
	return n
}

function getValueFromField(i,n){var nr=1,f=getData();if(f!=null){if(f[n]!=null){if(f[n].length!=null){if(i<f[n].length)nr=f[n][i].value}else nr=f[n].value}}return nr}
function orderdirect(oid,v,conttype,contdata,windowstyle,target){
	if(addProduct(oid,v)){
		if(conttype==0)nextPage(vt_BASKET,-1);
		else{
			if(this.bagChanged!=null)doBagChanged();
			if(conttype==1)window.open(contdata,'',windowstyle)
		}
	}
}

function addProduct(oid,v){
	setCtlVal('_edit',0);return product2Basket(oid,null,v)
}

function Products(){
	var me=this,products=_d.length,productindex=-1,active=(products>0);
	me.count=products;
	me.getRowNumber=function(){
		return productindex
	};
	me.next=function(){
		__rowData=_d[++productindex];
		__activeRow=productindex
	};
	me.hasNext=function(index){
		var n=(index!=null&&index!='')?_i(index):0;
		active=((productindex+n)<(products-1));
		return active
	};
	me.has=function(index){
		var n=(index!=null&&index!='')?_i(index):0;
		return((productindex+n)>=0&&(productindex+n)<products)
	};
	me.hasActive=function(){
		return active&&(productindex<products)&&(productindex>=0)
	}
	me.getColumn=function(){
		return productindex%getColsPerPage()
	};
	__rowData=_d[0]
}

var __products=new Products();


