function EnableGenerateMTR(enable)
{
    btnGenerateMTR = document.getElementById("ctl00_DetailContentPlaceHolder_btnGenerateMTR");
    
    if (btnGenerateMTR)
        btnGenerateMTR.disabled = !enable;
}

function ValidateHeatCode(source, arguments)
{
    var heatCode = arguments.Value;
    var description = source.parentNode.parentNode.nextSibling.childNodes[1].childNodes[0].value;;
    
    //Valid if: Description is provided OR 
    arguments.IsValid = ValidateHeatCodeAndDescription(heatCode, description);
}

function ValidateDescription(source, arguments)
{
    var description = arguments.Value;
    var heatCode = source.parentNode.parentNode.previousSibling.childNodes[1].childNodes[0].value;
    
    //Vald if: Heat code is provided OR Heat code and description provided.
    arguments.IsValid = heatCode.length > 0 || ValidateHeatCodeAndDescription(heatCode, description);

}

function ValidateHeatCodeAndDescription(heatCode, description)
{
    //Return true if both heat code and description are empty or populated (false if one is filled out but not the other)
    return (heatCode.length == 0 && description.length == 0) || (heatCode.length > 0 && description.length > 0);
}

function PopWhatsNew()
{
    var posTop, postLeft;
    var popup = hl_whatsnew;
    
    posTop = event.clientY;
    posLeft = event.clientX;
    
    if (popup.style.visibility != "visible")
    {
        popup.style.visibility = "visible";
        popup.style.pixelTop = posTop;
        popup.style.pixelLeft = posLeft;
    }
    else
    {
        popup.style.visibility = "hidden";
    }
}

function ResetControls(idArray)
{
    if(idArray)
    {
        var control = null;
        var lv = 0;
        for(lv=idArray.length-1;lv>=0;lv--)
        {
            control = document.getElementById(idArray[lv]);
            if(control)
            {
                control.value = "";
                control.style.backgroundColor = "white";
            }
        }
    }
}