window.addEvent('domready', function(){

	//-vertical default	
	var mySlide1 = new Fx.Slide('nav_shadowed_1', {duration: 200, wait:false, link: 'cancel'}).hide();
	document.id('nav1_case').addEvent('mouseenter', function(){
		mySlide1.slideIn();
	});
	document.id('nav1_case').addEvent('mouseleave', function(){
		mySlide1.slideOut();
	});
	
	var mySlide4 = new Fx.Slide('nav_shadowed_4', {duration: 200, wait:false, link: 'cancel'}).hide();
	document.id('nav4_case').addEvent('mouseenter', function(){
		mySlide4.slideIn();
	});
	document.id('nav4_case').addEvent('mouseleave', function(){
		mySlide4.slideOut();
	});
});
	
function increaseContainerHeight(id, x) {
	document.getElementById(id).style.height = x+'px';
	window.setTimeout(function(){document.getElementById(id+'_shadow').style.visibility = 'visible';},100);
}

function decreaseContainerHeight(id, x) {
	document.getElementById(id).style.height = x+'px';
	window.setTimeout(function(){document.getElementById(id+'_shadow').style.visibility = 'hidden';},10);
}

function swapNavComponentImageSrc(id, state) {
	if (state == 'on') {
		document.getElementById(id).src = '/img/nav/'+id+'_over.gif';
	} else {
		document.getElementById(id).src = '/img/nav/'+id+'.gif';
	}
}

function alterNavSubItem(id, state) {
	if (state == 'on') {
		document.getElementById(id).style.backgroundColor = '#000000';
		document.getElementById(id+'_link').style.color = '#ffffff';
	} else {
		document.getElementById(id).style.backgroundColor = '#ffffff';
		document.getElementById(id+'_link').style.color = '#000000';
	}
}


function containsDOM (container, containee) {
  var isParent = false;
  do {
    if ((isParent = container == containee))
      break;
    containee = containee.parentNode;
  }
  while (containee != null);
  return isParent;
}

function checkMouseEnter (element, evt) {
	if (element.contains && evt.fromElement) {
    return !element.contains(evt.fromElement);
  }
  else if (evt.relatedTarget) {
    return !containsDOM(element, evt.relatedTarget);
  }
}

function checkMouseExit (element, evt) {
  if (element.contains && evt.toElement) {
    return !element.contains(evt.toElement);
  }
  else if (evt.relatedTarget) {
    return !containsDOM(element, evt.relatedTarget);
  }
}

