//$Id: AuditTrailsOperations.js,v 1.1.2.1 2005/08/10 07:31:47 muthukrishnan Exp $


function clearAudit(url, errMsg, confirmMsg)
{
    var listViewForm = document.listView;
    var len = listViewForm.elements.length;
    var selectedAuditId = '';
    for ( var i=0; i < len; i++)
    {
        formElement = listViewForm.elements[i];
        if (formElement.type == "checkbox" && formElement.name == 'rowSelection' && formElement.checked == true)
        {
            if(selectedAuditId == '')
            {
                selectedAuditId = formElement.value;
            }
            else
            {
                selectedAuditId += ',' + formElement.value;
            }
        }
    }
    if(selectedAuditId == '')
    {
        alert(errMsg);
        return;
    }

    var con = confirm(confirmMsg);
    if ( con != true)
    {
        return;
    }
    else
    {
        var viewLength = document.pagexform.viewLength.value;
        var isAscending= document.pagexform.isAscending.value;
        var orderByColumn = document.pagexform.orderByColumn.value;
        var from= document.pagexform.FROM_INDEX.value; 
        var page= document.pagexform.PAGE_NUMBER.value;
        
        url = url +"&isAscending="+isAscending+"&orderByColumn="+orderByColumn+"&FROM_INDEX="+from+"&PAGE_NUMBER="+page+"&authAuditId=" + selectedAuditId+"&viewLength="+viewLength;
        location.href = url;
    }
}    
