OpenLayers.Util.OSM={};OpenLayers.Util.OSM.MISSING_TILE_URL="http://www.freemap.co.il/images/expand.gif";OpenLayers.Util.OSM.originalOnImageLoadError=OpenLayers.Util.onImageLoadError;OpenLayers.Util.onImageLoadError=function(){if(this.src.match(/^http:\/\/tiles[123]\.waze\.com\//)){this.src=OpenLayers.Util.OSM.MISSING_TILE_URL;}else{OpenLayers.Util.OSM.originalOnImageLoadError;}};OpenLayers.Layer.OSM=OpenLayers.Class(OpenLayers.Layer.TMS,{initialize:function(name,url,options){options=OpenLayers.Util.extend({attribution:"Data by <a href='http://www.waze.com/'>Waze.com</a>",maxExtent:new OpenLayers.Bounds(-20037508.34,-20037508.34,20037508.34,20037508.34),resolutions:[19567.8792375,9783.93961875,4891.969809375,2445.984904687,611.496226172,152.874056543,76.437028271,19.109257068,4.777314267,2.388657133],maxResolution:19567.8792375,units:"m",projection:"EPSG:900913",transitionEffect:"resize"},options);var newArguments=[name,url,options];OpenLayers.Layer.TMS.prototype.initialize.apply(this,newArguments);},api_token:"",getURL:function(bounds){var res=this.map.getResolution();var x=Math.round((bounds.left-this.maxExtent.left)/(res*this.tileSize.w));var y=Math.round((this.maxExtent.top-bounds.top)/(res*this.tileSize.h));var z=this.map.getZoom();switch(z)
{case 0:z=3;break;case 1:z=4;break;case 2:z=5;break;case 3:z=6;break;case 4:z=8;break;case 5:z=10;break;case 6:z=11;break;case 7:z=13;break;case 8:z=15;break;case 9:z=16;break;default:}
var limit=Math.pow(2,z);if(y<0||y>=limit)
{return OpenLayers.Util.OSM.MISSING_TILE_URL;}
else
{x=((x%limit)+limit)%limit;var url=this.url;var path="tiles/"+z+"/"+x+"/"+y+".png";if(this.api_token&&this.api_token.length>0)
path+="?api_token="+this.api_token;if(url instanceof Array)
{url=this.selectUrl(path,url);}
return url+path;}},CLASS_NAME:"OpenLayers.Layer.OSM"});OpenLayers.Layer.OSM.Mapnik=OpenLayers.Class(OpenLayers.Layer.OSM,{initialize:function(name,options){var url=["http://tiles1.waze.com/","http://tiles2.waze.com/","http://tiles3.waze.com/","http://tiles4.waze.com/"];options=OpenLayers.Util.extend({numZoomLevels:10},options);var newArguments=[name,url,options];OpenLayers.Layer.OSM.prototype.initialize.apply(this,newArguments);},CLASS_NAME:"OpenLayers.Layer.OSM.Mapnik"});