$(document).ready(function() {
	
	// tweetable
	$('#tweets').tweetable({
	
		limit: 7,                         //number of tweets to show
		username: 'rickdgraaff',     //@username tweets to display
		time: true,                     //display date
		replies: true,                //filter out @replys
		
	});
	
	/*	CarouFredSel: an infinite, circular jQuery carousel.
		Configuration created by the "Configuration Robot"
		at caroufredsel.frebsite.nl
	*/
	$("#foo2").carouFredSel({
		width: 620,
		items: {
			visible		: 1,
			width		: 620,
			height		: 350
		},
		scroll: {
			pauseOnHover: true
		},
		auto: {
		pauseDuration	: 6000,
		delay			: 3000,
		items			: 1,
		duration		: 1000
		},
		pagination: {
			container: "#foo2_pag",
			items		: 1,
			duration	: 1000
		}
	});
	
	
	/*	CarouFredSel: an infinite, circular jQuery carousel.
		Configuration created by the "Configuration Robot"
		at caroufredsel.frebsite.nl
	*/
	$("#smallCarousel").carouFredSel({
		direction	: "right",
		width		: 620,
		height		: 112,
		items		: 5,
		scroll : {
			items			: 3,
			duration		: 2000
		},
		auto : {
			pauseDuration	: 2500,
			delay			: 1000,
			pauseOnHover	: true
		}
	});
	
	/* Maak van de kleine carousel een fancybox carousel */
	$("#smallCarousel a").fancybox({
		cyclic			: true,
		titleShow		: true,
		overlayColor	: "#000",
		transitionIn 	: "fade",
		transitionOut 	: "elastic",
		titlePosition	: "over",
		zoomOpacity		: true,
		onStart	: function() {
			$("#smallCarousel").trigger("pause");
		},
		onClosed: function() {
			$("#smallCarousel").trigger("play");
		}
	});
	
	/* FancyBox */
	/* Apply fancybox to multiple items */
	
	$("a.group").fancybox({
		'transitionIn'	 :	'elastic',
		'transitionOut'	 :	'elastic',
		'speedIn'		 :	500, 
		'speedOut'		 :	200,
		'overlayColor'	 : 	"#000",
		'titlePosition'  :	"over",
		'cyclic'		 :  true,
		'zoomOpacity'	 : true,
	});
	
	// Initialize TinyMCE with the new plugin and listbox
	tinyMCE.init({
		mode : "textareas",
		editor_selector 	: "commentmceEditor",
		plugins 			: "emotions,inlinepopups",
		theme : "advanced",
		
		// Skin options
		skin : "o2k7",
		skin_variant : "silver",
		theme_advanced_buttons1 : "bold,italic,underline,separator,strikethrough,separator,undo,redo,emotions",
		theme_advanced_buttons2 : "",
		theme_advanced_buttons3 : "",
		theme_advanced_toolbar_location : "top",
		theme_advanced_toolbar_align : "left",
		theme_advanced_statusbar_location : "none"


	});
	
	// verberg en toon blog comments
	$(".collapse").collapse({show: function(){
			this.animate({
				opacity: 'toggle', 
				height: 'toggle'
			}, 300);
		},
		hide : function() {
			
			this.animate({
				opacity: 'toggle', 
				height: 'toggle'
			}, 300);
		}
	});
	

	
// tooltip voor links
$('p a[title], .commentRecord[title]').bt({
showTip: function(box){
    $(box).fadeIn(700);
  },
  hideTip: function(box, callback){
    $(box).animate({opacity: 0}, 500, callback);
  },
  
  fill: '#F7F7F7', 
  strokeStyle: '#B7B7B7', 
  spikeLength: 10, 
  spikeGirth: 12, 
  padding: 8, 
  cornerRadius: 0,
  interval: 6000,
  timeout: 6000,
  positions: ['top'],
  shrinkToFit: true,

  
  cssStyles: {
    fontFamily: '"lucida grande",tahoma,verdana,arial,sans-serif', 
    fontSize: '11px'
  }
});



// tooltip voor menu items en formulieren
$('.commentRecord [title]').bt({
	showTip: function(box){
    var $content = $('.bt-content', box).hide(); /* hide the content until after the animation */
    var $canvas = $('canvas', box).hide(); /* hide the canvas for a moment */
    var origWidth = $canvas[0].width; /* jQuery's .width() doesn't work on canvas element */
    var origHeight = $canvas[0].height;
    $(box).show(); /* show the wrapper, however elements inside (canvas, content) are now hidden */
    $canvas
      .css({width: origWidth * .5, height: origHeight * .5, left: origWidth * .25, top: origHeight * .25, opacity: .1})
      .show()
      .animate({width: origWidth, height: origHeight, left: 0, top: 0, opacity: 1}, 400, 'easeOutBounce',
        function(){$content.show()} /* show the content when animation is done */
        );
  },
  /* when using hideTip, do NOT forget 'callback' at end of animation */
  hideTip: function(box, callback){
    var $content = $('.bt-content', box).hide();
    var $canvas = $('canvas', box);
    var origWidth = $canvas[0].width;
    var origHeight = $canvas[0].height;
    $canvas
      .animate({width: origWidth * .5, height: origHeight * .5, left: origWidth * .25, top: origHeight * .25, opacity: 0}, 400, 'swing', callback); /* callback */
  },
  
  fill: '#F7F7F7', 
  strokeStyle: '#B7B7B7', 
  spikeLength: 10, 
  spikeGirth: 12, 
  padding: 8, 
  cornerRadius: 0,
  interval: 2000,
  timeout: 2000,
  trigger: ['focus', 'blur'],
  shrinkToFit: true,
  
  cssStyles: {
    fontFamily: '"lucida grande",tahoma,verdana,arial,sans-serif', 
    fontSize: '11px'
  }
});
			
});
