$(document).ready(function() {
	
	function megaHoverOver(){
		$(this).find(".sub").stop().fadeTo('fast', 1).show();
		
		
			
		//Calculate width of all ul's
		(function($) { 
			jQuery.fn.calcSubWidth = function() {
				rowWidth = 0;
				//Calculate row
				$(this).find("ul").each(function() {					
					rowWidth += $(this).width(); 
				});	
			};
		})(jQuery); 
		
		if ( $(this).find(".row").length > 0 ) { //If row exists...
			var biggestRow = 0;	
			//Calculate each row
			$(this).find(".row").each(function() {							   
				$(this).calcSubWidth();
				//Find biggest row
				if(rowWidth > biggestRow) {
					biggestRow = rowWidth;
				}
			});
			//Set width
			$(this).find(".sub").css({'width' :biggestRow});
			$(this).find(".row:last").css({'margin':'0'});
			
			
			
		} else { //If row does not exist...
			
			$(this).calcSubWidth();
			//Set Width
			$(this).find(".sub").css({'width' : rowWidth});
			
			
			
		}
	}
	$(".video").click(function() {
		$.fancybox({
			'padding'		: 8,
			'autoScale'		: false,
			'transitionIn'	: 'none',
			'transitionOut'	: 'none',
			'title'			: this.title,
			'width'			: 640,
			'height'		: 385,
			'href'			: this.href.replace(new RegExp("watch\\?v=", "i"), 'v/'),
			'type'			: 'swf',
			'swf'			: {
			'wmode'				: 'transparent',
			'allowfullscreen'	: 'true'
			}
		});

		return false;
	});
	function megaHoverOut(){ 
	  $(this).find(".sub").stop().fadeTo('fast', 0, function() {
		  $(this).hide(); 
	  });
	}


	var config = {    
		 sensitivity: 1, // number = sensitivity threshold (must be 1 or higher)    
		 interval: 100, // number = milliseconds for onMouseOver polling interval    
		 over: megaHoverOver, // function = onMouseOver callback (REQUIRED)    
		 timeout: 0, // number = milliseconds delay before onMouseOut    
		 out: megaHoverOut // function = onMouseOut callback (REQUIRED)    
	};

	//$("ul#topnav li .sub").css({'opacity':'50'});
	//$("ul#topnav li .sub").css({'filter':'alpha(opacity=50)'});
	//$("ul#topnav li .sub").css({'-moz-opacity':'0.5'});
	//$("ul#topnav li .sub").css({'-khtml-opacity':'0.5'});
	//$("ul#topnav li .sub").css({'opacity':'0.5'});
	

	$("ul#topnav li").hoverIntent(config);
	



});



$(document).ready(function() {		
	
	$(".carousel").jCarouselLite({       
		btnNext: ".next",
        btnPrev: ".prev",
		scroll: 3
	});
});




$(document).ready(function() {
	
	var defaultCount = 5;
	var defaultAvatarSize = 48;
	var defaultText = "<img src='/gfx/loading.gif' style='margin-left: 63px;'>";
		$("#all").tweet({
			join_text: "auto",
			username: "vanpeltcoiffure",
			list: "van-pelt",
			avatar_size: defaultAvatarSize,
			count: 5,
			auto_join_text_default: "", 
			auto_join_text_ed: "",
			auto_join_text_ing: "",
			auto_join_text_reply: "",
			auto_join_text_url: "",
			loading_text: defaultText,
			refresh_interval : null
		  });
	});

	
	
	
	
		
	
			$(document).ready(function() {
			/*
			*   Examples - images
			*/

			$("a.fancybox").fancybox( {
			'overlayColor'		: '#000',
			'overlayOpacity'	: 0.7,
			'padding'		: 0,
			'autoScale'		: false,
			
		
			'width'			: 944,
			'height'		: 600,
			 'scrolling'   : 'auto', 
			'type'			: 'iframe',
			'centerOnScroll': 'centerOnScroll',
			
			'transitionIn'	: 'elastic',
			'transitionOut'	: 'elastic'
			});
			

			 $('#slideshow').cycle({
				fx: 'scrollHorz',
				startingSlide: 2,  // start on the slide that was in the markup
				timeout:  0,
				speed:    500,
				prev:    '#prev',
				next:    '#next',
			   
			});
		});




	//Start anti rechtermuisknop script.
	var msg_box ="© Van Pelt Coiffure Beauté\n AVANT Internet BV";

	function dis_rightclickIE(){
		if (navigator.appName == 'Microsoft Internet Explorer' && (event.button == 2 || event.button == 3))
		alert(msg_box)
	}

	function dis_rightclickNS(e){
		if ((document.layers||document.getElementById&&!document.all) && (e.which==2||e.which==3))
		{
			alert(msg_box)
			return false;
		}
	}

	if (document.layers){
		document.captureEvents(Event.MOUSEDOWN);
		document.onmousedown=dis_rightclickNS;
	}
	else if (document.all&&!document.getElementById){
		document.onmousedown=dis_rightclickIE;
	}
	document.oncontextmenu=new Function("alert(msg_box);return false")
	//Einde anti rechtermuisknop script

