
window.onload = function() {
	var anchors = document.getElementsByTagName('a');
	for (var i = 0; i < anchors.length; i++) {
		var a = anchors[i];
		if (a.className && a.className == 'projectimage') {
			var images = a.getElementsByTagName('img');
			if (images && images.length > 0) {
				var img = images[0];
				a.onmouseover = projectImageMouseOver;
				a.onmouseout = projectImageMouseOut;
			}
		}
	}
	
	var headings = document.getElementsByTagName('h1');
	for (var i = 0; i < headings.length; i++) {
		var h1 = headings[i];
		var homeUrl = document.getElementById('namelink').href;
		h1.onclick = function() {
			window.location = homeUrl;
		}
	}
}

function projectImageMouseOver() {
	var img = this.getElementsByTagName('img');
	if (img && img.length > 0) {
		img = img[0];
		img.src = img.src.replace('thumbs/', 'thumbs/highlight/');
	}
}

function projectImageMouseOut() {
	var img = this.getElementsByTagName('img');
	if (img && img.length > 0) {
		img = img[0];
		img.src = img.src.replace('thumbs/highlight/', 'thumbs/');
	}
}
