$(document).ready(function() {
	 
 	$("#brief_sign_off_a").fancybox({
		'scrolling'		: 'no',
		'titleShow'		: false	
	});
	
	//http://www.slimcms.nl/cmsv2/apiCall.php?callType=newslettersignoff&hash=1128915b7a647d590be644823d6135c4&email=WeSLEy@ULTility.nL&delegate=JSON&redirect=false
	$("#brief_sign_off_Frm").bind("submit", function() {
		$.fancybox.showActivity();
		alert('voor');
		
		var email = $(this).find('input[name=email]').attr('value');
		var str_url = "http://www.slimcms.nl/cmsv2/apiCall.php?callType=newslettersignoff&hash=f38fe2bee754c26c9588d0a2825f46e5&email="+email+"&delegate=JSON&redirect=false";
		alert(str_url);
		
		
		$.getJSON(str_url+"&callback=?",function(data) { 
			//var returnData = eval('(' + data + ')');
			$.fancybox({
					'content'	:	data.message,
					'onClosed'	:	function() {
					
					}							
				});
			
		});				
	return false;		
	});
	  
	 $('#coda-slider-1').codaSlider({
           autoSlide: true,
           autoSlideInterval: 4000,
           autoSlideStopWhenClicked: true,
           dynamicArrows: false,
		   dynamicTabs: false,
		   dynamicTabsPosition: 'bottom'
       });
	

	
	//Fancybox
	var slideshow_rel;	
	$("a[rel=photoalbum]").fancybox({
		'transitionIn'		: 'none',
		'transitionOut'		: 'none',
		'titlePosition' 	: 'over',
		'titleFormat'		: function(title, currentArray, currentIndex, currentOpts) { 
			if(!rotatingInterval) { slideshow_rel = 'paused';} else { slideshow_rel = 'playing';}
			return '<span id="fancybox-title-over">Afbeelding ' + (currentIndex + 1) + ' / ' + currentArray.length + '<a class="slideshow" rel="'+slideshow_rel+'">&nbsp;</a></span>';
		},
		'onComplete'		: function() {  $("a.slideshow").click(function() { 
			if($(this).attr('rel') == 'paused') {
				$(this).css('background-image','url('+URL+'/includes/systems/fancybox/fancybox_slide_pause.png)');
				$(this).attr('rel','playing');
				toggleRotating(false);
			} else {
				$(this).css('background-image','url('+URL+'/includes/systems/fancybox/fancybox_slide_play.png)');
				$(this).attr('rel','paused');
				toggleRotating(true);
			}
		}); }
	});
	
	$('.picture').hover(
		function() {$(this).find('div.white div').fadeIn(300);}
		,
		function() {$(this).find('div.white div').fadeOut(300);}
	);
});

$(window).load(function () {
	initMenu();	
	
	$(".picture").each(function(index) {
	    $(this).find('div.white div').delay(150*index).fadeOut(150);
	});
	
	
});
