// ALGEMEEN


function slideSwitch(target) {
                var current = $(target + ' .slide:eq(0)');
                var next = $(target + ' .slide:eq(1)');
                $(target).append(current);
                next.fadeIn(1100);
                current.fadeOut(1100);
            }

$(function() {

	 setInterval("slideSwitch('#mySlideShow')", 5000 );

	$(".lang").fadeTo("fast", 0.8);

	$(".lang").hover(function(){
			$(this).fadeTo("fast", 1); // This sets the opacity to 100% on hover
		},function(){
   			$(this).fadeTo("fast", 0.8); // This sets the opacity back to 95% on mouseout
		});
				
		
	$("ul.sf-menu").supersubs({ 
            minWidth:    12,   // minimum width of sub-menus in em units 
            maxWidth:    27,   // maximum width of sub-menus in em units 
            extraWidth:  1     // extra width can ensure lines don't sometimes turn over 
                               // due to slight rounding differences and font-family 
        }).superfish();  // call supersubs first, then superfish, so that subs are 
                         // not display:none when measuring. Call before initialising 
                         // containing tabs for same reason. 	
	
		
	$("#companyselect").live("click",function(){
		$("#companiesdiv").slideDown("slow");
		//alert("TEST");
	});
	$("#companiesdiv").mouseleave(function() {
    	$("#companiesdiv").slideUp("fast");
    });
	
	$("#zoeken").live("click",function(){
		
		var keywords=$("#zoekveld").val();
		keywords=keywords.replace(/^\s\s*/, '').replace(/\s\s*$/, '');
		$("#zoekveld").val(keywords);
		var keywordslength=keywords.length;
		if (keywordslength>2) {
			$("#zoekform").submit();
		} else {
			$("#zoekveld").css('color', 'red')
			$("#zoekveld").focus();	
		}
		//alert("TEST");
	});
		
});




