//<![CDATA[
 
// Remember folks, none of this JavaScript is actually necessary, it's just there to show you
// how to extend the slider functionality with callback functions/Object.methods
 
// Preloading the images used for the slider handle, not at all necessary...
var imgList = ["slider-disabled.png", "slider-disabled-1.png", "slider.png", "slider-1.png"];
var preloadImg = []
for(var i = 0, imgSrc; imgSrc = imgList[i]; i++) {
        preloadImg[i] = new Image();
        preloadImg[i].src = "../javascript/" + imgSrc;
};  
 
// Callback function called after the slider has been created and added to the DOM
// and also whenever the slider value changes.
function updateLabel1(opts) {
        document.getElementById("label1").innerHTML = "<strong>CPUs:</strong> " + opts.value + " (1 CPU equivale a 2,25 GHz)";
};

function updateLabel2(opts) {
        document.getElementById("label2").innerHTML = "<strong>RAM:</strong> " + opts.value + " GB";
};

function updateLabel3(opts) {
        document.getElementById("label3").innerHTML = "<strong>Disco Duro:</strong> " + opts.value + " GB";
};

function updateLabel4(opts) {
        document.getElementById("label4").innerHTML = "<strong>Transferencia:</strong> " + opts.value + " GB";
};

function updateLabel5(opts) {
// 1 CPU 15,00 Eu
// 1 GB RAM 10,00 Eu
// 1 GB HD 0,20 Eu
// 1 GB Transferencia 0,10 Eu

        var cpu_total = parseInt(document.getElementById('cpu').value, 10) * 15;
        var ram_total = parseInt(document.getElementById('ram').value, 10) * 10;
        var hd_total = parseInt(document.getElementById('hd').value, 10) * 0.20;
        var transfer_total = parseInt(document.getElementById('transfer').value, 10) * 0.10;
        var total = (cpu_total + ram_total + hd_total + transfer_total);
        document.getElementById("label5").innerHTML = "<span style=\"font-size: 16px;\"><strong>TOTAL:</strong></span> <span class=\"texto_verde\" style=\"font-size: 22px;\"><strong>" + total + "</strong></span> <span class=\"texto_verde\" style=\"font-size: 16px;\"><strong>Eu/mes</strong></span>";
};
//]]>
