$(document).ready(function(){
	

	$('A[rel="uceeradio"]').click( function() {
      window.open( $(this).attr('href'),'uceeradio','width=420, height=540, location=no, menubar=no, status=no, toolbar=no, scrollbars=no, resizable=yes' );
      return false;
  });

	// submit form on change selectbox
	$('form #filtering').change(function () {
		$(this).parents('form').submit();
	});

	$("li.perronLi").hover(
      function () {
        $(this).addClass('hover');
      }, 
      function () {
      	$(this).removeClass('hover')
      }
    ).click(function () { 
    	//alert();
    	window.location.href=$(this).attr('_href');
      //$(this).slideUp(); 
    });
;


//		$("a.galleryImg").fancybox({
//				'titlePosition'  : 'inside'
//			});


//	zit nu in index.php
//	$(".radioReplace").dgStyle();

	
	// uitgelicht
	var idBlockInt=1;
	var maxBlocks=Number( $("#uitgelicht .navigation a:last").text() ) ;
	var timeoutID;
	$("#uitgelicht .navigation a").click(function(event){
		idBlockInt=Number($(this).text());	
		clearTimeout(timeoutID);
		showHomeItem();
		event.preventDefault();
		this.blur();
	});
	function showHomeItem(){
		var idBlock="uitL"+idBlockInt.toString();
		// zet de boxen uit en de nieuwe aan
		$(".uitgelichtbox").fadeOut("slow");
		$("#"+idBlock).fadeIn("slow");
		// set de juiste navigation bolletje aan
		$("#uitgelicht .navigation a").removeClass("active");
		//$("#uitgelicht .navigation a:contains('"+idBlockInt+"')").addClass("active");
		$("#uitgelicht .navigation a:contains('"+idBlockInt+"')").each(function (i){
        if ( $(this).text() == idBlockInt ){
          $(this).addClass("active");
        }
      });
      
		// 
		timeout();
	}
	function timeout(){
		timeoutID=setTimeout(function() { 
			idBlockInt++;
			if(idBlockInt > maxBlocks) idBlockInt=1;
			showHomeItem();
			//timeout();
			 }, 8000); 
	}
	if(maxBlocks > 1)	timeout();

	/*
	// slideshow
	var idBlockIntSl=1;
	var maxBlocksSl=Number( $("#slideshow .navigatie a:last").text() ) ;
	var timeoutIDSl;
	$("#slideshow .navigatie a").click(function(event){
		idBlockIntSl=Number($(this).text());	
		clearTimeout(timeoutIDSl);
		showHomeItemSl();
		event.preventDefault();
		this.blur();
	});
	function showHomeItemSl(){
		var idBlock="uitL"+idBlockIntSl.toString();
		// zet de boxen uit en de nieuwe aan
		$(".slideshowbox").fadeOut("slow");
		$("#"+idBlock).fadeIn("slow");
		// set de juiste navigatie bolletje aan
		$("#slideshow .navigatie a").removeClass("active");
		//$("#slideshow .navigatie a:contains('"+idBlockIntSl+"')").addClass("active");
		$("#slideshow .navigatie a:contains('"+idBlockIntSl+"')").each(function (i){
		//	alert($(this).text());
        if ( $(this).text() == idBlockIntSl ){
          $(this).addClass("active");
        }
      });
		
		timeoutSl();
	}
	function timeoutSl(){
		timeoutIDSl=setTimeout(function() { 
			idBlockIntSl++;
			if(idBlockIntSl > maxBlocksSl) idBlockIntSl=1;
			showHomeItemSl();
			//timeout();
			 }, 8000); 
	}
	if(maxBlocksSl > 1)	timeoutSl();

	
	
	
	
	
	jQuery('#mycarousel, #mycarouselProj').jcarousel(
    {
        scroll: 1
    }
    );
	
	
	
	
	
	
	
	
	function setPageHeight(){
		if(!document.getElementById) return false;
		var elrm=	document.getElementById("main");
		var rmhgt=document.documentElement.clientHeight-(420);
		// hier moet nog iets met Math.max() main en dus wat main zou moeten worden.
		elrm.style.height=Math.max(rmhgt,(elrm.clientHeight-50))+"px";
		//elrm.style.height=(rmhgt)+"px";
		// alert(rmhgt);
	}
	setPageHeight();
	*/
	/*
	setTimeout(function() {
        $('div.request').fadeOut();
    }, 5000); 
    */
	function setPageHeight(){
		if(!document.getElementById) return false;
		
		var docheight=$("body").height();
		var topEnFooter=350;
		var mainHeight=$("#content").height();
//		alert(docheight);
//		alert(topEnFooter);
//		alert(mainHeight);		
//		alert(docheight-(mainHeight+topEnFooter));
		$("#content").height(docheight-topEnFooter);
		
	}
	
	setPageHeight();
	//jQuery.event.add(window, "resize", setPageHeight);
});
