﻿function hoverEffect(imgObject) {
	
	imgObject.src = 'img/buttons/' + getButtonName(imgObject.src) + '-hover.png';
	
}

function undoHoverEffect(imgObject) {
	
	imgObject.src = 'img/buttons/' + getButtonName(imgObject.src) + '.png';


}

// takes 'some/path/button-name.png' and returns 'button-name'
function getButtonName(pathArg) {
	
	var path = pathArg.toString();
	
	path = path.substring(path.lastIndexOf('/') + 1);
	if (path.indexOf('-') == -1) {
		path = path.substring(0, path.indexOf('.png'));
	} else {
		path = path.substring(0, path.indexOf('-'));
	}
	
	return path;
	
	
}