function slideCycle(){
	$('#items')
	.after('<div id="nav">')
	.cycle({
		fx:     'fade',
		timeout: 7000,
		speed:	 600,
		pager: '#nav'
	});
}




function contact () {
	$('#contact_form_holder #send_message').click(function(e){
		
		//stop the form from being submitted
		e.preventDefault();
		
		/* declare the variables, var error is the variable that we use on the end
		to determine if there was an error or not */
		var error = false;
		var email = $('#contact_form_holder #email').val();
		var firstname = $('#contact_form_holder #firstname').val();
		var lastname = $('#contact_form_holder #lastname').val();
		var companyname = $('#contact_form_holder #companyname').val();
		var phone = $('#contact_form_holder #phone').val();
		var message = $('#contact_form_holder #message').val();
	

		if(firstname.length == 0 || firstname == 'voornaam'){
		var error = true;
			$('#contact_form_holder #firstname_error').fadeIn(500);
		}else{
			$('#contact_form_holder #firstname_error').fadeOut(500);
		}

		if(lastname.length == 0|| lastname == 'achternaam'){
		var error = true;
			$('#contact_form_holder #lastname_error').fadeIn(500);
		}else{
			$('#contact_form_holder #lastname_error').fadeOut(500);
		}
					
		if(email.length == 0 || email.indexOf('@') == '-1'){
			var error = true;
			$('#contact_form_holder #email_error').fadeIn(500);
		}else{
			$('#contact_form_holder #email_error').fadeOut(500);
		}

		if(companyname.length == 0 || companyname == 'bedrijfsnaam'){
			var error = true;
			$('#contact_form_holder #companyname_error').fadeIn(500);
		}else{
			$('#contact_form_holder #companyname_error').fadeOut(500);
		}

		if(phone.length == 0 || phone == 'telefoon'){
			var error = true;
			$('#contact_form_holder #phone_error').fadeIn(500);
		}else{
			$('#contact_form_holder #phone_error').fadeOut(500);
		}

		if(message.length < 15 || message == 'bericht'){
			var error = true;
			$('#contact_form_holder #message_error').fadeIn(500);
		}else{
			$('#contact_form_holder #message_error').fadeOut(500);
		}
		
		//now when the validation is done we check if the error variable is false (no errors)
		if(error == false){

		
			//disable the submit button to avoid spamming
			//and change the button text to Sending...
			$('#contact_form_holder #send_message').attr({'disabled' : 'true', 'value' : '' });
			
			/* using the jquery's post(ajax) function and a lifesaver
			function serialize() which gets all the data from the form
			we submit it to send_email.php */

			
			$.post("send_contact.php", $("#contact_form_holder #contact_form").serialize(),function(result){
				//and after the ajax request ends we check the text returned
				if(result == 'sent'){
					

					$('#contact_form_holder .inputfield').remove();
				
					//if the mail is sent remove the submit paragraph
					 $('#contact_form_holder #cf_submit_p').remove();
					//and show the mail success div with fadeIn
					$('#contact_form_holder #mail_success').fadeIn(500);
				}else{
					//show the mail failed div
					$('#contact_form_holder #mail_fail').fadeIn(500);
					//reenable the submit button by removing attribute disabled and change the text back to Send The Message
					$('#contact_form_holder #send_message').removeAttr('disabled').attr('value', '');
				}
			});
		}
	});    			
}


function initialize() {
		var myLatlng = new google.maps.LatLng(51.80936101844048,4.670412540435791);

		var myOptions = {
		  zoom: 12,
		  center: myLatlng,
		  mapTypeId: google.maps.MapTypeId.ROADMAP,	  
		  mapTypeControl: false
		}
		var map = new google.maps.Map(document.getElementById('map'), myOptions);
		
		var image = new google.maps.MarkerImage('images/google.png',
			new google.maps.Size(225, 121),
			// The origin for this image is 0,0.
			new google.maps.Point(0,0),
			// The anchor for this image is the base of the flagpole at 0,32.
			new google.maps.Point(100, 75)
		);
		var marker = new google.maps.Marker({
			position: myLatlng, 
			map: map,
			icon: image
		}); 
	}



