$(document).ready(function() {	
	$("a.fancy").fancybox({
		'transitionIn'	: 'elastic',
		'transitionOut'	: 'elastic',
        'easingIn'      : 'easeOutBack',
        'easingOut'     : 'easeInBack',
		'overlayShow'	: true,
		'overlayColor'  : '#000'
	});
	$("a.fancyDiv").fancybox({
        'titlePosition' : 'inside',
		'transitionIn'	: 'none',
		'transitionOut'	: 'none',
        'autoScale'         : false,
		'width'			: 300,
		'height'		: 200,
		'overlayColor'  : '#000'
	});
	$("a.fancyScreencast").fancybox({
		'width'			: 430,
		'height'		: 850,
		'transitionIn'	: 'none',
		'transitionOut'	: 'none',
		'type'			: 'iframe',
		'autoScale' 	: false,
		'overlayShow'	: true,
		'overlayOpacity' : 0.3,
		'overlayColor'	: '#000',
		'opacity'		: true,
		'titleShow'		: false,
		'scrolling'		: false,
		'transitionIn'	: 'elastic',
		'transitionOut'	: 'elastic'
	});
	$("a.fancyYouTube").fancybox({
		'width'			: 854,
		'height'		: 480 ,
		'transitionIn'	: 'none',
		'transitionOut'	: 'none',
		'type'			: 'iframe',
		'autoScale' 	: false,
		'overlayShow'	: true,
		'overlayOpacity' : 0.3,
		'overlayColor'  : '#000',
		'transitionIn'	: 'elastic',
		'transitionOut'	: 'elastic'
	});
	
	// Slideshow
	if ((jQuery('.slideshowNavi').length != 0)) {
    	if ((jQuery('.autoplayslideshow').length != 0)) {
        	jQuery("#slideshowContainer").scrollable({circular: true}).autoscroll({ autoplay: true, autopause: true, interval: 4000 }).navigator();
			var api = jQuery("#slideshowContainer").data("scrollable");
			jQuery('.slideshow-buttons a').click(function(){
				api.pause();
			});
        
		}
		else {
			jQuery("#slideshowContainer").scrollable().navigator();
		}
	}
  
    if ((jQuery('.slideshow-buttons > a').size()) == 1) {
        jQuery('.slideshow-buttons').hide();
    }


	// quotes
    var num_quotes = 0;
    var cur_quote = 0;
    $('#quotes > li').each(function(quote) {
        this.id = 'quote_' + num_quotes;
        if (num_quotes != 0) {
			$(this).fadeOut();
        }
        num_quotes++;
    });
	$.fx.off = 0;
	 
    if (num_quotes > 0) {
		setInterval(function() {
			cur_quote++;
			if(cur_quote >= num_quotes) { cur_quote = 0; }
			for(var i = 0;i < num_quotes;i++) {
				if (cur_quote == i) {
					$('#quote_' + i).fadeIn("slow");
				} else {
					$('#quote_' + i).fadeOut("slow");
				} 
			}
			
		}, 4000);
	}
	
	// Google +1
    var po = document.createElement('script'); po.type = 'text/javascript'; po.async = true;
    po.src = 'https://apis.google.com/js/plusone.js';
    var s = document.getElementsByTagName('script')[0];
    s.parentNode.insertBefore(po, s);

});

