/**
 * Finds the element in the document with the given id and sets its checked property to false.
 * If the element cannot be found, nothing happens.
 */
function uncheck(id) {
    var checkbox = document.getElementById(id);
    
    if (checkbox !== null) {
	    checkbox.checked = false;
    } else {
    	//alert('Checkbox' + id + ' not found');
    }
}

/**
 * Finds the element in the document with the given id and sets its checked property to true.
 * If the element cannot be found, nothing happens.
 */
function check(id) {
    var checkbox = document.getElementById(id);
    
    if (checkbox !== null) {
	    checkbox.checked = true;
    } else {
    	//alert('Checkbox' + id + ' not found');
    }
}

/**
 * Finds the element in the document with the given id and attempts to invoke its click method.
 * If the element cannot be found, nothing happens.
 */
function clickOn(id) {
    var element = document.getElementById(id);

    if (element !== null) {
	    element.click();
    }
}

/**
 * Finds the element in the document with the given id and attempts to set its class.
 * If the element cannot be found, nothing happens.
 */
function setStyleClass(id, styleClass) {
    var element = document.getElementById(id);

    if (element !== null) {
	    element.className = styleClass;
    }
}

/**
 * Custom error handling for AJAX requests.
 */
if (window.A4J) {
    A4J.AJAX.onError = function(req,status,message){ 
    };
}

/**
 * Custom session expiration handling for AJAX requests.
 */
if (window.A4J) {
    A4J.AJAX.onExpired = function(loc, expiredMsg){
    };
}
