//Cufon calls
Cufon.replace('header#main nav#primary ul li a', { fontFamily: 'ArialRound', hover:'true'});
Cufon.replace('h1.pagetitle', { fontFamily: 'ArialRound', hover:'true'});
Cufon.replace('#maincontent h1', { fontFamily: 'ArialRound', hover:'true'});
Cufon.replace('#maincontent h2', { fontFamily: 'ArialRound', hover:'true'});
Cufon.replace('#maincontent h3', { fontFamily: 'ArialRound', hover:'true'});
Cufon.replace('aside div.item h3', { fontFamily: 'ArialRound', hover:'true'});
Cufon.replace('aside div.item h5', { fontFamily: 'ArialRound', hover:'true'});
Cufon.replace('a.popuplink', { fontFamily: 'ArialRound', hover:'true'});
Cufon.replace('#loginpopup h3', { fontFamily: 'ArialRound', hover:'true'});
Cufon.replace('#teaserpopup1 h3', { fontFamily: 'ArialRound', hover:'true'});
Cufon.replace('#teaserpopup2 h3', { fontFamily: 'ArialRound', hover:'true'});




  

 
 


//add functionality
$(document).ready(function(){	
	$( "#datepicker" ).datepicker( { dateFormat: 'dd-mm-yy' });

	 $("span[id^='cat_']").each(function()
			{			
				$(this).addClass('categoriecontentclosed');
				$("span.headerOpen").each(function()
				{
					$(this).removeClass('headerOpen');
					$(this).addClass('categorietitel');
				});
			});
	
	jQuery('ul.promolist').jcarousel({scroll:1,auto:3,wrap:'circular'});
	var carousel = jQuery('ul.promolist').data('jcarousel');
	
	
	jQuery.validator.addMethod("defaultInvalid", function(value, element) 
    {
     switch (element.value) 
     {

     
     
     case "Naam":
       if (element.name == "element_name") return false;
       break;
      case "Emailadres":
       if (element.name == "element_name") return false;
       break;
      case "Telefoonnummer":
       if (element.name == "element_name") return false;
       break;
      case "Opmerking":
       if (element.name == "element_name") return false;
       break;
		case "Organisatie":
       if (element.name == "element_name") return false;
       break;
	
       default: return true; 
       break;
     
     
     
     
     
     
     }
    });
    
    
    

    
    
    //2. Include custom validation in the rules for your element
    $("#contactform").validate(
    {
      rules: 
      {
       name: "required defaultInvalid",
       email: "required email defaultInvalid",
       telephone: "required defaultInvalid",
       message: "required defaultInvalid"
      },
      messages: 
      {
       name: "Voer een geldige naam in",
       email: "Voer een geldig emailadres in",
       telephone: "Voer een telefoonnummer in",
       message: "Voer een geldig bericht in"
      }
    });
    
     $("#afspraakform").validate(
    {
      rules: 
      {
       name: "required defaultInvalid",
       email: "required email defaultInvalid",
       telephone: "required defaultInvalid",
       company: "required defaultInvalid"
      },
      messages: 
      {
       name: "Voer een geldige naam in",
       email: "Voer een geldig emailadres in",
       telephone: "Voer een telefoonnummer in",
       company: "Voer uw organisatie in"
      }
    });
	
	
	
	
	jQuery('ul#testilist').jcarousel({scroll:1,auto:6,wrap:'circular'});
	$("#teaserpopupcontainer1").hide();
		$("#teaserpopupcontainer2").hide();
	$("#contactpopupcontainer").hide();
				
	$("#contactpopupcontainer #contactpopup a#close").click(function(){
		$("#contactpopupcontainer").fadeOut(100);
	});
  	$("a.CTAlink.contact").click(function(event){
   		$("#contactpopupcontainer").fadeIn(100);
 	});
 	
 	$("a.teaserlink1").click(function(event){
   		$("#teaserpopupcontainer1").fadeIn(100);
   		carousel.stopAuto();
 	});
 	
 		$("#teaserpopupcontainer1 #teaserpopup1 a.close").click(function(){
		$("#teaserpopupcontainer1").hide().fadeOut(100);
		$("#teaserpopupcontainer1").hide();
		carousel.startAuto();
	});
	
	
	$("a.teaserlink2").click(function(event){
   		$("#teaserpopupcontainer2").fadeIn(100);
   		carousel.stopAuto();
 	});
 	
 		$("#teaserpopupcontainer2 #teaserpopup2 a.close").click(function(){
		$("#teaserpopupcontainer2").hide().fadeOut(100);
		$("#teaserpopupcontainer2").hide();
		carousel.startAuto();
	});
	
	
 	
 	
 			  	
 });


	function jShowhide(el,trigger)
 		{
 		//el = to  open, trigger=geklikte el
			var contentContainers = $("span[id^='cat_']").each(function()
			{			
							$(this).addClass('categoriecontentclosed');

		
				
				$("span.headerOpen").each(function()
				{
					$(this).removeClass('headerOpen');
					$(this).addClass('categorietitel');
				});
			});
			
			
	
			
			if($(el).hasClass('categoriecontentopen'))
			{
				$(el).removeClass('categoriecontentopen');
				$(el).addClass('categoriecontentclosed');
				$(trigger).removeClass('headerOpen');
					$(this).addClass('categorietitel');
				
			} else
			{
				$(el).removeClass('categoriecontentclosed');
				$(el).addClass('categoriecontentopen');
					$(trigger).removeClass('categorietitel');
				$(trigger).addClass('headerOpen');
			}
			
			return false;    
  		}
  		
  		
  		
  		
  		
  		
  		
  		
  		
  		
  		<!--
			function calcParallax(tileheight, speedratio, scrollposition) 
			{
			//    by Brett Taylor http://inner.geek.nz/
			//    originally published at http://inner.geek.nz/javascript/parallax/
			//    usable under terms of CC-BY 3.0 licence
			//    http://creativecommons.org/licenses/by/3.0/
				return (tileheight - (Math.floor(scrollposition / speedratio) % (tileheight+1)));
			}
			window.onload = function() 
			{  
				window.onscroll = function() 
			{
				var posY = (document.documentElement.scrollTop) ? document.documentElement.scrollTop : window.pageYOffset;
				var ground = document.getElementById('wolkies');
				var groundparallax = calcParallax(746, 4, posY);
				ground.style.backgroundPosition = "0 " + groundparallax + "px"; 
				var clouds = document.getElementById('wolkies2');
				var cloudsparallax = calcParallax(1374, 2.5, posY);
				clouds.style.backgroundPosition = "0 " + cloudsparallax + "px"; 
			}
		
			
		}
		-->
