function ClusterHelper(){}ClusterHelper.AddFeaturesToMap=function(m,z,j,K,v,B){var C=[];var h=null;var p=null;var E=null;var I=new esri.SpatialReference({wkid:Configuration.SpatialReferenceWKID_BING});dojo.forEach(z,function(N){E={AgencyID:N.AgencyID,CaseNumber:N.CaseNumber,CrimeCode:N.CrimeCode,Description:N.Description,Location:N.Location,ObjectID:N.ObjectID,ReportDate:N.ReportDate,X:N.X,Y:N.Y};p=new esri.geometry.Point(N.X,N.Y,I);h=new esri.Graphic(p,Configuration.LargeCrimeSymbols[dojo.indexOf(Configuration.CrimeCodes,N.CrimeCode)],E);C.push(h)});var w=m.CreateGraphicsLayer("crimesLayer");if(w!=null){m.ReorderGraphicsLayer("crimesLayer",1);dojo.connect(w,"onClick",function(N){var P=N.graphic;if(N.graphic.attributes!=undefined&&N.graphic.attributes!=null){var R=N.graphic.attributes.ObjectID;var Q=[N.graphic.attributes];var O=HtmlGenerator.GetIncidentInfoWindowHtml(Q,B);j.infoWindow.setContent(O);m.ShowInfoWindow("crimesLayer",R)}else{if(j.getLevel()<(j.getLayer(j.layerIds[0]).tileInfo.lods.length-Configuration.MaxIncidentZoomLevel)){j.centerAndZoom(P.geometry,j.getLayer(j.layerIds[0]).tileInfo.lods.length-Configuration.MaxIncidentZoomLevel)}}});var l=dojox.lang.functional;var x=[];var q=j.getLayer(j.layerIds[0]).tileInfo.lods.length;if(K>=q){K=q-1}var i=j.getLayer(j.layerIds[0]).tileInfo;var A=l.lambda("point, tileWidth,tileHeight,oPoint -> [Math.floor((oPoint.y - point.geometry.y) / tileHeight), Math.floor((point.geometry.x - oPoint.x) / tileWidth), point]");var t=l.lambda("point, tileWidth,tileHeight,oPoint -> [Math.floor((oPoint.y - point.y) / tileHeight), Math.floor((point.x - oPoint.x) / tileWidth), point]");var g=i.lods[K].resolution;var c=g*i.width;var d=g*i.height;var H=l.partial(A,l.arg,c,d,i.origin);var L=l.partial(t,l.arg,c,d,i.origin);var D=l.map([new esri.geometry.Point(v.xmin,v.ymin),new esri.geometry.Point(v.xmax,v.ymax)],L);var r=D[1][0];var F=D[0][0];var e=D[0][1];var s=D[1][1];if(!x[K]){var M=l.map(C,H);var n=[];dojo.forEach(M,function(O,N){if(n[O[0]]){var P=n[O[0]];if(P[O[1]]){P[O[1]].push(O[2])}else{P[O[1]]=O[1];P[O[1]]=[O[2]]}}else{var P=n[O[0]]=[];P[O[1]]=O[1];P[O[1]]=[O[2]]}});x[K]=n}var y=l.lambda("cPt, nextPt -> { geometry:{ x:(cPt.geometry.x + nextPt.geometry.x) / 2.0000, y:(cPt.geometry.y + nextPt.geometry.y) / 2.0000 } }");var b=(w)?w:j.graphics;var J=new esri.symbol.Font();J.setWeight(esri.symbol.Font.WEIGHT_BOLD);if(Configuration.UsingLargeIcons){J.setSize(parseInt("14pt"))}else{J.setSize(parseInt("10pt"))}if(jQuery.browser.msie==false){J.setFamily("Verdana")}else{J=null}var u=new esri.symbol.TextSymbol();u.setColor(new dojo.Color([255,255,255]));if(Configuration.UsingLargeIcons){u.setOffset(2,20)}else{u.setOffset(2,11)}u.setFont(J);var o,p,h=null;var k=Configuration.DefaultSymbol;for(var a in x[K]){if(x[K][a]!=undefined&&x[K][a]!=null){for(var f in x[K][a]){if(x[K][a][f]!=undefined&&x[K][a][f]!=null){var G=x[K][a][f];if(G.length>1){o=l.reduce(G,y);p=new esri.geometry.Point(o.geometry.x,o.geometry.y,I);h=null;if(Configuration.UsingLargeIcons){b.add(new esri.Graphic(p,Configuration.ClusterSymbol));u.setText(G.length);u.setOffset(2,20);h=new esri.Graphic(new esri.geometry.Point(p,I),u);b.add(h)}else{b.add(new esri.Graphic(p,Configuration.MiniClusterSymbol));u.setText(G.length);u.setOffset(2,11);h=new esri.Graphic(new esri.geometry.Point(p,I),u);b.add(h)}}else{dojo.forEach(G,function(N){if(N.attributes){if(Configuration.UsingLargeIcons){k=Configuration.LargeCrimeSymbols[dojo.indexOf(Configuration.CrimeCodes,N.attributes.CrimeCode)]}else{k=Configuration.MiniCrimeSymbols[dojo.indexOf(Configuration.CrimeCodes,N.attributes.CrimeCode)]}}b.add(new esri.Graphic(new esri.geometry.Point(N.geometry.x,N.geometry.y,new esri.SpatialReference({wkid:Configuration.SpatialReferenceWKID_BING})),k,N.attributes))})}}}}}$("#loading-message").hide()}};