//AWWA - Fit Item #1, Changed By: Mayank Shukla; Start Date: 20/04/09

function CheckForProductClassCode(theElement)
{
    //Make a collection object of all input type objects
    var object = document.getElementsByTagName('input');
    
    var index1,ids, iCount =0, productnames ="", iCount1 =0;
    
    //Get the client side id of Sub-ProductCheckbox to be used in the next loop
    for(var i=0; i < object.length; i ++)
    {
        if(object[i].type == 'checkbox')
        {
            if(ids == null)
            {
                index1 = object[i].id.indexOf("SubProductCheckBox");
	            ids = object[i].id.substring(0,index1);
            }
        }        
    }
    
    for(var no=0; no < object.length; no ++)
    {
        //Check if the object is of type hidden
        if(object[no].type == 'hidden')
        {
            //Check if the hidden textbox is for Sub-Product Checkbox
            if(object[no].name.indexOf('HiddenSubProductCheckBox') >= 0)
            {
                var hiddenValue = new Array();
                hiddenValue = object[no].value.split(';');
                
                //Check if the Sub-Product Checkbox has ProductClass Code as REGFEE
                if(hiddenValue[3] == 'REGFEE' || hiddenValue[3].toLowerCase() == 'regfee')
                {
                    iCount1 = iCount1 + 1;
                    productnames = productnames +  ". " + hiddenValue[2] + "\n";
                    
                    var name2 = object[no].id.replace("HiddenSubProductCheckBox", ids + "SubProductCheckBox");                       
                    element2 = document.getElementById(name2);
                    
                    //Check if Sub-Product Check-box is checked
                    if(element2.checked == true)
					{
                       iCount = iCount + 1;
					}
                }
            }
        }
    }
    
    //if iCount1 is greater than 1 then there is a Sub-Product with class code as REGFEE
    if(iCount1 >0)
    {
        //if iCount is equal to zero then no check-box with Product Class Code as REGFEE is checked
        if(iCount == 0)
        {
            alert("Atleast one session of REGFEE needs to be selected :" + "\n" + productnames);
            return false;    
        }        
    }
    
    return true;    
}
//AWWA - Fit Item #1, Changed By: Mayank Shukla; End Date: 20/04/09