///***
$(document).ready(function(){
///***

	$f("portfolioPlayer", {
	 	src: "swf/flowplayer-3.1.3.swf",
	   	cachebusting: true
	   	}, {
	   	clip: { 
            baseUrl: 'http://www.taflanpictures.com/videos/',
			autoPlay: true,
			autoBuffering: false,
			scaling: 'original'
        },
		canvas: { 
    		backgroundGradient: "none", 
    		backgroundColor: "#000000" 
  		},
		plugins: {
			// Control Bar parameters
			controls: {
				// setup a background image 
            	background: 'url(images/player_control_bg.jpg) repeat-x', 
				backgroundGradient: 'none',
				// all: false, 
				// scrubber: true, 
				// play: true, 
				// timer: true,
				// mute: true, 
				bufferColor: '#333333', 
				progressColor: '#888888',             
				buttonColor: '#888888', 
				buttonOverColor: '#666666', 
				timeColor: '#333333',
				// Set height 
				height: 30, 
				// Set auto hide 
				autoHide: 'always', 
				// A few other settings              
				width: '100%',  
				bottom: 5, 
				left: '50%'
			}
		}
    }).playlist("div.sliderThumb", {loop:true}); 

	// Initiate cycle and set parameters
	$("div.portfolioScroll").cycle({ 
		fx:     'scrollHorz', 
		speed:  'slow', 
		timeout: 0, 
		next: 'div.nextPortfolioButton a',
		prev: 'div.prevPortfolioButton a',
		pager: '#navi',
		pagerAnchorBuilder: pagerFactory1    
	});
	
	// Create the pager on the thumbnail slider
	function pagerFactory1(idx, slide) {
		var s = idx > 2 ? ' style="display:none"' : '';
		return '<a href="#"></a>';
	};
	
	
	$('div.sliderThumb').each(function(index){               
		$(this).click(function(){
			$('div.videoTextPlaceHolder div').fadeOut(300, function(){
				$(this).empty();
				$(this).append($('div.videoText').eq(index).children()).fadeIn(300);
			});
			return false;
		});
	});    
	
	// Initiate superfish drop down menu
	$("ul.sf-menu").superfish({ 
		pathClass:  'current' 
	});
	
	// Create overlay on hover for other portfolio items
	$('div.otherThumbBlock').hoverIntent(function(){		
		$(this).children('div.thumbOverlay').fadeIn(500);
	},function(){
		$(this).children('div.thumbOverlay').fadeOut(500);
	});
	
	// Append play button to portfolio player
	$("#portfolioPlayer").append('<div class="playButton"></div>');

	// 
	$('a#overlay1, a#overlay2, a#overlay3, a#overlay4').fancybox({
		'frameWidth': 800,
		'frameHeight': 600,
		'centerOnScroll': false,
		'zoomSpeedOut': 400,
		'callbackOnStart': function(){$f().unload();}
	});

	// Find the correct video text and display it
	$('div.sliderThumb a').each(function(index){               
		$(this).click(function(){
			$('div.videoThumbText').filter(':visible').fadeOut(300, function(){
				$('div.videoThumbText').eq(index).fadeIn(300);
			});
			return false;
		});
	});
		
///***
});
///***

