function confirmThis(msg, link) {
	var agree = confirm(msg);	
	if (agree) {
		window.location = link;
		return false;
	}
	else {
		return false;
	}
}

function hovertable() {
	var tables = new Array();
	hoverIt = function(thetable) {
		
		var rows = thetable.getElementsByTagName('tbody')[0].getElementsByTagName('tr');
		for (i=0; i<rows.length; i++) {
			rows[i].onmouseover = function() {
				this.className = 'hover';
			}
			rows[i].onmouseout = function() {
				this.className = '';
			}
		}
		
	}
	
	if (document.getElementsByTagName('table').length > 0) {
		tables = document.getElementsByTagName('table');
		
		for (i=0; i<tables.length; i++) {
			if (tables[i].className.indexOf("hoverRows") >= 0) {
				hoverIt(tables[i]);
			}
		}
	}
}

function usrBan(thatId, usrid, sessid) {
	myAJAX(
		{
			url: '/ajax/usrban.php',
			data: {
				usrid: usrid,
				sessid: sessid
			},
			onSuccess: function(e) {
				$(thatId).className = e;
			}
		}
	);
}
function usrChangeGroup(groupid, usrid, sessid) {
	myAJAX(
		{
			url: '/ajax/usrgr.php',
			data: {
				usrid: usrid,
				groupid: groupid,
				sessid: sessid
			}
		}
	);
}
function toggleDisplay(element) {
	element.style.display = element.style.display == 'block' ? 'none' : 'block';
}

window.onload = function() {
	hovertable();
}
