$(document).ready( function() {
		
	// -------------------------------------
	if($('ul.sf-menu').attr('id')){
		$('ul.sf-menu').superfish({ 
			hoverClass:    'sfHover',          // the class applied to hovered list items 
			pathClass:     'overideThisToUse', // the class you have applied to list items that lead to the current page 
			pathLevels:    1,                  // the number of levels of submenus that remain open or are restored using pathClass 
			delay:         800,                // the delay in milliseconds that the mouse can remain outside a submenu without it closing 
			animation:     {opacity:'show'},   // an object equivalent to first parameter of jQuery’s .animate() method 
			speed:         10,           		// speed of the animation. Equivalent to second parameter of jQuery’s .animate() method 
			autoArrows:    false,               // if true, arrow mark-up generated automatically = cleaner source code at expense of initialisation performance 
			dropShadows:   false,               // completely disable drop shadows by setting this to false 
			disableHI:     true,              // set to true to disable hoverIntent detection 
			onInit:        function(){},       // callback function fires once Superfish is initialised – 'this' is the containing ul 
			onBeforeShow:  function(){},       // callback function fires just before reveal animation begins – 'this' is the ul about to open 
			onShow:        function(){},       // callback function fires once reveal animation completed – 'this' is the opened ul 
			onHide:        function(){}        // callback function fires after a sub-menu has closed – 'this' is the ul that just closed 
		});
	}
	
	var zkDefVal = "";
		
	$('#quick_zoekform input').focus( function() {
		zkDefVal = $(this).val();
		$(this).val('');
	} );
	
	$('#quick_zoekform input').blur( function() {
		if($(this).val()==""){
			$(this).val(zkDefVal);
		}		
	} );
		
	
	/*$('.search').click( function() {
		$('#overlay').fadeIn();
		$('#search-form').fadeIn();
		$('#side .sign-in').addClass('fade');
	} );
	
	
	$('#search-form a').click( function() {
		$('#overlay').fadeOut();
		$('#side .sign-in').removeClass('fade');
	} );
	*/
	// -------------------------------------
	
	$('.support-list li .status').click( function() {//nevenactiviteiten
		
		var liActive = $(this).parent().hasClass('active');
		
		$(this).parents('ul').find("div[class='hidden']").removeClass('hidden').addClass('edit');
		$(this).parents('ul').find("div[class='edit2 visible']").removeClass('visible').addClass('hidden');
		$(this).parents('ul').find('li').removeAttr('class');
		if(!liActive) 
			$(this).parent().attr('class', 'active');
		
	} );
	
	// -------------------------------------
	
	$('#results tr')
		.mouseover( function() {
			$('tr.' + $(this).attr('class').replace(' ','.')).css('background-color', '#fee6ca');
		} )
		.mouseout( function() {
		    $('tr.' + $(this).attr('class').replace(' ', '.')).css('background-color', 'transparent');
		} )
		.click( function() {
		    document.location.href = $('tr.' + $(this).attr('class').replace(' ', '.')).find('a').attr('href');
			return false;
		} )
	
	// -------------------------------------
	
	// cookie?
	var fontSize = parseFloat($('#content .body').css('font-size'), 10);
	var fontSizes = { 'kleiner' : 0.9, 'normaal' : 1, 'groter' : 1.4 };
	
	$('.text-size a').click(function() {
		
		var newSize = $(this).attr('title');
		
		$('#content .body').css('fontSize', fontSize * fontSizes[newSize]);
		
	});
	
	// -------------------------------------
	
	if ($('#plaats').length > 0) {
		$('#plaats').autocomplete(plaatsen);
	}
	
	if ($('#provincie_search').length > 0) {
		$('#provincie_search').autocomplete(provincies);
	}
	// -------------------------------------
	
	// tooltip
	$('#content .icon').not('.bezet').tooltip({
		track: true, 
		delay: 0, 
		bodyHandler: function() {
			
			//20090203ZK
			var toolid = $(this).attr('class').substr(5);
			if(toolid=='amount geen-vrijw') toolid = 'amount';
			return $('#' + toolid).html();
			//return $('#' + $(this).attr('class').substr(5)).html();
			
		}, 
		fixPNG: true
	});
	
	// -------------------------------------
	var isIE = jQuery.browser.msie;
	var version = parseInt(jQuery.browser.version);


	if(!(isIE && version==6)){
		$('#search-box').pngfix();
	}	
	
	
	// IE6 pngtjes
	$('#leaderboard img').pngfix();
	$('#logo').pngfix();
	$('#overlay').pngfix();
	$('#side .button, #side img, #sub .button').pngfix();
	$('.box-top, .box-bottom, .box-details-bottom, .box h4').pngfix();
	$('#func-buttons li, .toolkit-list li').pngfix();
	$('.submit, .icon, .support-link, .promo, .close, .wijzigen').pngfix();
	
	$('#func-buttons li.text-size').pngfix();
	$('#func-buttons li.print-page').pngfix();
	$('#func-buttons li.mail-friend').pngfix();
	$('#func-buttons li.back').pngfix();
	$('#func-buttons li.join, #func-buttons li.report').pngfix();
	$('#func-buttons li.report').pngfix();
	$('#sub .search').pngfix();
	$('#sub .sign-in').pngfix();
	$('#stepForm input[type=button]').pngfix();
	$('#stepForm input[type=submit]').pngfix();
	
	//Max 200 chars in textareas
	$('#canvas textarea').not($('#canvas #aanmelden-intermediair #omschrijving, #canvas #aanmelden-intermediair #organisatie_beschrijving, #klus-omschrijving, #stepForm, #input14')).keyup(function(event){
		if($(this).val().length > 199){
			$(this).val( $(this).val().substring(0,199) ).focus(); 
			alert('Het veld mag maximaal 200 karakters bevatten.');
		}
		return this;
	}).change(function(){
		if($(this).val().length > 199){
			$(this).val( $(this).val().substring(0,199) ).focus(); 
			alert('Het veld mag maximaal 200 karakters bevatten.');
		}
		return this;
	});
	
	$('#canvas #aanmelden-intermediair #omschrijving, #canvas #aanmelden-intermediair #organisatie_beschrijving, #klus-omschrijving, #stepForm, #input14').keyup(function(event){
		if($(this).val().length > 299){
			$(this).val( $(this).val().substring(0,299) ).focus(); 
			alert('Het veld mag maximaal 300 karakters bevatten.');
		}
		return this;
	}).change(function(){
		if($(this).val().length > 299){
			$(this).val( $(this).val().substring(0,299) ).focus(); 
			alert('Het veld mag maximaal 300 karakters bevatten.');
		}
		return this;
	});
	
	//Max 200 chars in input[type=text]
	$('#canvas input[type=text]').keyup(function(event){
		if($(this).val().length > 199){
			$(this).val( $(this).val().substring(0,199) ).focus(); 
			alert('Het veld mag maximaal 200 karakters bevatten.');
		}
	});
	
	$('#canvas input[type=text]').change(function(){
		if($(this).val().length > 199){
			$(this).val( $(this).val().substring(0,199) ).focus();			
			alert('Het veld mag maximaal 200 karakters bevatten.');
		}
	});
	
	
	
	if ($.fn.cycle) {
	
		if ($("#sponsorbox2").length > 0){
			$('#sponsorbox2').cycle({ 
				fx:    'fade', 
				speed:  3000,
				timeout:  4000,
				random:  1 
			 });
		}

	}
	
	if ($.fn.selectbox) {
		$("fieldset.type-select select").selectbox();
	}
	
	
	
});
	// -------------------------------------


