<!-- Begin
// do ServiceCalc()
function doSelectServiceCalc(form)
{
    var form = document.forms.service
    
    // +%
    var PERC = 1;

    


    w_number = form.w_number.value; //
    if (w_number <= 10){        w_without = 8;
        w_result = w_number * w_without;    }
    if (w_number >= 11 && w_number <= 20){            w_without = 7;
            w_result = (w_number - 10) *  w_without + 10 * 8;
    }
    if (w_number >= 21){            w_without = 6;
            w_result = (w_number - 20) *  w_without + 10 * 8 + 10 * 7;
    }
    // adding 10%
    w_result = w_result * PERC;


    a_number = form.a_number.value;
    a_without = 5;

    ad_number = (form.ad_number.value);//
    if (ad_number <= 20){
        ad_without = 1;
        ad_result = ad_number *  ad_without;
    }
    if (ad_number >= 21){
        if (ad_number <= 40) {
            ad_without = 0.9;
            ad_result = (ad_number - 20) *  ad_without + 20 * 1;
        }
    }
    if (ad_number >= 41){
        if (ad_number <= 60) {
            ad_without = 0.8;
            ad_result = (ad_number - 40) *  ad_without + 20 * 1 + 20 * 0.9;
        }
    }
    if (ad_number >= 61){
        if (ad_number <= 80) {
            ad_without = 0.7;
            ad_result = (ad_number - 60) *  ad_without + 20 * 1 + 20 * 0.9 + 20 * 0.8;
        }
    }
    if (ad_number >= 81){
        if (ad_number <= 100) {
            ad_without = 0.6;
            ad_result = (ad_number - 80) *  ad_without + 20 * 1 + 20 * 0.9 + 20 * 0.8 + 20 * 0.7;
        }
    }
    if (ad_number >= 101){
        ad_without = 0.5;
        ad_result = (ad_number - 100) *  ad_without + 20 * 1 + 20 * 0.9 + 20 * 0.8 + 20 * 0.7 + 20 * 0.6;
    }
    // adding 10%
    ad_result = ad_result * PERC;

    in_number = form.in_number.value;

    if (in_number <= 20){
        in_without = 1;
        in_result = in_without * in_number;
    }
    if (in_number >= 21){
        if (in_number <= 40) {
            in_without = 0.9;
            in_result = (in_number - 20) *  in_without + 20 * 1;
        }
    }
    if (in_number >= 41){
        if (in_number <= 60) {
            in_without = 0.8;
            in_result = (in_number - 40) *  in_without + 20 * 1 + 20 * 0.9;
        }
    }
    if (in_number >= 61){
        if (in_number <= 80) {
            in_without = 0.7;
            in_result = (in_number - 60) *  in_without + 20 * 1 + 20 * 0.9 + 20 * 0.8;
        }
    }
    if (in_number >= 81){
        if (in_number <= 100) {
            in_without = 0.6;
            in_result = (in_number - 80) *  in_without + 20 * 1 + 20 * 0.9 + 20 * 0.8 + 20 * 0.7;
        }
    }
    if (in_number >= 101){
        in_without = 0.5;
        in_result = (in_number - 100) *  in_without + 20 * 1 + 20 * 0.9 + 20 * 0.8 + 20 * 0.7 + 20 * 0.6;
    }
    // adding 10%
    in_result = in_result * PERC;

    in2_number = form.in2_number.value;

    if (in2_number <= 20){
        in2_without = 1;
        in2_result = in2_without * in2_number;
    }
    if (in2_number >= 21){
        if (in2_number <= 40) {
            in2_without = 0.9;
            in2_result = (in2_number - 20) *  in2_without + 20 * 1;
        }
    }
    if (in2_number >= 41){
        if (in2_number <= 60) {
            in2_without = 0.8;
            in2_result = (in2_number - 40) *  in2_without + 20 * 1 + 20 * 0.9;
        }
    }
    if (in2_number >= 61){
        if (in2_number <= 80) {
            in2_without = 0.7;
            in2_result = (in2_number - 60) *  in2_without + 20 * 1 + 20 * 0.9 + 20 * 0.8;
        }
    }
    if (in2_number >= 81){
        if (in2_number <= 100) {
            in2_without = 0.6;
            in2_result = (in2_number - 80) *  in2_without + 20 * 1 + 20 * 0.9 + 20 * 0.8 + 20 * 0.7;
        }
    }
    if (in2_number >= 101){
        in2_without = 0.5;
        in2_result = (in2_number - 100) *  in2_without + 20 * 1 + 20 * 0.9 + 20 * 0.8 + 20 * 0.7 + 20 * 0.6;
    }
   
    // adding 10%
    in2_result = in2_result * PERC;

    




    ac2_without = 10;
    ac2_number = form.ac2_number.value;
   

    ac4_without = 4;
    ac4_number = form.ac4_number.value;
   
    
    
    
    salary_message = form.ac4_number.value * 5;
    
    // get input from the form
    sum_result = form.sum_result.value;
    
    
    //Calculating
    sum_result = (a_number * a_without * PERC) + (w_result) + (ad_result) + (in_result) + (in2_result) + (ac2_number * ac2_without * PERC) + (ac4_number * ac4_without * PERC) + salary_message;
    //alert(ac4_number * ac4_without);
    // sum_result_tax = sum_result_w_tax * 0.21;
    // sum_result = sum_result_w_tax;
    
    // transfer
    form.sum_result.value = sum_result.toFixed(2);
    // form.sum_result_tax.value = sum_result_tax.toFixed(2);
    // form.sum_result_w_tax.value = sum_result_w_tax.toFixed(2);

}

function formNull() {
    var els = document.forms.service.elements;
    for (e in els) {
        els[e].value = 0;
    }
    return false;
}
function clear_field(field){
    if (field.value==field.defaultValue || field.value=='0'){
        field.value=''
    }
}
function check_field(field){
    if (field.value==''||field.value==' ')   {
        field.value=field.defaultValue
    }
}
//  End -->
