/* ** This files handles the course's data function(s) ** */
// Animate

// Update stage will render next frame
createjs.Ticker.framerate = 30;
createjs.Ticker.addEventListener("tick", tickHandler);


function tickHandler(e) {
    stage.update();
}



// Get Value from slider
$("#fortio").change(function() {
    $("#fortio").val($(this).val());
    getMaterial();
    //getFortio();
});

// Calculations
function getFortio() {
    //var force = Number(f);
    force = $("#fortio").val();
    document.getElementById("label").innerHTML = "Φορτίο F = <strong>" + force + "</strong> N";
}

// Change Fortio
function fortio_changed() {
    getMaterial();
    //getFortio();
}

//Material Data Sets
//Malakos Xalivas
function malakosXalivas() {

    if (force == 0) {
        showPointers("noImage", 88, 415, "Μαλακός Χάλυβας");
    } else if (force == 2000) {
        showPointers("point2000", 92, 358, "Μαλακός Χάλυβας");
    } else if (force == 4000) {
        showPointers("point4000", 95, 330, "Μαλακός Χάλυβας");
    } else if (force == 6000) {
        showPointers("point6000", 98, 300, "Μαλακός Χάλυβας");
    } else if (force == 8000) {
        showPointers("point8000", 100, 270, "Μαλακός Χάλυβας");
    } else if (force == 10000) {
        showPointers("point10000", 102, 238, "Μαλακός Χάλυβας");
    } else if (force == 12000) {
        showPointers("point12000", 105, 208, "Μαλακός Χάλυβας");
    } else if (force == 14000) {
        showPointers("point14000", 110, 178, "Μαλακός Χάλυβας");
    } else if (force == 16000) {
        showPointers("point16000", 184, 148, "Μαλακός Χάλυβας");
    } else if (force == 18000) {
        showPointers("point18000", 497, 117, "Μαλακός Χάλυβας");
    } else if (force == 20000) {
        showPointers("point20000", 405.5, 88, "Μαλακός Χάλυβας");
    }
}

function getMaterial() {

    getFortio();
    // var material = document.getElementById("material").value;
    var material = "Μαλακός Χάλυβας";
    if (material == "Μαλακός Χάλυβας") {
        // Call Data Set
        malakosXalivas();
        shapeDiagram.alpha = 1;
    }
    /*else if (material == "Υλικο 2") {
           if (force == 0) {
               showPointers("noImage", 0, 0, "Υλικό 2");
           }
           // alert(material);
       }*/
}