OpenLayers.Layer.CloudMade=OpenLayers.Class(OpenLayers.Layer.TMS,{initialize:function(d,c){if(!c.key){throw"Please provide key property in options (your API key)."}c=OpenLayers.Util.extend({attribution:'&copy; 2009 <a href="http://cloudmade.com">CloudMade</a> - Map data <a href="http://creativecommons.org/licenses/by-sa/2.0/">CCBYSA</a> 2009 <a href="http://openstreetmap.org">OpenStreetMap.org</a> contributors - <a href="http://cloudmade.com/terms_conditions">Terms of Use</a>',maxExtent:new OpenLayers.Bounds(-20037508.34,-20037508.34,20037508.34,20037508.34),maxResolution:156543.0339,units:"m",projection:"EPSG:900913",isBaseLayer:true,numZoomLevels:19,displayOutsideMaxExtent:true,wrapDateLine:true,styleId:1},c);var e=[c.key,c.styleId,256].join("/")+"/";var b=["http://a.tile.cloudmade.com/"+e,"http://b.tile.cloudmade.com/"+e,"http://c.tile.cloudmade.com/"+e];var a=[d,b,c];OpenLayers.Layer.TMS.prototype.initialize.apply(this,a)},getURL:function(e){var d=this.map.getResolution();var a=Math.round((e.left-this.maxExtent.left)/(d*this.tileSize.w));var h=Math.round((this.maxExtent.top-e.top)/(d*this.tileSize.h));var g=this.map.getZoom();var b=Math.pow(2,g);if(h<0||h>=b){return"http://cloudmade.com/js-api/images/empty-tile.png"}else{a=((a%b)+b)%b;var c=this.url;var f=g+"/"+a+"/"+h+".png";if(c instanceof Array){c=this.selectUrl(f,c)}return c+f}},CLASS_NAME:"OpenLayers.Layer.CloudMade"});