function addLoadEvent(func) {
	var oldonload = window.onload;
	if (typeof window.onload != 'function') {
		window.onload = func;
	}
	else {
		window.onload = function() {
			oldonload();
			func();
		}
	}
}

function getElementsByClass(searchClass,node,tag) {
	var classElements = new Array();
	if ( node == null )
		node = document;
	if ( tag == null )
		tag = '*';
	var els = node.getElementsByTagName(tag);
	var elsLen = els.length;
	var pattern = new RegExp('(^|\\s)'+searchClass+'(\\s|$)');
	for (i = 0, j = 0; i < elsLen; i++) {
		if ( pattern.test(els[i].className) ) {
			classElements[j] = els[i];
			j++;
		}
	}
	return classElements;
}

function rollover() {
	var imagesLinks = document.getElementById("kid-years").getElementsByTagName("a");
  var theKidImage = getElementsByClass("the-kid-image");
  
  if (theKidImage && theKidImage.length && theKidImage.length > 0) theKidImage = theKidImage[0];
  else return;
    
	for(var x=0; x< imagesLinks.length; x++) {
		var imageLink = imagesLinks[x];
		imageLink.onmouseover = function() {
				theKidImage.setAttribute("src", this.getAttribute("href"));
    }
	}
}

addLoadEvent(rollover);
