//============================================
//  global java functions
//============================================

//--------------------------------------------
//	check or uncheck all listed checkboxes
//  should use default name for header and items
//--------------------------------------------
function checkbox_selection(obj){
	$( "input[@name='checked_ids[]']" ).each( function(){
		this.checked = obj.checked;
	});
}
function on_remove(){
	var cnt = 0;
	$( "input[@name='checked_ids[]']" ).each( function(){
		if(this.checked) cnt++;
	});

	if(cnt == 0){
		alert("Please selection item(s) first.");
		return false;
	}
	return confirm("Do you really want to remove selected " + cnt + " items?");
}
//Validates that a string contains only valid integer number.
function validateInteger( strValue ) {
  var objRegExp  = /(^-?\d\d*$)/;
  return objRegExp.test(strValue);
}

function emailValidate(emailAddress) {
    if (emailAddress==null || emailAddress=="")
		return false;
    var rx =/\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*/;
    if(rx.exec(emailAddress)==null)
		return false;
    else
	    return true;
}
