// nivoSlider
$(window).load(function() {
    $('#slider').nivoSlider({
        effect:'slideInRight', // Specify sets like: 'fold,fade,sliceDown'
		slices: 15, // For slice animations
        boxCols: 8, // For box animations
        boxRows: 4, // For box animations
        animSpeed: 1000, // Slide transition speed
        pauseTime: 5000, // How long each slide will show
        startSlide: 0, // Set starting Slide (0 index)
        directionNav: false, // Next & Prev navigation
        directionNavHide: false, // Only show on hover
        controlNav: true, // 1,2,3... navigation
        controlNavThumbs: false, // Use thumbnails for Control Nav
        controlNavThumbsFromRel: false, // Use image rel for thumbs
        controlNavThumbsSearch: '.jpg', // Replace this with...
        controlNavThumbsReplace: '_thumb.jpg', // ...this in thumb Image src
        keyboardNav: false, // Use left & right arrows
        pauseOnHover: false, // Stop animation while hovering
        manualAdvance: false, // Force manual transitions
        captionOpacity: 0.8, // Universal caption opacity
        prevText: 'Prev', // Prev directionNav text
        nextText: 'Next', // Next directionNav text
        beforeChange: function(){}, // Triggers before a slide transition
        afterChange: function(){}, // Triggers after a slide transition
        slideshowEnd: function(){}, // Triggers after all slides have been shown
        lastSlide: function(){}, // Triggers when last slide is shown
        afterLoad: function(){} // Triggers when slider has loaded
    });
});
	
// document.ready
$(document).ready(function() {
	
	// menu
	$("#menu").hover(
	  function () {
		$(".submenu").stop(true,true);
		$('.submenu').fadeIn('slow');
	  }, 
	  function () {
		$(".submenu").stop(true,true);
		$('.submenu').fadeOut('fast');
	  }
	);
	
	// checkForm
	$('#mailing').submit(function(){
		checkForm();	
	});
	function checkForm() {
		
		ret = true;
		if($('#contactformulier_name').val() == 'Naam:')
		{
			$('#contactformulier_name').css('color','#B60718');
			ret = false;							
		}
		else
		{
			$('#contactformulier_name').css('color','#000000');
		}
		
		if($('#contactformulier_company').val() == 'Bedrijf:')
		{
			$('#contactformulier_company').css('color','#B60718');
			ret = false;							
		}
		else
		{
			$('#contactformulier_company').css('color','#000000');
		}
		
		if(! validate('mailing','contactformulier_email'))
		{
			$('#contactformulier_email').css('color','#B60718');
			ret = false;							
		}
		else
		{
			$('#contactformulier_email').css('color','#000000');
		}
		
		if($('#contactformulier_text').val() == '')
		{
			$('#contactformulier_text2').css('color','#B60718');
			ret = false;							
		}
		else
		{
			$('#contactformulier_text').css('background-color','#FFFFFF');
			$('#contactformulier_text').css('color','#5E5E5E');
		}
		
		return ret;
	}
	
	function validate(form_id,email) {
	   var reg = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;
	   var address = document.forms[form_id].elements[email].value;
	   if(reg.test(address) == false) {
		  return false;
	   }
	   return true;
	}
	

	var map;
	var marker;
	function initialize() {
		var myOptions = {
			zoom: 16,
			center: new google.maps.LatLng(51.9728, 5.917661),
			mapTypeId: google.maps.MapTypeId.HYBRID 
		};

		map = new google.maps.Map(document.getElementById('map_canvas'),
		myOptions);
	
		marker = new google.maps.Marker({
			map:map,
			draggable:false,
			animation: google.maps.Animation.DROP,
			position: new google.maps.LatLng(51.9728, 5.917661)
		});
	}
	google.maps.event.addDomListener(window, 'load', initialize);
	
});
