// --- custom layer functions

function CustomGetTileUrl(a,b) {
	if ( b == 15 && a.x >= 17423 && a.x <= 17427 && a.y >= 11353 && a.y <= 11357 ) {
	    return "http://kwis.visitcity.de/maps/dachau/ge/Z" + b + "/" + a.y + "_" + a.x + ".png";
	} else if ( b == 16 && a.x >= 34847 && a.x <= 34855 && a.y >= 22706 && a.y <= 22715 ) {
	    return "http://kwis.visitcity.de/maps/dachau/ge/Z" + b + "/" + a.y + "_" + a.x + ".png";
	} else if ( b == 17 && a.x >= 69694 && a.x <= 69710 && a.y >= 45413 && a.y <= 45431 ) {
	    return "http://kwis.visitcity.de/maps/dachau/ge/Z" + b + "/" + a.y + "_" + a.x + ".png";
	} else if ( b == 18 && a.x >= 139389 && a.x <= 139421 && a.y >= 90827 && a.y <= 90863 ) {
	    return "http://kwis.visitcity.de/maps/dachau/ge/Z" + b + "/" + a.y + "_" + a.x + ".png";
	} else if ( b == 19 && a.x >= 278778 && a.x <= 278842 && a.y >= 181654 && a.y <= 181727 ) {
	    return "http://kwis.visitcity.de/maps/dachau/ge/Z" + b + "/" + a.y + "_" + a.x + ".png";
	}
	return G_SATELLITE_MAP.getTileLayers()[0].getTileUrl(a,b);
}

function CustomGetTileUrlZ19(a,b) {
	if ( b == 15 && a.x >= 17423 && a.x <= 17427 && a.y >= 11353 && a.y <= 11357 ) {
	    return "http://kwis.visitcity.de/maps/dachau/ge/Z" + b + "/" + a.y + "_" + a.x + ".png";
	} else if ( b == 16 && a.x >= 34847 && a.x <= 34855 && a.y >= 22706 && a.y <= 22715 ) {
	    return "http://kwis.visitcity.de/maps/dachau/ge/Z" + b + "/" + a.y + "_" + a.x + ".png";
	} else if ( b == 17 && a.x >= 69694 && a.x <= 69710 && a.y >= 45413 && a.y <= 45431 ) {
	    return "http://kwis.visitcity.de/maps/dachau/ge/Z" + b + "/" + a.y + "_" + a.x + ".png";
	} else if ( b == 18 && a.x >= 139389 && a.x <= 139421 && a.y >= 90827 && a.y <= 90863 ) {
	    return "http://kwis.visitcity.de/maps/dachau/ge/Z" + b + "/" + a.y + "_" + a.x + ".png";
	} else if ( b == 19 && a.x >= 278778 && a.x <= 278842 && a.y >= 181654 && a.y <= 181727 ) {
	    return "http://kwis.visitcity.de/maps/dachau/ge/Z" + b + "/" + a.y + "_" + a.x + ".png";
	}
	return "../visitcity/img/blank.gif";
}

function addClientTileLayer() {
			
            // Create the copyright collection
            var copyCollection = new GCopyrightCollection('Luftbild Dachau');
            var copyright = new GCopyright(1, new GLatLngBounds(new GLatLng(48.2393090, 11.4147949), new GLatLng(48.2758815, 11.4697266)), 0, "&copy; Stadt Dachau");
            copyCollection.addCopyright(copyright);
            
            // Setup the tile layers ...
            var tilelayer = new GTileLayer(copyCollection, 15, 19 );
            tilelayer.getTileUrl = CustomGetTileUrl;
            tilelayer.getOpacity = function () {return 1.00;};//of the non transparent part
            tilelayer.isPng = function() {return true;};
            
            // add luftbild dachau to hybrid and satellite map ...
            G_SATELLITE_MAP.getTileLayers()[1] = tilelayer;
            G_HYBRID_MAP.getTileLayers()[2] = G_HYBRID_MAP.getTileLayers()[1];
            G_HYBRID_MAP.getTileLayers()[1] = tilelayer;
            
}
