$(document).ready(function() {
	
	 $('.slideshow').cycle({
			fx: 'fade' // choose your transition type, ex: fade, scrollUp, shuffle, etc...
		});
		
	$("a.single_img").fancybox({
				'titleShow'		: true,
				'titlePosition' : 'inside'
	});
	
	$('.blank_link').attr('target', '_blank');

	jQuery('.more-information').click(function(){
		var taf_id = jQuery(this).attr('id');
		var taf_id_split = taf_id.split('_');
		
		show_mi(taf_id_split['1']);
	});

	$('.leesmeer').click(function () 
	{
		var obj = $(this).parents('.partner').find('.vervolgtekst');
		
		if (obj.css('display')=='none')
		{
			obj.slideDown();
			$(this).find('a').addClass('active'); 	
		}
		else
		{
			obj.slideUp();
			$(this).find('a').removeClass('active');
		}
		
});

$('.leesmeer2').click(function () 
	{
		var obj = $(this).parents('.vereniging').find('.vervolgtekst');
		
		if (obj.css('display')=='none')
		{
			obj.slideDown();
			$(this).find('a').addClass('active'); 	
		}
		else
		{
			obj.slideUp();
			$(this).find('a').removeClass('active');
		}
		
});

$('.leesmeer2_verenigingen').click(function () 
	{
		var obj = $(this).parents('.vereniging').find('.vervolgtekst_verenigingen');
		
		if (obj.css('display')=='none')
		{
			obj.slideDown();
			$(this).find('a').addClass('active'); 	
		}
		else
		{
			obj.slideUp();
			$(this).find('a').removeClass('active');
		}
		
});

	if(jQuery("#map_canvas").length != 0)
{
		var geocoder;
  		var map;
  		
  		function initialize() {
	    	geocoder = new google.maps.Geocoder();
	    	var latlng = new google.maps.LatLng(-34.397, 150.644);
	    	var myOptions = {
	      		zoom: 12,
	      		center: latlng,
	      		mapTypeId: google.maps.MapTypeId.ROADMAP
	    		}
	    	map = new google.maps.Map(document.getElementById("map_canvas"), myOptions);
  		} 		

		initialize();			
   		codeAddress();  
   		
   		
}

$('.een').click(function(){
		window.location = $(this).attr("url");
});

$('.twee').click(function(){
		window.location = $(this).attr("url");
});

$('.drie').click(function(){
		window.location = $(this).attr("url");
});

$('.vier').click(function(){
		window.location = $(this).attr("url");
});

function codeAddress() 
{
    var address = 'Posthuisweg, Horn';
    var image = new google.maps.MarkerImage('/postkoets.com/img/beachflag.png',
      // This marker is 20 pixels wide by 32 pixels tall.
      new google.maps.Size(26, 31),
      // 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(5, 20));
  	var shadow = new google.maps.MarkerImage('/postkoets.com/img/beachflag_shadow.png',
      // The shadow image is larger in the horizontal dimension
      // while the position and offset are the same as for the main image.
      new google.maps.Size(40, 13),
      new google.maps.Point(0,0),
      new google.maps.Point(0, 0));

    
    if (geocoder) 
    {
      	geocoder.geocode( { 'address': address}, function(results, status) 
      	{
        	if (status == google.maps.GeocoderStatus.OK) 
        	{
          		map.setCenter(results[0].geometry.location);
          		var marker = new google.maps.Marker({
              		map: map, 
              		position: results[0].geometry.location,
              		shadow: shadow,
              		icon: image
          		});
        	} 
        	else 
        	{
          		alert("Geocode was not successful for the following reason: " + status);
        	}
      	});
    }
}



});
