$(function() {
	
$f("a.player", "/js/flowplayer-3.2.1.swf", {
	
	// perform custom stuff before default click action
	onBeforeClick: function() {
		
		// unload previously loaded player
		$f().unload();
		
		// get wrapper element as jQuery object
		var wrap = $(this.getParent());
		
		// hide nested play button
		wrap.find("img").fadeOut();
		
		// start growing animation
		wrap.animate({width:440, height:330}, 500, function() {
		
			// when animation finishes we will load our player
			$f(this).load();
			
		});	
		
		// disable default click behaviour (player loading)
		return false; 
	}, 

	// unload action resumes to original state		
	onUnload: function() {
		$(this.getParent()).animate({width:300, height:208}, 500, function()  {
				
			// make play button visible again
			$(this).find("img").fadeIn();		
		});				
	}, 
	
	// when playback finishes perform our custom unload action
	onFinish: function() {
		this.unload();	
	}
	
});



});

