﻿
$(function() {
	var zIndexNumber = 1000;
	$('div').each(function() {
		$(this).css('zIndex', zIndexNumber);
		zIndexNumber -= 10;
	});
	
	$('.ttip').css('zIndex', 1001);
	
	
});

$(function(){	
$('#models').listnav({ 
    includeAll: false,
    includeNums: false,
    showCounts:false,  
    noMatchText: 'niets gevonden - rien trouvé' 
  });	
});



$(document).ready(function() {

   
   	$(".toggle_container").hide();
    $("h4.trigger").click(function(){
    	$(this).toggleClass("active").next().slideToggle("normal");
        return false; //Prevent the browser jump to the link anchor
    });
   
   
  
	var highestCol = Math.max($('#content-padding').height(),$('#sidebar-wrapper').height());
	$('.equalheight').height(highestCol);
	
   
   $('ul.sf-menu').superfish({
   			
   			delay:       0,                            // one second delay on mouseout 
            
                                     // faster animation speed 
            autoArrows:  false,                           // disable generation of arrow mark-up 
            dropShadows: false });
   
   
	//settings
	var opacity = .90, toOpacity = 1, duration = 100;
	//set opacity ASAP and events
	$('.opacity').css('opacity',opacity).hover(function() {
			$(this).fadeTo(duration,toOpacity);
		}, function() {
			$(this).fadeTo(duration,opacity);
		}
	);
	
	
	

$('div#content input.button').css('opacity',opacity).hover(function() {
			$(this).fadeTo(duration,toOpacity);
		}, function() {
			$(this).fadeTo(duration,opacity);
		}
	);

	$('#content a img').hover(function() {
  	$(this).addClass('pretty-hover');
	}, function() {
  	$(this).removeClass('pretty-hover');
	});
	

    
    
    $('.quote-wrapper').each(function() {
        // Get the text of the span
        $(this).prepend('<span class="bq-start"></span>');
        $(this).append('<span class="bq-end home">.</span>');
      }
    );
    
    
    $('.default-value').each(function() {
    var default_value = this.value;
    $(this).focus(function() {
        if(this.value == default_value) {
            this.value = '';
      
        }
    });
    $(this).blur(function() {
        if(this.value == '') {
            this.value = default_value;
            
        }
    });
	
	});
    
   
   $('#newsletter-button').click(function() {
   		$('form#newsletterform').submit();
   });
   
   $('#black-footer-search-button').click(function() {
   		$('form#searchform').submit();
   });
   
   $('#comment-button').click(function() {
   		$('form#commentform').submit();
   });
   
   
    
   
    $('form#newsletterform').submit(function(event){
		var email = $('#email-for-newsletter').attr('value');
		var validEmail = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
		if (!validEmail.test(email)) {
			$('#response').html('Please enter a valid email address').css('color','red');
		} else {
			$.ajax({
				dataType:	'text',
				data:		$(this).serialize(),
				type:		$(this).attr('method'),
				url:		$(this).attr('action'),
				success: function(data){
					$('#response').html(data);
				},
				error: function(){
					$('#response').html('An error occured submitting the form data.').css('color','red');
				}
			});
		}
		event.preventDefault();
	});
   
    
    
   /*
    $('#sidebar-content .children').each(function() {
       
        $(this).css('display', 'none');
    });
    

    $(document).ready(function() {
        $('li.page_item').hover(function() {
            $('.children', this).css('display', 'block');
        },
		function() {
		    $('.children', this).css('display', 'none');
		});
    });
   
    */
    /*var thevalue = $('#content').css('height');
    $('#sidebar-content').css('height', thevalue);*/
    

    
    
    



    

    function isIE() {
        if (navigator.userAgent.match(/MSIE \d\.\d+/)) {
            return true;
        }
        else {
            return false;
        }
    }
    
    
    
    
});