//$(document).ready(function(){
  //  $(".submenuIMzoeken ul").hide();

 //$(".submenuIMzoeken").mouseover(function(){
  //    $(".submenuIMzoeken ul").show();
   // }).mouseout(function(){
    //  $(".submenuIMzoeken ul").hide();
    //});
//});

// Handige links op de hoofdpagina

  $(document).ready(function(){
     $(".submenuIMzoeken ul").hide();
    $(".submenuIMzoeken").hover(
      function () {
         $(".submenuIMzoeken ul").show();
      }, 
      function () {
       $(".submenuIMzoeken ul").hide();
      }
    );
  });
  
  
  	
  $(document).ready(function(){
   	$(".doelgroepalgemeen").hide();
   	$(".doelgroepbedrijfs").hide();
   	$(".doelgroepscholen").hide();
	
	
	$('#dg_vrijwilligersorganisaties').click(function(){

			if($(this).attr('checked')){
				$(".doelgroepalgemeen").slideDown();
			}else{
				$(".doelgroepalgemeen").slideUp();
			}
	});
	$('#dg_bedrijslevenmbo').click(function(){

			if($(this).attr('checked')){
				$(".doelgroepbedrijfs").slideDown();
			}else{
				$(".doelgroepbedrijfs").slideUp();
			}
	});
	$('#dg_maatschappelijkestages').click(function(){

			if($(this).attr('checked')){
				$(".doelgroepscholen").slideDown();
			}else{
				$(".doelgroepscholen").slideUp();
			}
	});

	
	if ($('#dg_vrijwilligersorganisaties').attr('checked')) {
     $(".doelgroepalgemeen").show();
	}
	if ($('#dg_bedrijslevenmbo').attr('checked')) {
     $(".doelgroepbedrijfs").show();
	}
	if ($('#dg_maatschappelijkestages').attr('checked')) {
     $(".doelgroepscholen").show();
	}
  	});	
//--------------------------------