var itv;
var rndon = 1;
var rndmax = 3;
function showprocess(i) {
	stoprnd();
	var j = $('processpic');
	if (i=='mig') {
		j.style.backgroundPosition = 'left top';
	} else if (i=='stick') {
		j.style.backgroundPosition = '-1142px top';
	} else if (i=='tig') {
		j.style.backgroundPosition = '-571px top';
	} else if (i=='engine') {
		j.style.backgroundPosition = '-1713px top';
	} else if (i=='plasma') {
		j.style.backgroundPosition = '-2284px top';
	} else if (i=='notsure') {
		j.style.backgroundPosition = '-2855px top';
	}
	j.style.display = 'block';
}
function showrnd() {
	$('processpic').setStyle('display', 'none');
	startrnd();
}
function nextrnd() {
	rndon++;
	if (rndon>rndmax) rndon = 1;
	$('mainarea').style.backgroundImage = "url('images/index/random" + rndon + ".jpg')";
}
function startrnd() {
	itv = nextrnd.periodical(5000);
}
function stoprnd() {
	$clear(itv);
}
function cleanup() {
	$ES('a', 'processes').each(function(i){
		i.onmouseover = Class.empty;
		i.onmouseout = Class.empty;
	});
	stoprnd();
}

window.addEvent('beforeunload', cleanup);
