$(document).ready(function() {
	
	$("a#projectImg").fancybox({
				
			});
	$("a.beeldbankImg").fancybox({
				'titlePosition'  : 'inside'
			});

	$("a#ClienLoginLink").fancybox({'titleShow': false, 'width':400, 'height': 250});
	
	$(".article .homeslide h4").dropShadow({"color":"white","left":2,"top":2,"opacity":0.5});

	
	
	
/*	
  $("#query").tweet({
          avatar_size: 32,
          count: 4,
          query: "late avond idealen",
          loading_text: "searching twitter..."
        });


	//$("a#inlog").fancybox({ 'frameWidth': 550, 'frameHeight': 300});
	$("a.medium").fancybox({
		'frameWidth': 570, 
		'frameHeight': 330,
		'callbackOnClose':function() {
                location.reload(); 
                } 
		}); 
	//$("a#logout").fancybox({ 'frameWidth': 550, 'frameHeight': 300}).trigger('click');
	$("a.imagePop").fancybox({
		'zoomSpeedIn'			: 500,
		'zoomSpeedOut'			: 500,
		'imageScale': true
		 }); 
	$("a.offline").click(function(){
		$(this).blur();
		event.preventDefault();
	}); 
	$("a.maxi").fancybox({
		'frameWidth': 570, 
		'frameHeight': 430,
		'callbackOnClose':function() {
                //location.reload(); 
                } 
	}); 
	
	$('#toolbox .print a').click(function(){
			print();
			return false;
		});
		
		
//		// default options
		//$(".mp3").jmp3();
		// custom options
		$(".mp3").jmp3({
			backcolor: "000000",
			forecolor: "00ff00",
			width: 200,
			showdownload: "false",
			showfilename: "false"
		});
	function changeAction(frm){
		frm.action='';
	}
	
	
	*/
	
	// uitgelicht
	var idBlockInt=1;
//	var maxBlocks=Number( $("#uitgelicht .navigatie a:last").text() ) ;
	var maxBlocks=Number($(".homeslide #slide_navi li").length) ;
//	alert(maxBlocks);
	var timeoutID;
//	$("#uitgelicht .navigatie a").click(function(event){
	$(".homeslide #slide_navi li a").click(function(event){
//	idBlockInt=Number($(this).text());	
		idBlockInt=Number($(this).attr("num"));		
		clearTimeout(timeoutID);
		
		showHomeItem();
		event.preventDefault();
		this.blur();
	});
	function showHomeItem(){
		//alert(idBlockInt);
		var idBlock="uitL"+idBlockInt.toString();
		// zet de boxen uit en de nieuwe aan
		
//		$(".uitgelichtbox").fadeOut("slow");
		$(".uitgelichtbox").hide();
//		$("#"+idBlock).fadeIn("slow");
		$("#"+idBlock).show();
		
		$(".article .homeslide h4").redrawShadow(); 
		
		// set de juiste navigatie bolletje aan
		$(".homeslide #slide_navi li a").removeClass("active");

		$(".homeslide #slide_navi li a").each(function (i){
        //if ( $(this).text() == idBlockInt ){
        
        if ( $(this).attr("num") == idBlockInt ){
          $(this).addClass("active");
        }
     });
      
		// 
		timeout();
	}
	function timeout(){
		timeoutID=setTimeout(function() { 
			idBlockInt++;
			if(idBlockInt > maxBlocks) idBlockInt=1;
			showHomeItem();
			//timeout();
			 }, 8000); 
	}
	if(maxBlocks > 1)	timeout();
	
	
	var mainH = $("#main").height();
	function resizePage() 
		{
		    var h = $(window).height();
		    var hEffectief=h-(145+60);
		    $("#main").height(Math.max(mainH, hEffectief));
		}
		resizePage();
		jQuery.event.add(window, "resize", resizePage);
	
});