$(document).ready(function(){
	
	$("a.exterieur").click(function() {
		window.open($(this).attr('href'));
		return false;
	});

	$("#footer").css('minHeight', ($(document).height() - $("#conteneur").height() - 20)+'px');
});

$(window).load(function() {
	$("#slidebox").cycle({
		fx: 'blindY',
		prev: '#prev_slider',
		next: '#next_slider',
		pager: '#cycle_nav',
		before: beforeSlide,
		after: afterSlide,
		pause: 1,
		pagerAnchorBuilder: pagerFactory
	});
	
	$("#photos_bas").cycle({
		fx: 'scrollLeft',
		prev: '#prev_bottom',
		next: '#next_bottom'
	});
	
	$("#photos_bas").cycle('pause');
	
	function pagerFactory (idx, slide)
	{
		var s = idx > 2 ? ' style="display: none"' : '';
		return '<li'+s+'><a href="#">'+(idx+1)+'</a></li>';
	}
	
	$("#next_slider, #prev_slider").fadeTo('fast', 0.7);
	$("#next_slider, #prev_slider").mouseover(function() {
		//$(this).fadeTo('fast', 1);
		$("#slidebox").cycle('pause');
	});
	
	$("#next_slider, #prev_slider").mouseout(function() {
		//$(this).fadeTo('fast', 0.7);
		$("#slidebox").cycle('resume');
	});
	
	$("#next_bottom, #prev_bottom").fadeTo('fast', 0.7);
	$("#next_bottom, #prev_bottom").mouseover(function() {
		$(this).fadeTo('fast', 1);
	});
	
	$("#next_bottom, #prev_bottom").mouseout(function() {
		$(this).fadeTo('fast', 0.7);
	});
	
	function beforeSlide()
	{
		$("#prev_slider, #next_slider, #cycle_nav").css('display', 'none');
	}
	
	function afterSlide()
	{
		$("#prev_slider, #next_slider, #cycle_nav").css('display', 'block');
	}
	
	$('a.lightbox').fancybox();
	$('a.lightboxFrame').fancybox({
		'width'				: '75%',
		'height'			: '85%',
     'autoScale'     	: false,
		'type'				: 'iframe'
	});
	
	$("#courriel_input").focus(function() {
		$(this).select();
	});
	
	
});
