function NewJavaWindow() {
    var app = App();
    if (app == null) return;
    app.newWindow();
}
function SetPaintParams() {
    var app = App();
    if (app == null) return;
    app.setInvisibleColors(document.FmMain.TInvisibleColors.value);
    app.setPaintScale(parseFloat(document.FmPaint.TPaintScale.value));
    var zcut=parseFloat(document.FmPaint.TZCut.value)*0.01;
    if (zcut<0.0) {zcut=0.0; document.FmPaint.TZCut.value=0;}
    if (zcut>1.0) {zcut=1.0; document.FmPaint.TZCut.value=100;}
    app.setZCut(zcut);
    app.setDissectedInvisible(!document.FmPaint.CShowDissected.checked);
    app.setRotateRight(document.FmPaint.CRotateRight.checked);
    app.setRotateLeft(document.FmPaint.CRotateLeft.checked);
    app.setRotateDown(document.FmPaint.CRotateDown.checked);
    app.setRotateUp(document.FmPaint.CRotateUp.checked);
    app.setRotateClockwise(document.FmPaint.CRotateClockwise.checked);
    app.setRotateAnticlockwise(document.FmPaint.CRotateAnticlockwise.checked);
}
function SetPaintOrientation(orthIx,orthIy,orthIz,orthJx,orthJy,orthJz) {
    var app = App();
    if (app == null) return;
    app.setPaintOrientation(orthIx,orthIy,orthIz,orthJx,orthJy,orthJz);
}


var onTimerPaintActive = false;
var lastZCut = 1.0;
var lastPaintScale = 10.0;
function onTimerPaint() {
    var app = App();
    if (app == null) return;
    var newZCut=app.getZCut();
    if (newZCut!=window.lastZCut) {
        window.lastZCut=newZCut;
        document.FmPaint.TZCut.value=app.sDouble(100.0*newZCut,2);
    }
    var newPaintScale=app.getPaintScale();
    if (newPaintScale!=window.lastPaintScale) {
        window.lastPaintScale=newPaintScale;
        document.FmPaint.TPaintScale.value=app.sDouble(newPaintScale,2);
    }
    setTimeout("onTimerPaint()",1000);
}

