function highlightClass(image) {
	image.src = image.src.replace('off', 'on');
}

function unhighlightClass(image) {
	image.src = image.src.replace('on.gif', 'off.gif');
}

function hoverThumb(thumb, type) {
	// update thumb
	thumb.src = thumb.src.replace('_off', '_on');
	
	// update window
	var windowImg = getElement(type + '_window').getElementsByTagName('img')[0];
	windowImg.src = thumb.src.replace('_on', '');
}

function unhoverThumb(thumb, type) {
	// update thumb
	thumb.src = thumb.src.replace('_on', '_off');
}

function rotateImg(direction, type) {
	if (type == 'screenshots') {
		var max = 28;
	} else {
		var max = 12;
	}
	var currentImg = getElement(type).getElementsByTagName('img')[0];
	var re = /(\d+)(_hp)*.jpg/;
	var currentNum = re.exec(currentImg.src)[1];
	if (direction == 'right') {
		var newNum = parseInt(currentNum, 10) + 1;
		if (newNum > max) {
			newNum = 1;
		}
	} else {
		var newNum = parseInt(currentNum, 10) - 1;
		if (newNum < 1) {
			newNum = max;
		}
	}

	if (newNum < 10) {
		newNum = '0' + newNum;
	}

	currentImg.src = currentImg.src.replace(currentNum, newNum);
	if (typeof currentImg.parentNode.href != 'undefined') {
		currentImg.parentNode.href = currentImg.parentNode.href.replace(currentNum, newNum);
	}
}

