/* common char sets */
var nonzero 	  = "123456789";
var digits 		  = "0123456789";
var alphasWSpace  = "abcdefghijklmnopqrstuvwxyz";
var alphas  	  = " abcdefghijklmnopqrstuvwxyz";

/* gets the keyCode typed*/
function getTypedKeyCode(e){
	var key = false;
	if (window.event) key = window.event.keyCode;
	else if (e) key = e.which;
	return key;	
}

/* allows only characters in the chars array */
function filterChars(e, chars)
{
	var key = getTypedKeyCode(e);
	if(!key) return true;
	/* allow upper case */
	var keychar = String.fromCharCode(key).toLowerCase();
	/* allow control keys */
	if ((key==null) || (key==0) || (key==8) ||  (key==9) || (key==13) || (key==27)) return true;
	/* allow chars in arg string */
	else if (((chars).indexOf(keychar) > -1)) return true;
	else return false;
}

/* disables form submission on enter */
function noenter(e) {
  return !(e && e.keyCode == 13); 
}

function confUDel(username){
	if(confirm('Are you sure you want to delete user "'+username+'"?'))
		return true;
	return false;
}

function confUAct(username, status){
	status == 1 ? s = 'inactivate' : s = 'activate';
	if(confirm('Are you sure you want to '+s+' user "'+username+'"?'))
		return true;
	return false;
}

function confADel(artid){
	if(confirm('Are you sure you want to delete art id "'+artid+'"?'))
		return true;
	return false;
}