Shadowbox.loadSkin('classic', '/js/lib/shadowbox/skin'); // use the "classic" skin
Shadowbox.loadLanguage('fr', '/js/lib/shadowbox/build/lang'); // use the English language
Shadowbox.loadPlayer(['html', 'iframe'], '/js/lib/shadowbox/build/player'); // use img and qt players

function showImg( id, url ){
	if( document.getElementById ){
		var img = document.getElementById(id);
		if( img.src!=url ){
			img.src = url;
		}
	}
}
var tabLinks, tabs, curTab, nextTab = 0;

function switchTabs(){
	// Masque les tabulations qui ne sont pas actives
	var hash = window.location.hash;
	var href = window.location.href;
	if( window.location.hash=='' ){
		hash = '#resume';
		href += hash;
	}
	
	tabLinks.each(
		function(){
			if( $(this).attr('href')==hash ){
				$(this).parent('li').addClass( 'current' );
			}
			else{
				$(this).parent('li').removeClass( 'current' );
			}
		});
	curTab = nextTab = 0;
	
	tabs.each(
		function(){
			if( '#' + $(this).attr('id')==hash ){
				nextTab = $(this);
			}else{
				if( $(this).hasClass('open-tab') )
					curTab = $(this);
				else {
					$(this).removeClass('open-tab');
					$(this).addClass('close-tab');
				}
			}
		});
	
	if( curTab ){
		curTab.fadeOut(function(){
			$(this).removeClass('open-tab');
			$(this).addClass('close-tab');
			nextTab.removeClass('close-tab');
			nextTab.addClass('open-tab');
			nextTab.fadeIn();
			curTab.removeAttr( 'style' );
		});
		
	}else{
		if( nextTab )
			nextTab.addClass('open-tab');
	}
	
}
function activeTabs(){
	
	tabLinks.each(
		function(){
			$(this).click(
				function(){
					window.location.href = $(this).attr('href');
					switchTabs();
					return false;
				});
		});
}

$(document).ready(function(){
	tabLinks = $('#prd-tabs-header a');
	tabs = $('#prd-tabs div.prd-tab');
	switchTabs();
	activeTabs();
});

$(window).load(function(){

    var options = {
        handleOversize:     'drag',
        displayNav:         false,
        handleUnsupported:  'remove',
        autoplayMovies:     false
    };

    Shadowbox.init(options);

});

