/* CREDITS
 * ----------------------------------------------------------
 * Title:  Main JavaScript file
 * ----------------------------------------------------------
 * Inventis - Web Architects - We design the Web!
 * www.inventis.be
*/
$(document).ready(function(){

	/* FancyBox */
	$('a[rel=lightbox]').fancybox({
		titlePosition		: 'over',
		hideOnContentClick	: true,
		centerOnScroll		: true
	})
	
	/* Menu memory hover states */
	if(!$.browser.msie || $.browser.msie && $.browser.version.substr(0,1)>7){
		if(!$('body.home').length){
			var currentActive = $('nav a.active').parents('li').attr('class') || '';
			$('nav > ul > li').mouseenter(function(){
				if(!$(this).children('a:first').hasClass('active')){
					$('nav a.active').removeClass('active');
					$(this).children('a:first').addClass('active');
				}
			});
			$('nav > ul > li').mouseleave(function(){
				$('nav a.active').removeClass('active');
				$('nav li.'+currentActive+' a:first').addClass('active');
			});
		}
	}
	
	/* Sfhover for IE6 */
	sfHover = function() {
		var sfEls = document.getElementsByTagName("nav")[0].getElementsByTagName("LI");
		for (var i=0; i<sfEls.length; i++) {
			sfEls[i].onmouseover=function() {
				this.className+=" sfhover";
			}
			sfEls[i].onmouseout=function() {
				this.className=this.className.replace(new RegExp(" sfhover\\b"), "");
			}
		}
	}
	if (window.attachEvent) window.attachEvent("onload", sfHover);


});
