function getsavings(){
var myfalse = 0;

var localVal = 0;
var local_iConR = 0;
var local_Diff = 0;
var local_Perc = 0;

var longVal = 0;
var longdist_iConR = 0;
var longdist_Diff = 0;
var longdist_Perc = 0;

var intVal = 0;
var international_iConR = 0;
var international_Diff = 0;
var international_Perc = 0;

var fixVal = 0;
var fixtomobile_iConR = 0;
var fixtomobile_Diff = 0;
var fixtomobile_Perc = 0;

if (document.savingcal.local.value.length == 0){
    localVal = 0;
    myfalse += 2;
} else {
    if (document.savingcal.local.value / document.savingcal.local.value != 1){
        if (document.savingcal.local.value == 0)
        {
            localVal = document.savingcal.local.value * 1
            myfalse += 2;
        } else {
            myfalse += 1;
        }
    } else {
        localVal = document.savingcal.local.value * 1
        myfalse += 2;
    }
}
if (document.savingcal.longdist.value.length == 0){
    longVal = 0;
    myfalse += 2;
} else {
    if (document.savingcal.longdist.value / document.savingcal.longdist.value != 1){
        if (document.savingcal.longdist.value == 0)
        {
            longVal = document.savingcal.longdist.value * 1
            myfalse += 2;
        } else {
            myfalse += 1;
        }
    } else {
        longVal = document.savingcal.longdist.value * 1
        myfalse += 2;
    }
}

if (document.savingcal.international.value.length == 0){
    intVal = 0;
    myfalse += 2;
} else {
    if (document.savingcal.international.value / document.savingcal.international.value != 1){
        if (document.savingcal.international.value == 0)
        {
            intVal = document.savingcal.international.value * 1
            myfalse += 2;
        } else {
            myfalse += 1;
        }
    } else {
        intVal = document.savingcal.international.value * 1
        myfalse += 2;
    }
}

if (document.savingcal.fixtomobile.value.length == 0){
    fixVal = 0;
    myfalse += 2;
} else {
    if (document.savingcal.fixtomobile.value / document.savingcal.fixtomobile.value != 1){
        if (document.savingcal.fixtomobile.value == 0)
        {
            fixVal = document.savingcal.fixtomobile.value * 1
            myfalse += 2;
        } else {
            myfalse += 1;
        }
    } else {
        fixVal = document.savingcal.fixtomobile.value * 1
        myfalse += 2;
    }
}

if (myfalse != 8){
    document.savingcal.myerror.value = "One or more amounts are invalid!";
    
    document.savingcal.local_iConR.value = "0";
    document.savingcal.local_Diff.value = "0";
    document.savingcal.local_Perc.value = "0%";
    
    document.savingcal.longdist_iConR.value = "0";
    document.savingcal.longdist_Diff.value = "0";
    document.savingcal.longdist_Perc.value = "0%";
    
    document.savingcal.international_iConR.value = "0";
    document.savingcal.international_Diff.value = "0";
    document.savingcal.international_Perc.value = "0%";
    
    document.savingcal.fixtomobile_iConR.value = "0";
    document.savingcal.fixtomobile_Diff.value = "0";
    document.savingcal.fixtomobile_Perc.value = "0%";
    
    document.savingcal.amount_total.value = "0";
    document.savingcal.iConR_total.value = "0";
    document.savingcal.Diff_total.value = "0";
    document.savingcal.Perc_total.value = "0%";
    return false;
}
if (myfalse == 8){
    document.savingcal.myerror.value = "";
    amount_total = (localVal + longVal + intVal + fixVal);
    
    local_iConR = localVal - (localVal * 0.35);
    local_Diff = localVal - local_iConR;
    longdist_Diff = longVal - longdist_iConR;
    if (local_Diff == 0) {
        local_Perc = "0%";
    } else {
        loc_Perc = (local_Diff/localVal)*100;
        local_Perc = Math.round(loc_Perc*100)/100 + "%";
    }
    document.savingcal.local_iConR.value = Math.round(local_iConR*100)/100;
    document.savingcal.local_Diff.value = Math.round(local_Diff*100)/100;
    document.savingcal.local_Perc.value = local_Perc;

    longdist_iConR = longVal - (longVal * 0.24);
    longdist_Diff = longVal - longdist_iConR;
    if (longdist_Diff == 0) {
        longdist_Perc = "0%";
    } else {
        long_Perc = (longdist_Diff/longVal)*100;
        longdist_Perc = Math.round(long_Perc*100)/100 + "%";
    }
    document.savingcal.longdist_iConR.value = Math.round(longdist_iConR*100)/100;
    document.savingcal.longdist_Diff.value = Math.round(longdist_Diff*100)/100;
    document.savingcal.longdist_Perc.value = longdist_Perc;

    international_iConR = intVal - (intVal * 0.41);
    international_Diff = intVal - international_iConR;
    if (international_Diff == 0) {
        international_Perc = "0%";
    } else {
        int_Perc = (international_Diff/intVal)*100;
        international_Perc = Math.round(int_Perc*100)/100 + "%";
    }
    document.savingcal.international_iConR.value = Math.round(international_iConR*100)/100;
    document.savingcal.international_Diff.value = Math.round(international_Diff*100)/100;
    document.savingcal.international_Perc.value = international_Perc;

    fixtomobile_iConR = fixVal - (fixVal * 0.38);
    fixtomobile_Diff = fixVal - fixtomobile_iConR;
    if (fixtomobile_Diff == 0) {
        fixtomobile_Perc = "0%";
    } else {
        fix_Perc = (fixtomobile_Diff/fixVal)*100;
        fixtomobile_Perc = Math.round(fix_Perc*100)/100 + "%";
    }
    document.savingcal.fixtomobile_iConR.value = Math.round(fixtomobile_iConR*100)/100;
    document.savingcal.fixtomobile_Diff.value = Math.round(fixtomobile_Diff*100)/100;
    document.savingcal.fixtomobile_Perc.value = fixtomobile_Perc;
    
    document.savingcal.amount_total.value = Math.round(amount_total*100)/100;
    iConR_total = local_iConR + longdist_iConR + international_iConR + fixtomobile_iConR;
    document.savingcal.iConR_total.value = Math.round(iConR_total*100)/100;
    Diff_total = local_Diff + longdist_Diff + international_Diff + fixtomobile_Diff;
    document.savingcal.Diff_total.value = Math.round(Diff_total*100)/100;
    if (Diff_total == 0) {
        Perc_total = "0%";
    } else {
        tot_Perc = (Diff_total/amount_total)*100;
        Perc_total = Math.round(tot_Perc*100)/100 + "%";
    }
    document.savingcal.Perc_total.value = Perc_total;
    return false;
}
}