$(document).ready(function() {
	/*
	
        var theWindow        = $(window),
            $bg              = $("#bg"),
            
            aspectRatio      = $bg.attr("w") / $bg.attr("h");
		console.log($bg.attr("w")+"w<--->h"+$bg.attr("h"));
        function resizeBg() {
  		console.log(theWindow.width()+"window<--->hwindow"+theWindow.height());
                if ( (theWindow.width() / theWindow.height()) > aspectRatio ) { 
                    $bg 
                        .removeClass()
                        .addClass('bgheight');
                      
                } else {
                    $bg
                        .removeClass()
                        .addClass('bgwidth');                      
                }

        }

        theWindow.resize(function() {
                resizeBg();
        }).trigger("resize");

*/

	
	
	
	//menu hover
	$('#menu').bind("mouseleave",function(){
		$('#menu li').each(function() {   
			if(!$(this).hasClass('active')) { 
				$(this).find('.subMenu').fadeOut(500, function(){
					$(this).parent().parent().find(".active").delay(500).fadeIn("slow");
				});
			}
		});
	});


	$('#menu .mainMenu').hoverIntent(function() {
		var current = $(this).parent().html();
		$('#menu li').each(function() {
			// slideUp all but the active + current
			var looper = $(this).html();
			//alert(looper);
			if(looper!=current) {
				$(this).find('.subMenu').fadeOut(500, function(){
					//$(this).parent().find(".active").delay(500).fadeIn();
				});//.parent().parent().find(".active").fadeIn;				
			}	
		});
		$(this).parent().find('.subMenu').fadeIn();
	  },function(){});
	  
	//socialLogo hover
	
	$('#socials').bind("mouseleave",function(){
		$('#socials div').each(function() { 			
				$(this).find('div').delay(500).fadeOut();				
		});
	});


	$('#socials').hoverIntent(function() {
		var current = $(this).parent().html();
		$('#socials div').each(function() {   
			// slideUp all but the active + current
			var looper = $(this).html();
			//alert(looper);
			if(looper!=current) {
				$(this).find('div').fadeOut();
			}	
		});
		$(this).parent().find('div').fadeIn();
	  },function(){});
	  
	 
        
       
	  
	 
	
	
	 $("#blockOrange").hoverIntent( function(){ 		
		if($(this).height()!=291){
		$("#blockImage").fadeOut(500);
		$(this).stop().animate({
			height:'291px'
		},800,function(){
			$("#aveqFormRowVariabele3_126_1").fadeIn();
			$("#aveqFormRowVariabele1_126_1").fadeIn();
			$("#submitForm_126_1").fadeIn();
			$("label[class=error]").css("margin-top", "-21px");			
			//$("label[class=error]").fadeIn();
			
		});
		}
	 },function(){
	 	;
	 	if($(document.activeElement).attr("type")!="textarea" && $(document.activeElement).attr("type")!="text"){ 
			$("#aveqFormRowVariabele3_126_1").fadeOut();
			$("#aveqFormRowVariabele1_126_1").fadeOut();
			$("#submitForm_126_1").fadeOut();
			$("label[class=error]").fadeOut();
			$("#blockImage").fadeIn(500);
			$(this).stop().animate({
				height:'100px'
			},800,function(){
				});	
		}	
	 });
	 
	 
	 var option = {
			  x:      0, 
			  y:      0, 
			  radius: 5,
			  color:  "#000000"
			}
			$("h1").textShadow( option );
			
			
	//Nieuws cycle//
	$('#nieuwsCycle').cycle({ 
	    fx:     'fade', 
	    speed:  'slow', 
	    timeout: 6000	   
	});
	
	//fotos cycle
	$('#cycle').before('<div id="nav">').cycle({ 
	    fx:     'fade', 
	    speed:  'slow', 
	    timeout: 6000, 
	    pager:  '#nav' 
	});
	
	if($("#middleCol #cycle").attr("id") ){
		$("#middleCol").hoverIntent(function() { 		
			$("#rightCol").fadeOut(500);
			$("#cycle").stop().children().animate({ 
				width: '+=220px'			
			}, 800, function() {
				// Animation complete.
			});
			
		 },function(){
		 	//first check if the mouse didnt go to the navigation	 	
		 	$("#rightCol").delay(800).fadeIn(800);
			$("#cycle").children().animate({ 
				width: '-=220px'			
			}, 800, function() {
				// Animation complete.
			});
		 }); 
	}
	 
	 
	$("a[rel^='prettyPhoto']").prettyPhoto({theme: 'light_square'});
	
	var option = {
	  x:      0, 
	  y:      0, 
	  radius: 5,
	  color:  "#000000"
	}

	$("#middleCol h1").textShadow( option );



	//verberg labels en stop ze in de inputs
	text= $("[for=Variabele2_126_1]").hide().html();	
	$("#Variabele2_126_1").val("").click(function(){
		$(this).css("background-image","none");
		//$(this).select();
	});
	
	text= $("[for=Title_126_1]").hide().html();	
	$("#Title_126_1").val("").click(function(){
		$(this).css("background-image","none");
		//$(this).select();
	});
	
	//home blokken animeren	
	
	$('#blockBigHorizontal_over, #blok1_over, #blok2_over, #blockBigger_over').bind("mouseleave",function(){
		$(this).children().fadeIn();
	});	
	
	$("#blockBigHorizontal,  #blok1, #blok2, #blockBiggerImage").hoverIntent(function(){ //alert('test');
		$(this).fadeOut();
	},function(){		
	});	
	
	
		
	$("#blockBigGrey_vscrollerbase").append("<div class=arrow></div>");
	
});




