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

	/*$f("portfolioPlayer", {
	 	src: "http://blip.tv/scripts/flash/showplayer.swf?showplayerpath=http%3A//blip.tv/scripts/flash/showplayer.swf&amp;brandname=Collegio%20Geometri%20Modena&amp;brandlink=http%3A//www.geometrimo.it/video.php&amp;enablejs=true&amp;showsharebutton=false&amp;showguidebutton=false&amp;useoldendcap=true&amp;tabType1=details&amp;tabTitle1=About&amp;tabType2=guide&amp;tabType3=none&amp;tabTitle2=Episodes&amp;tabUrl2=http%3A//geometrimo.blip.tv/rss/flash%3Fsort%3D~date",
	   	cachebusting: true
	   	}, {
	   	clip: { 
            baseUrl: 'file=hZERgcf0KgA&amp;',
			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(){}
	});

	// Find the correct video text and display it
	$('div.sliderThumb a').each(function(index){               
		$(this).click(function(){
		var player = document.getElementById('portfolioPlayer');
player.innerHTML = $(this).attr("rel");


			$('div.videoThumbText').filter(':visible').fadeOut(300, function(){
				$('div.videoThumbText').eq(index).fadeIn(300);
			});
			return false;
		});
	});
		
///***
});
///***

