$(document).ready(function() {
	
	
	// External links in new widow
	
	$("a[href^='http://'].external").attr("target","_blank");
	
	// Horaire Filter

	$('.progress').click(function() {
		$("log.list").hide();
		$("log.list."+$(this).children("a").text()).show();
	});	
	
	// Swap grid between mobile/PC view
	
	resizeThirds();
	
	// Images Transitions
	
	$("img").hide().fadeIn(200);
	
	// Block IE
	
	if ( $.browser.msie ) {
	  alert( "Please upgrade your browser to NOT Internet Explorer" );
	}
	
	// Module Timeline
	
	$(".timeline").mousemove(function(event) {
	  	
		timeline();		

	});
	
	timeline();	
	
	
	
});

$(window).resize(function() {
	
	
	resizeThirds();
	
	
});

// Mobile LOD
function resizeThirds(){
	
	
	if($("body").width() < 340){
		$("header").css("height","60px").css("overflow","hidden");
		$("wrapper").css("margin","0px");
		$("third, twothird").css("width","100%");
		$("third selection a").css("display","none");
		$("third selection .parent").css("display","block");
		$("third selection .selected").css("display","block");
	}
	else if($("body").width() < 900){
		$("third, twothird").css("width","100%");
		$("third selection a").css("display","none");
		$("third selection .parent").css("display","block");
		$("third selection .selected").css("display","block");
	}
	else{
		$("third").css("width","33%");
		$("twothird").css("width","66%");
		$("third selection a").css("display","block");
	}
	
	
}


function timeline(){

	
	var marker = Math.floor(100*(event.pageX - $(".timeline").offset().left)/parseInt($(".timeline").css("width")));
	
	if(marker < 79){
		$(".timeline span").css("left",marker+"%");
		$(".timeline span").css("right","auto");
	}
	else if(parseInt($(".timeline span").css("left")) > 80){
		$(".timeline span").css("right","1%");
		$(".timeline span").css("left","auto");
	}

	$(".timeline li").mouseover(function() {
	
		$(".timeline span").text($(this).attr("data"));
		
	});
	
	$(".timeline li").click(function() {
		window.location=$(this).attr("href");
	});
	
	
}


