/// 
/// 
/// "class" definition for Course
/// 
/// author:  josh
/// created: Oct 14, 2004
/// updated: 
/// 
/// description: 
/// 
/// 

/// 
/// constructor
/// 
/// 
function Course(row, id, index, fee)
{
    var _row = row;
    var _id = id; 
    var _index = index;
    var _fee = parseFloat(fee);
    
    /// 
    /// public accessors
    /// 
    /// 
    this.Id = Id;
    this.Index = Index;
    this.Fee = Fee;
    this.Discount = Discount;
    this.RegistrantName = RegistrantName;
    this.IsStudent = IsStudent;
    this.IsVisible = IsVisible;
    this.RegistrantNameTextBox = RegistrantNameTextBox;
    this.TakeFocus = TakeFocus;
    
    function Id()
    {
        return _id;
    }
    
    function Index()
    {
        return _index;
    }
    
    function Fee()
    {
        return _fee;
    }
    
    function Discount()
    {
        if (IsStudent())
            return _fee * .2;
        else
            return 0.0;
    }
    
    function RegistrantNameTextBox()
    {
        // 8123__registrant__name__1
        return document.getElementById(_id + "__registrant__name__" + _index);
    }
    
    function RegistrantName()
    {
        // 8123__registrant__name__1
        return document.getElementById(_id + "__registrant__name__" + _index).value;
    }
    
    function IsStudent()
    {
        // 8123__registrant__is__student__1
        try
        {
            return document.getElementById(_id + "__registrant__is__student__" + _index).checked;
        }
        catch(e)
        {
            return false;
        }
    }
    
    function IsVisible()
    {
        if (_row.style.display != "none")
            return true;
        else
            return false;
    }
    
    function TakeFocus()
    {
        try
        {
            var textbox = RegistrantNameTextBox();
            textbox.focus();
        }
        catch(e)
        {
            // do nothing
        }
    }
}