// Video overlay
$(function() {
	// IE7 does not like expose
	if (ie7)
	{
		$('div[rel]').overlay({
			onLoad: function(content) {
				this.getOverlay().find('a.player').flowplayer(0).load();
			},            
			onClose: function(content) {
				$f().unload();
			}
		});				
		
		$('a.player').flowplayer('../media/movies/player/flowplayer.swf', { 
			plugins: {
				controls: { 
					all: false,
					play: true,
					volume: true,
					scrubber: true,				
					scrubberHeightRatio: 0.6,
					scrubberBarHeightRatio: 0.5,
					volumeSliderHeightRatio: 0.6,
					volumeBarHeightRatio: 0.5,				
					progressColor: '#000000',
					bufferColor: '#666666',
					buttonColor: '#000000',
					buttonOverColor: '#92B2BD',
					volumeSliderColor: '#000000'							
				}
			}
		});	
	}
	// All the good browsers do
	else
	{		
		$('div[rel]').overlay({
			expose:	{ 
				color: '#000000', 
				loadSpeed: 1000, 
				opacity: 0.9
			},            
			onLoad: function(content) {
				this.getOverlay().find('a.player').flowplayer(0).load();
			},            
			onClose: function(content) {
				$f().unload();
			}
		});				
		
		$('a.player').flowplayer('../media/movies/player/flowplayer.swf', { 
			plugins: {
				controls: { 
					all: false,
					play: true,
					volume: true,
					scrubber: true,				
					scrubberHeightRatio: 0.6,
					scrubberBarHeightRatio: 0.5,
					volumeSliderHeightRatio: 0.6,
					volumeBarHeightRatio: 0.5,				
					progressColor: '#000000',
					bufferColor: '#666666',
					buttonColor: '#000000',
					buttonOverColor: '#92B2BD',
					volumeSliderColor: '#000000'							
				}
			}
		});
	}
});

// Popup
$(function() {
	// IE7 does not like expose
	if (ie7)
	{
		$('a[rel]').overlay();
	}
	// All the good browsers do
	else
	{	
		$('a[rel]').overlay({
			expose: {
				color: '#000000', 
				loadSpeed: 1000, 
				opacity: 0.9
			}
		});
	}
});	   

// Accordeon
$(function() {
	$('#accordion').tabs('#accordion div.pane', {tabs: 'h3', effect: 'slide'});
});

// Slideshow
$(function() {
	// initialize scrollable
	$('div.scrollable').scrollable({size: 2, nextPage: '.right', prevPage: '.left'}).circular().autoscroll(2000);
});
// Slideshow POVO
$(function() {
	$('div.slideshow').scrollable().circular().autoscroll(2000);
});

// Tooltip
$(function() {
	$('#tooltips span').tooltip( {
		tip: '#tooltip',
		effect: 'fade',
		delay: 1
	}).dynamic(	{
		bottom: { 
            direction: 'down',  
            bounce: true 
        }
	});
});

// Expose
$(function() {
    $('.expose').mouseover(function() {  
        // perform exposing for the clicked element 
        $(this).expose({
			color: '#000000', 
			opacity: 0.5,
			loadSpeed: 0,
			closeSpeed: 0,
			api: true
		}).load();  
    }); 
	$('.expose').mouseout(function() {
		$(this).expose().close();
	});
});

// Tabs
$(function() {
	$('ul.tabs').tabs('div.panes > div');
});

// Images mouseover
$(function() {
	$('.images-mouseover').tabs('div.images-description', {event:'mouseover'});
});