// javascript kartennavigation
var x0, y0;
x0 = 69;
y0 = 168;
function BigMapShift(x,y) {                                        // x,y: Koordinaten in kleiner Karte
        var topclip, bottomclip, rightclip, leftclip ;
        with (document.getElementById("kartegross").style) {
                left = 90 - (x - 69) * 6;
                top = -770 - (y - 165) * 6;
                leftclip = 260 - parseInt(left);                // X-Koordinate der Großkarte bzgl. Bildschirm berückischtigen
                topclip = 20 - parseInt(top);                // Y-Koordinate der Großkarte bzgl. Bildschirm berückischtigen
                rightclip = leftclip + 495;                        // Breite der Großkarte berücksichtigen
                bottomclip =  topclip + 430;                // Höhe der Großkarte berücksichtigen
                clip = "rect(" + topclip + " " +  rightclip + " " + bottomclip + " " + leftclip +")";
        }
        with (document.getElementById("Ausschnitt").style) {
                left = 28 + x - 69;
                top = 131 + y - 165;
        }
}

function NavMapClick(e) {
        var x, y;
        if (e.offsetX) {
                x = e.offsetX;
                y = e.offsetY;
        } else {
                x = e.layerX;
                y = e.layerY;
        }
        if (isNaN(x)) {
                x = x0;
        } else {
                x0 = x;
        }
        if (isNaN(y)) {
                y = y0;
        } else {
                y0 = y;
        }
        BigMapShift(x,y);                                        // x,y: Koordinaten in kleiner Karte
        return false;
}

function SectionClick(e) {
        var x, y;
        if (e.offsetX) {
                x = e.offsetX;
                y = e.offsetY;
        } else {
                x = e.layerX;
                y = e.layerY;
        }
        if (isNaN(x)) {
                x = 41;
        }
        if (isNaN(y)) {
                y = 36;
        }
        x0 += x - 41;
        if (x0 < 40) x0 = 40;
        if (x0 > 150) x0 = 150;
        y0 += y - 36;
        if (y0 < 10)  y0 = 10;
        if (y0 > 255)  y0 = 255;
        BigMapShift(x0,y0);                                        // x,y: Koordinaten in kleiner Karte
        return false;
}

function Jump(dx, dy) {
        x0 = x0 + 10 * dx;
        if (x0 < 0) x0 = 0;
        if (x0 > 194) x0 = 194;
        y0 = y0 + 10 * dy;
        if (y0 < 0) y0 = 0;
        if (y0 > 265) y0 = 265;
        BigMapShift(x0,y0);
        return false;
}

