Shadowbox.init({
    skipSetup: true,
    players: ["html"]
});

$(document).ready(function(){

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

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

	
$("a.single_image").fancybox({
				'titleShow'		: false
			});

$("a.group").fancybox({
	'speedIn'		:	600, 
	'speedOut'		:	200, 
	'overlayShow'	:	false
});


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

$(function() {
    $('.icon').tipsy();
});

$(function() {
    $('.back').tipsy();
});

$(function() {
    $('.back2').tipsy();
});

//$(function () {
//
//    $('.anythingSlider').anythingSlider({
//        easing: "easeInOutExpo",        // Anything other than "linear" or "swing" requires the easing plugin
//        autoPlay: true,                 // This turns off the entire FUNCTIONALY, not just if it starts running or not.
//        delay: 3000,                    // How long between slide transitions in AutoPlay mode
//        startStopped: false,            // If autoPlay is on, this can force it to start stopped
//        animationTime: 600,             // How long the slide transition takes
//        hashTags: true,                 // Should links change the hashtag in the URL?
//        buildNavigation: true,          // If true, builds and list of anchor links to link to each slide
//		pauseOnHover: true,             // If true, and autoPlay is enabled, the show will pause on hover
//		startText: "Go",             // Start text
//        stopText: "Stop",               // Stop text
//        navigationFormatter: formatText       // Details at the top of the file on this use (advanced use)
//    });
//    
//    $("#slide-jump").click(function(){
//        $('.anythingSlider').anythingSlider(6);
//    });
//    
//});

function formatText(index, panel) {
		  return index + "";
	    }
    
$(function () {
        
            $('.anythingSlider').anythingSlider({
                easing: "easeInOutCubic",        // Anything other than "linear" or "swing" requires the easing plugin
                autoPlay: false,                 // This turns off the entire FUNCTIONALY, not just if it starts running or not.
                delay: 3000,                    // How long between slide transitions in AutoPlay mode
                startStopped: false,            // If autoPlay is on, this can force it to start stopped
                animationTime: 1000,             // How long the slide transition takes
                hashTags: true,                 // Should links change the hashtag in the URL?
                buildNavigation: true,          // If true, builds and list of anchor links to link to each slide
        		pauseOnHover: true,             // If true, and autoPlay is enabled, the show will pause on hover
        		startText: "Go",             // Start text
		        stopText: "Stop",               // Stop text
		        navigationFormatter: formatText       // Details at the top of the file on this use (advanced use)
            });
            
            $("#slide-jump").click(function(){
                $('.anythingSlider').anythingSlider(6);
            });
            
});

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();  
   		
   		
}


function codeAddress() 
{
    var address = 'Nies van der Schansstraat 19, Sprang-Capelle';
    var image = new google.maps.MarkerImage('/alrecar.nl/img/beachflag.png',
      // This marker is 20 pixels wide by 32 pixels tall.
      new google.maps.Size(30, 55),
      // 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(15, 55));
  	var shadow = new google.maps.MarkerImage('/alrecar.nl/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(34, 25),
      new google.maps.Point(0,0),
      new google.maps.Point(0, 25));

    
    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);
        	}
      	});
    }
}





});



function show_taf(product_id)
{
	//AJAX connectie voor zetten van Sessie e.d. daarna doorzetten naar search page.
	
	jQuery.ajax({
		type: "POST",
		url: "/alrecar.nl/ajax/ajax_helper.php",
		data: 'product_id='+product_id+'&action=show_taf',
		dataType: "html",
		success: function(result)
		{
			if(result != '')
			{
			   	Shadowbox.open({
                   content:    result,
                   player:     "html",
                   title:      "Meer informatie",
                   height:     300,
                   width:      520,
                   options: 
                   { 
                       onFinish: function()
                       {                       	
                              
                       }
                   }
               });
   			}
		}

    });
}
