function calcTurkeyTime(weight, stuffed) {
    var cookingTime;
    var netWeight;
    var text = "";
    if (stuffed == true) {
        //netWeight = weight + stuffing (10% of weight)
        netWeight = parseFloat(weight) + parseFloat((weight / 10));
        cookingTime = (netWeight * 27.8) + 108;
        text = "Using a fan assisted oven at 180&deg; C, your "+weight+" kg turkey (with no more than "+((weight/10).toFixed(3))*1000+"g stuffing) will be cooked in ";
    }
    else { //not stuffed
        netWeight = weight;
        cookingTime = (netWeight * 19) + 124;
        text = "Using a fan assisted preheated oven at 180&deg; C your "+weight+" kg turkey will be cooked in ";
    }
    //round up to the nearest minute
    cookingTime = Math.ceil(cookingTime);
    
    //convert cookingTime time to hours and minutes
    var hours = Math.floor(cookingTime / 60);
    var mins = Math.ceil(cookingTime % 60);

    //round up to the nearest 5 minutes **removed 24-11 on Deirdre's request**
    //mins = mins + (5 - (mins % 5)); 
    
    
    return text + hours + " hrs " + mins + " mins";
}

function calcTime() 
{
	$('#cookingTime').get(0).innerHTML = calcTurkeyTime($('#weight').get(0).value, $('#type_1').get(0).checked);
	$('#calculator').css('height', '250px');
}
