
var myTilesPath = "";

    var Page = {
        load: function() {        
            var map = new AMap("map", {
                mapTypes: [miniMap]            
            });                                          
            map.addMapPart(new AMapControl());
            map.loadMaps();                            
  
       }
       
    } 
    
// vlastní mapa
    var miniMap = {             
        "copyright" : "Dálnice D1 - historická mapa <img src=cd.png align=absmiddle>",
        "tileUrlFormat": "",
        "displayName"   : "Mini",
        "tileFormat"    : "jpg",
        "coordinateSystem"  : 0, 
        "centerX"           : 1048576,
        "centerY"           : 1048576,
        "scaleInfos"    : [
		{
        "coordinateSystem": 0,
        "scale": 16000000,
        "minX": 1,
        "minY": 1,
        "maxX": 2097152,
        "maxY": 2097152,
        "tileFormat": "jpg",
        "tileWidthPx": 256,
        "tileHeightPx": 256,
        "coefficientX": 4096,
        "coefficientY": 4096,
        "tileNumX": 2,
        "tileNumY": 2,
        "tileUrlFormat": myTilesPath + "http://mapy.ceskedalnice.cz/interaktivni-mapy/d1-historicka/res5/{column}-{row}"
    }
    ,
		{
        "coordinateSystem": 0,
        "scale": 8000000,
        "minX": 1,
        "minY": 1,
        "maxX": 2097152,
        "maxY": 2097152,
        "tileFormat": "jpg",
        "tileWidthPx": 256,
        "tileHeightPx": 256,
        "coefficientX": 2048,
        "coefficientY": 2048,
        "tileNumX": 4,
        "tileNumY": 4,
        "tileUrlFormat": myTilesPath + "http://mapy.ceskedalnice.cz/interaktivni-mapy/d1-historicka/res4/{column}-{row}"
    }
    ,
		{
        "coordinateSystem": 0,
        "scale": 4000000,
        "minX": 1,
        "minY": 1,
        "maxX": 2097152,
        "maxY": 2097152,
        "tileFormat": "jpg",
        "tileWidthPx": 256,
        "tileHeightPx": 256,
        "coefficientX": 1024,
        "coefficientY": 1024,
        "tileNumX": 8,
        "tileNumY": 8,
        "tileUrlFormat": myTilesPath + "http://mapy.ceskedalnice.cz/interaktivni-mapy/d1-historicka/res3/{column}-{row}"
    }
    ,
 		{
        "coordinateSystem": 0,
        "scale": 2000000,
        "minX": 1,
        "minY": 1,
        "maxX": 2097152,
        "maxY": 2097152,
        "tileFormat": "jpg",
        "tileWidthPx": 256,
        "tileHeightPx": 256,
        "coefficientX": 512,
        "coefficientY": 512,
        "tileNumX": 16,
        "tileNumY": 16,
        "tileUrlFormat": myTilesPath + "http://mapy.ceskedalnice.cz/interaktivni-mapy/d1-historicka/res2/{column}-{row}"
    }
    ,
 		{
        "coordinateSystem": 0,
        "scale": 1000000,
        "minX": 1,
        "minY": 1,
        "maxX": 2097152,
        "maxY": 2097152,
        "tileFormat": "jpg",
        "tileWidthPx": 256,
        "tileHeightPx": 256,
        "coefficientX": 256,
        "coefficientY": 256,
        "tileNumX": 32,
        "tileNumY": 32,
        "tileUrlFormat": myTilesPath + "http://mapy.ceskedalnice.cz/interaktivni-mapy/d1-historicka/res1/{column}-{row}"
    }
    ,
 		{
        "coordinateSystem": 0,
        "scale": 500000,
        "minX": 1,
        "minY": 1,
        "maxX": 2097152,
        "maxY": 2097152,
        "tileFormat": "jpg",
        "tileWidthPx": 256,
        "tileHeightPx": 256,
        "coefficientX": 128,
        "coefficientY": 128,
        "tileNumX": 64,
        "tileNumY": 64,
        "tileUrlFormat": myTilesPath + "http://mapy.ceskedalnice.cz/interaktivni-mapy/d1-historicka/res0/{column}-{row}"
    }
		
		],
        "scaleIdx"      : 0
    }   
    window.addEvent('domready', Page.load.bind(Page));    



// resizovani okna - zmena velikosti mapy

function MyResize() {
	var ppw = 0, pph = 0;
	if( self.innerHeight ) {
		ppw = self.innerWidth;
		pph = self.innerHeight;
	} else if( document.documentElement && document.documentElement.clientHeight ) {
		ppw = document.documentElement.clientWidth;
		pph = document.documentElement.clientHeight;
	} else if( document.body ) {
		ppw = document.body.clientWidth;
		pph = document.body.clientHeight;
	};
	if (pph<100) { pph=100 };
	if (ppw<300) { ppw=300 };
	document.getElementById("map").style.height = (pph - 42) + "px";
	document.getElementById("map").style.width = (ppw - 201) + "px";
	document.getElementById("sidebar").style.height = (pph - 41) + "px";
	document.getElementById("sidebar").style.left = (ppw - 200) + "px";
}
window.onresize = MyResize;

// odstraneni scroolbaru v IE
if( document.documentElement && document.documentElement.clientHeight ) {
	document.getElementsByTagName("html")[0].style.overflow = "hidden";
}

