var infoTimer = 0;

function overRow(r,c){
	if (!r.style) return
	r.style.backgroundColor = c?c:'#f4ff98';
}

function outRow(r,c){
	if (!r.style) return
	r.style.backgroundColor = c?c:'';
}

function overInfo(cell, server, erracc, errcontent, check, success)
{
	var pos = elementPosition(cell)
	pos.x += cell.offsetWidth-10
	pos.y += cell.offsetHeight-10
	if (infoTimer) {clearTimeout(infoTimer); infoTimer = 0;}
	infoTimer = setTimeout("overInfoShow('"+server+"','"+erracc+"','"+errcontent+"','"+check+"','"+success+"','"+pos.x+"','"+pos.y+"')", 100)
}

function overInfoShow(server, erracc, errcontent, check, success,x,y)
{
	var tip = document.all['tipLayer']
	if (!tip) return;
	check = check?check:'-'
	success = success?success:'-'
	tip.innerHTML = "<b>"+server+"</b><br>Access error: "+erracc+"<br>Invalid content: "+errcontent+"<br>Success: "+success+"<br>Check: "+check
	tip.style.left = parseInt(x)
	tip.style.top = parseInt(y)
}

function outInfo()
{
	if (infoTimer) {clearTimeout(infoTimer); infoTimer = 0;}
	var tip = document.all['tipLayer']
	if (!tip) return;
	tip.style.left = -1000
	tip.style.top = -1000
}

function elementPosition(p)
{
	var r = {'x':0,'y':0};

	var rp = p.offsetParent;
	if (rp == null)
		return r;

	r.x = p.offsetLeft;
	r.y = p.offsetTop;

	while (true)
	{
		r.x += rp.offsetLeft;
		r.y += rp.offsetTop;
		rp = rp.offsetParent;
		if (rp == null)
			break;
	}	
	return r;
}

function onSelectAll(){
	var state = document.all['cbAll'].checked
	for (var i=0; i<document.all['cb'].length; i++){
		document.all['cb'][i].checked = state;
	}
}

function decode(s)
{
	var a = s.split(",")
	var r = "";
	for (var i=0; i<a.length; i++){
		r += String.fromCharCode((a[i]-1))
	}
	document.write(r)
}


