jQuery(document).ready(setupInfoBalloons);
jQuery(document).ready(setupMenuHover);

function homePicFade(){
	document.getElementById('slide').style.opacity=1;
	fadeOut();
}

function fadeOut(){
	document.getElementById('slide').style.opacity-=0.05;
	if(document.getElementById('slide').style.opacity>0){
		uit= setTimeout("fadeOut()",100);
	} else {
		clearTimeout(uit);
		aan=setTimeout("fadeIn()",100);
	}
}

function fadeIn(){
	document.getElementById('slide').style.opacity=parseInt(document.getElementById('slide').style.opacity,10)+0.05;
	if(document.getElementById('slide').style.opacity<1){
		aan= setTimeout("fadeIn()",100);
	} else {
		clearTimeout(aan);
		uit=setTimeout("fadeOut()",100);
	}
}


function setupInfoBalloons() {
	jQuery(document).click(function () {
		jQuery('.textballoon').hide();
	});


	jQuery('.infoicon').click(function(){
		elemBalloon = document.getElementById(this.rel);
		elemBalloon.style.display = 'block';
		elemBalloon.style.left = (getPosition(this).left + 15) + 'px';
		elemBalloon.style.top = (getPosition(this).top - elemBalloon.offsetHeight - 5) + 'px';
		//setTimeout('elemBalloon.style.display="none"',1000);

		return false;
	});
}
function setupMenuHover() {
   jQuery('#navlist a').hover(
      function () {
         var jParent = jQuery(this).parent();
         if (!jParent.hasClass('hover')) {
            jParent.addClass('hover');
         }
      },
      function () {
         var jParent = jQuery(this).parent();
         if (jParent.hasClass('hover')) {
            jParent.removeClass('hover');
         }
      }
   );
}