/*!
 * Slice Template - Main JavaScript file
 * http://inventis.github.com/
 *
 * Copyright 2011, Inventis bvba
 *
 * Date: Wed Mar 01 13:55:29 2011 +0100
 */ 
$(document).ready(function(){
	
	// Show the controls
	$('#controls').show();
	
	// HOMEPAGE :: Carousel
	if($('.carousel')){
		$(".carousel").jCarouselLite({
			visible: 1,
			auto: 4800,
			speed: 600,
			btnNext: ".right",
       		btnPrev: ".left"
		});
	}
	
	// DIENSTEN DETAIL :: Custom carousel Widget
	if($('.servicesimages')){
	    $('.servicesimages').jCarouselLite({
	        visible: 1,
	        auto: 4800,
	        speed: 600,
	        btnNext: '.next',
	        btnPrev: '.prev'
	    });
	}
	
//	if($('.widget')){
//		$(".widget").jCarouselLite({
//			visible: 5,
//			scroll: 1,
//			speed: 600,
//			btnNext: ".next",
//			btnPrev: ".prev"
//		});
//		$(".widget img").click(function() {
//			
//			// Get the filename of the large image
//			var originalChunks = $('.imgcontainer img').attr('src').split('/');
//			var originalFilename = originalChunks[originalChunks.length-1];
//			
//			// Get the filename of the clicked on image
//			var newChunks = $(this).attr('src').split('/');
//			var newFilename = newChunks[newChunks.length-1];
//			
//			// Replace the old with the new..
//			$(".imgcontainer img").attr('src', $(".imgcontainer img").attr('src').replace(originalFilename, newFilename));
//		})
//	}

	// DIENSTEN DETAIL :: Custom carousel Widget
	if($('.realisationwidget')){
		
		if($('.prev').length){
			$(".realisationwidget").jCarouselLite({
				visible: 9,
				scroll: 1,
				speed: 600,
				btnNext: ".next",
				btnPrev: ".prev"
			});
	//		$(".realisationwidget img").click(function() {
	//			// Get the filename of the large image
	//			var originalChunks = $('.imgcontainer img').attr('src').split('/');
	//			var originalFilename = originalChunks[originalChunks.length-1];
	//			
	//			// Get the filename of the clicked on image
	//			var newChunks = $(this).attr('src').split('/');
	//			var newFilename = newChunks[newChunks.length-1];
	//			
	//			// Replace the old with the new..
	//			$(".imgcontainer img").attr('src', $(".imgcontainer img").attr('src').replace(originalFilename, newFilename));
	//		})
		}
	}

	/* FancyBox */
	$("a.lightbox").fancybox({
		'transitionIn'	:	'elastic',
		'transitionOut'	:	'elastic'
	})
	
	
	/* Google map */
	if($('#gmap').length){
		var latlng = new google.maps.LatLng(51.10370551982428, 5.748947560787201);
		var myOptions = {
			zoom: 12,
			center: latlng,
			mapTypeId: google.maps.MapTypeId.ROADMAP, 
			scrollwheel: false,
			streetViewControl: false
		};
		var map = new google.maps.Map(document.getElementById("gmap"), myOptions);
		var image = '/assets/images/icons/favicon.png';
		var cg = new google.maps.Marker({
			position: latlng,
			map: map,
			icon: image
		});
	}

});

