$(document).ready(function() {
	$('#image-carousel').cycle({
		fx: 'fade', // choose your transition type, ex: fade, scrollUp, shuffle, etc...
		prev:   '#prev', 
		next:   '#next',
		timeout: 5000
	});

	$('#image-carousel').show();


	$('#sign-out').click(function(e){
		e.preventDefault();
		$.cookie('authToken', '');
		window.location='http://oma.scard.fi/?logout=true';
	});
	
	var i = $('.exclude-jQuery').index();
	if(i!=0){ 
		$('.slider-cont').hide();
	//	$('#content-wide h2:eq(0)').toggleClass('active');
		$('#content-wide h2, #content-slider-kaupungeittain h2').css('cursor', 'pointer');
		$('#content-wide h2').click(function(){
			var header = $(this);
			header.toggleClass('active');
			$(this).next('.slider-cont').slideToggle(500);
		});

	//	$('#content-slider h2:eq(0), #content-slider-kaupungeittain h2:eq(0)').toggleClass('active');
		
		$('#content-slider h2, #content-slider-kaupungeittain h2').click(function(){
			var header = $(this);
			header.toggleClass('active');
			$(this).next('.slider-cont').slideToggle(500);
		});
	}
	
	
	var d = new Date();
var nc = d.getTime();

	$('#sign-up, #sign-up-button, #image-carousel img:eq(1), .kirjaudu-painike > a').fancybox({
		'overlayColor'		: '#000000',
		'padding'			: '0',
		'type'				: 'iframe',
//		'href'				: 'http://www.scard.fi/index.php?id=200',	
	'href'				: 'https://oma.scard.fi/kirjaudu?lang=fi',
       		'scrolling'			: 'no'
	});
	$('.scard-tilaus, #image-carousel img:eq(3),  .tilaa-painike').fancybox({
		'overlayColor'		: '#000000',
		'padding'			: '0',
		'type'				: 'iframe',
		//'href'				: 'http://www.scard.fi/index.php?id=200',		
'href'				: 'https://oma.scard.fi/rekisteroidy?lang=fi',
		'width'			: 667,
		'height'			: 536,
		'scrolling'			: 'no'
	});
	$('.verkkoarvonta').fancybox({
		'overlayColor'		: '#000000',
		'padding'			: '0',
		'type'				: 'iframe',
       'width'             : 668,
      'height'            : 461,
        'showCloseButton'   : false,
       	'scrolling'			: 'no' 
	});


});

