function initBoxes(parentid) {
	var rootnode = document.getElementById(parentid);
	var nodelist = rootnode.getElementsByTagName('div');
	for(var i=0; i<nodelist.length; i++) {
		var divnode = nodelist[i];
		if(divnode.className.indexOf('box') > -1) {
			divnode.onmouseover = function() {
					this.className += " over";
  			}
  			divnode.onmouseout = function() {
  				this.className = this.className.replace(" over", "");
   		}
			divnode.onclick = function() {
				var pars = this.getElementsByTagName('p');
  				var boxurl = pars[pars.length - 1].firstChild.getAttribute('href');
				window.location = boxurl;
   		}
		}
	}
}

function initPlus() {
	var rootnode = document.getElementById('plus');
	var nodelist = rootnode.getElementsByTagName('a');
	for(var i=0; i<nodelist.length; i++) {
		var anode = nodelist[i];
		anode.onmouseover = function() {
			this.parentNode.className = 'plus active';
   	}
		anode.onmouseout = function() {
			this.parentNode.className = 'plus';
   	}
	}
}

function initLang() {
	var langbox = document.getElementById('lang');
	if (langbox) {
		langbox.onmouseover = function() {
			this.className = 'langover';
		 }
		langbox.onmouseout = function() {
			this.className = '';
		 }
	}
}

window.onload = function() {
	if(document.getElementById('boxes1')) initBoxes('boxes1');
	if(document.getElementById('boxes2')) initBoxes('boxes2');
	if(document.getElementById('plus')) initPlus();
	if(document.getElementById('lang')) initLang();
}
