function hlrow(row) {
	row.className = 'hl';
}

function dhlrow(row) {
	row.className = '';
}

function go(id) {
	document.location.href = '?d=' + id;
	return true;
}

function xmlhttp() {
	var xmlhttp;
	/*@cc_on @*/
	/*@if (@_jscript_version >= 5)
	// JScript gives us Conditional compilation, we can cope with old IE versions.
	// and security blocked creation of the objects.
	try {
	xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
	} catch (e) {
	try {
	xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
	} catch (E) {
	xmlhttp = false;
	}
	}
	@end @*/
	if (!xmlhttp && typeof XMLHttpRequest!='undefined') {
		xmlhttp = new XMLHttpRequest();
	}
	return xmlhttp;
}

function load(url, elid) {
	var xh = xmlhttp();
	//	element.innerHTML = '<p><em>Loading ...</em></p>';
	xh.open("GET", url, true);
	xh.onreadystatechange = function() {
		if (xh.readyState == 4 && xh.status == 200) {
			var element = document.getElementById(elid);
			var elementi = document.getElementById(elid + 'inner');
			if (!element || !elementi)
				return;
			elementi.innerHTML = xh.responseText;
	//		alert(x + ' ' + y);
		//	element.style.left = x;
		//	element.style.top = y;
			element.style.display = "inline";
			element.style.visibility = "visible";
		}
	}
	xh.send(null);
}

var nohide = true;
var lines = 10;
var shift = 0;
var lastid = null;
var shifting = false;
var showerr = false;

function hideerr(really) {
	if (!really)
		return false;
	nohide = false;
	var t = 1000;
	if (really)
		t = 0;
	setTimeout(
	"if (!nohide) { "+
	"var element = document.getElementById('err');"+
	"element.style.display = 'none';"+
	"element.style.visibility = 'hidden';}"
		, t);
	return false;
}

function err(id) {
	var req = '?e=' + id + '&plain=1&c=' + lines + "&s=" + shift;
	if (!showerr)
		return false;
	if (id != lastid) {
		// reset values
		lastid = id;
		shift = 0;
		lines = 10;
	}
	nohide = true;
	load(req, 'err');
	return false;
}

/* start shift */
function errshift(diff, timeout) {
	if (!timeout)
		timeout = 250;
	if (timeout < 100)
		timeout = 50;
	shift += diff;
	err(lastid);
	shifting = true;
	setTimeout(
	"if (shifting) { "+
	" var to = " + timeout + " * 0.8;" +
	" errshift("+diff+", to);" +
	"}" , timeout);
	return;
}

function errexpand(diff) {
	lines += diff;
	if (lines < 10)
		lines = 10;
	err(lastid);
	return;
}

function stopshift() {
	shifting = false;
}

function enableshowerr() {
	showerr = true;
	document.getElementById('showerr').style.display = 'none';
	document.getElementById('showerr').style.visibility = 'hidden';
}

function show_vinfo(event, v) {
	// show extra information in popup
	el = document.getElementById('vinfo');
	el.style.display = "inline";
	el.style.visibility = "visible";
	el.innerHTML = v;
	el.style.left = event.clientX + 'px';
	el.style.top = event.clientY + 'px';
}

function hide_vinfo(event) {
	el = document.getElementById('vinfo');
	el.style.display = "none";
	el.style.visibility = "hidden";
}

var diffv = new Array('', '');
function diffsel(el) {
	var v = el.getAttribute('version');
	if (diffv[0] == '')
		diffv[0] = v;
	else {
		diffv[1] = diffv[0];
		diffv[0] = v;
	}
	var inp = document.getElementsByTagName("input");
	for(var i = 0; i < inp.length; i++) {
		if (!inp[i].getAttribute("version"))
			continue;
		var ver = inp[i].getAttribute('version');
		if ((diffv[0] == ver) || (diffv[1] == ver))
			continue;
		inp[i].checked = false;

	}
}

function dodiff() {
	document.location = '?diff[v1]=' + diffv[1] + '&diff[v2]=' + diffv[0];
}


