var oCache={iCacheLower:-1};function fnSetKey(b,e,d){for(var c=0,a=b.length;c<a;c++){if(b[c].name==e){b[c].value=d}}}function fnGetKey(b,d){for(var c=0,a=b.length;c<a;c++){if(b[c].name==d){return b[c].value}}return null}function fnDataTablesPipeline(j,l,d){var g=4;var k=false;var h=fnGetKey(l,"sEcho");var f=fnGetKey(l,"iDisplayStart");var c=fnGetKey(l,"iDisplayLength");var b=f+c;oCache.iDisplayStart=f;if(oCache.iCacheLower<0||f<oCache.iCacheLower||b>oCache.iCacheUpper){k=true}if(oCache.lastRequest&&!k){for(var e=0,a=l.length;e<a;e++){if(l[e].name!="iDisplayStart"&&l[e].name!="iDisplayLength"&&l[e].name!="sEcho"){if(l[e].value!=oCache.lastRequest[e].value){k=true;break}}}}oCache.lastRequest=l.slice();if(peticioNova==true){k=true}if(k){peticioNova=false;if(f<oCache.iCacheLower){f=f-(c*(g-1));if(f<0){f=0}}oCache.iCacheLower=f;oCache.iCacheUpper=f+(c*g);oCache.iDisplayLength=fnGetKey(l,"iDisplayLength");fnSetKey(l,"iDisplayStart",f);fnSetKey(l,"iDisplayLength",c*g);jQuery.getJSON(j,l,function(i){oCache.lastJson=jQuery.extend(true,{},i);if(oCache.iCacheLower!=oCache.iDisplayStart){i.aaData.splice(0,oCache.iDisplayStart-oCache.iCacheLower)}i.aaData.splice(oCache.iDisplayLength,i.aaData.length);if(i.sTats){if(i.creaEstats==true||i.creaEstats=="true"){escriuProductes(i.sTats)}}d(i);fnOpenClose()})}else{json=jQuery.extend(true,{},oCache.lastJson);json.sEcho=h;json.aaData.splice(0,f-oCache.iCacheLower);json.aaData.splice(c,json.aaData.length);if(json.sTats){if(json.creaEstats==true||json.creaEstats=="true"){escriuProductes(json.sTats)}}d(json);fnOpenClose();return}}function rondo(b,a){var b=parseFloat(b);var a=parseFloat(a);a=(!a?2:a);return Math.round(b*Math.pow(10,a))/Math.pow(10,a)};
