// JavaScript Document to make the divs with article thumbnails clickable

// uses getelementbyclassname and addloadevent from common.js

function prepareBoxes() {
	var boxes = getElementsByClassName(document, "div", "art_articleImage");
	for (var i=0; i<boxes.length; i++){
		var articleLinks = getElementsByClassName(document, "div", "art_articleImage");
		for (var k=0; k<articleLinks.length; k++){
			articleLinks[k].parentNode.tabIndex = k+1;
			articleLinks[k].onclick = function() {
				var destin = this.getElementsByTagName("a");
				window.location = destin[0].href;
			}
			//articleLinks[k].onmouseover = function() {
				//window.location = destin[0].href;
			//}
			//articleLinks[k].onmouseout = function() {
				//window.status = '';
			//}
			articleLinks[k].onkeypress = articleLinks[k].onclick;
		}
	}
	var featuredbox = getElementsByClassName(document, "div", "art_featuredImage");
	for (var x=0; x<featuredbox.length; x++){
		var featuredArticleLink = getElementsByClassName(document, "div", "art_featuredImage");
		for (var y=0; y<featuredArticleLink.length; y++){
			featuredArticleLink[y].parentNode.tabIndex = y+1;
			featuredArticleLink[y].onclick = function() {
				var featuredDestination = this.getElementsByTagName("a");
				window.location = featuredDestination[0].href;
			}
			featuredArticleLink[y].onkeypress = featuredArticleLink[y].onclick;
		}
	}
}
addLoadEvent(prepareBoxes);