// JavaScript Document

var isIE = /MSIE (\d+\.\d+);/.test(navigator.userAgent);

var $$ = function(id) {
  return document.getElementById(id);
};

function checkDivHovers() {
  var allDivs = document.getElementsByTagName("DIV");
  for (var i = 0; i < allDivs.length; i++) {
    if (allDivs[i].className && allDivs[i].className.indexOf('section-box') != -1) {
	  if (isIE) allDivs[i].style.zoom = 1;
	  allDivs[i].onmouseover = function() {
	    this.style.backgroundColor = '#f0f0f0';
		var img = $$(this.getAttribute('rel'));
		if (img) {
		  img.src = img.src.toString().replace(/.jpg/, '-hover.jpg');
		}
	  };
	  allDivs[i].onmouseout = function() {
	    this.style.backgroundColor = '#fff';
		var img = $$(this.getAttribute('rel'));
		if (img) {
		  img.src = img.src.toString().replace(/-hover.jpg/, '.jpg');
		}
	  };
	  if (allDivs[i].getAttribute("rel") && allDivs[i].getAttribute("rel").indexOf("vp2") == -1) {
		allDivs[i].onclick = function() {
	      var linkHref = this.getElementsByTagName("A")[0];
		  if (linkHref) {
		    window.location = linkHref.href;
		  }
	    };
	  }
	}
  }
}

if (window.attachEvent) { 
  window.attachEvent("onload", checkDivHovers); 
} 
else {  
  window.addEventListener("load", checkDivHovers, false); 
}

function openMenu(menuIndex) {
  var theMenu = $$('kids' + menuIndex);
  if (theMenu) {
    theMenu.style.display = theMenu.style.display == 'block' ? 'none' : 'block';
	return false;
  }
  return true;
}