"mololo".namespace();
mololo.SortByType={ORDER_BY_NAME:0,ORDER_BY_DATE:2,ORDER_BY_RATE:4,ORDER_BY_PRICE:6,ORDER_BY_SPOTS:8};
mololo.SortOrderType={ASC:0,DESC:1};
mololo.Alphabet={POLISH:" !\"#$%&'()*+,-./0123456789:;<=>?@AaĄąBbCcĆćDdEeĘęFfGgHhIiJjKkLlŁłMmNnŃńOoÓóPpQqRrSsŚśTtUuVvWwXxYyZzŹźŻż[\\]^_`{|}~"};
mololo.MarkerSorter=Class.create({markersMap:[[],[],[],[],[],[],[],[],[],[]],sortingSupport:[true,true,true,true,true,true,false,false,false,false],sortingComparators:[],currentOrder:mololo.SortOrderType.ASC,currentOrderBy:mololo.SortByType.ORDER_BY_NAME,initialize:function(){this.clearMarkers();
this.sortingComparators=[this.compareName,undefined,this.compareDate,undefined,this.compareRate,undefined,this.comparePrice,undefined,this.compareSpots,undefined];
this.currentOrder=mololo.SortOrderType.ASC;
this.currentOrderBy=mololo.SortByType.ORDER_BY_NAME
},getCurrentOrder:function(){return this.currentOrder
},getCurrentOrderBy:function(){return this.currentOrderBy
},clearMarkers:function(){this.markersMap=[[],[],[],[],[],[],[],[],[],[]]
},isSortingSupported:function(B,A){return this.sortingSupport[B+A]
},getMarkers:function(C,B){var A=this.markersMap[C+B];
if(A==undefined){A=[];
this.markersMap[C+B]=A
}return this.markersMap[C+B]
},getSortedEvents:function(){return this.markersMap
},addMarker:function(B){for(var F=0;
F<this.markersMap.length;
F=F+2){if(this.isSortingSupported(F,mololo.SortOrderType.ASC)){var D=this.getMarkers(F,mololo.SortOrderType.ASC);
var E=this.getMarkers(F,mololo.SortOrderType.DESC);
var A=(B!=undefined&&B!=null)?(B.getPremium()==null)?0:B.getPremium():0;
var C=SortUtils.binarySearchNextIndex(D,B,this.sortingComparators[F]);
D.splice(C,0,B);
E.splice(E.length-C,0,B)
}}},compareName:function(H,G){var J=mololo.Alphabet.POLISH;
var D=(H!=undefined&&H!=null)?(H.getTitle()==null)?"":H.getTitle().toLocaleLowerCase():"";
var F=(G!=undefined&&G!=null)?(G.getTitle()==null)?"":G.getTitle().toLocaleLowerCase():"";
var B=(H!=undefined&&H!=null)?(H.getPremium()==null)?0:H.getPremium():0;
var A=(G!=undefined&&G!=null)?(G.getPremium()==null)?0:G.getPremium():0;
if(B>A){return -1
}if(B<A){return 1
}var E=0;
var I=0;
var C=[D.length,F.length].min();
while(E<C&&I==0){I=J.indexOf(D.charAt(E))-J.indexOf(F.charAt(E++))
}if(I==0){I=D.length-F.length
}return I
},compareDate:function(C,A){var F=(C!=undefined&&C!=null)?(C.getPremium()==null)?0:C.getPremium():0;
var E=(A!=undefined&&A!=null)?(A.getPremium()==null)?0:A.getPremium():0;
if(F>E){return -1
}if(F<E){return 1
}var D=(C!=undefined&&C!=null)?C.getDate():"";
var B=(A!=undefined&&A!=null)?A.getDate():"";
if(D<B){return -1
}if(D>B){return 1
}return 0
},compareRate:function(B,A){var D=(B!=undefined&&B!=null)?(B.getPremium()==null)?0:B.getPremium():0;
var C=(A!=undefined&&A!=null)?(A.getPremium()==null)?0:A.getPremium():0;
if(D>C){return -1
}if(D<C){return 1
}var F=(B!=undefined&&B!=null)?parseFloat(B.getScore()):0;
var E=(A!=undefined&&A!=null)?parseFloat(A.getScore()):0;
return F-E
},comparePrice:function(B,A){log.warn("this.comparePrice not implemented ...");
return 0
},compareSpots:function(B,A){log.warn("this.compareSpots not implemented ...");
return 0
}});