/**
 * marks all rows and selects its first checkbox inside the given element
 * the given element is usaly a table or a div
 *
 * @param    container    DOM element
 */
function markAllCheckboxes( container_id ) {
    var rows = document.getElementById(container_id).getElementsByTagName('tr');
    var unique_id;
    var checkbox;
	var test;

    for ( var i = 0; i < rows.length; i++ ) {

        checkbox = rows[i].getElementsByTagName( 'input' )[0];

        if ( checkbox && checkbox.type == 'checkbox' ) {
            unique_id = checkbox.name + checkbox.value;
            if ( checkbox.disabled == false ) {
                checkbox.checked = true;
            }
        }
    }

    return true;
}

/**
 * unmarks all rows and selects its first checkbox inside the given element
 * the given element is usaly a table or a div
 *
 * @param    container    DOM element
 */
function unmarkAllCheckboxes( container_id ) {
    var rows = document.getElementById(container_id).getElementsByTagName('tr');
    var unique_id;
    var checkbox;
	var test;

    for ( var i = 0; i < rows.length; i++ ) {

        checkbox = rows[i].getElementsByTagName( 'input' )[0];

        if ( checkbox && checkbox.type == 'checkbox' ) {
            unique_id = checkbox.name + checkbox.value;
            if ( checkbox.disabled == false ) {
                checkbox.checked = false;
            }
        }
    }

    return true;
}