var _colors = {
    "home": "#C52E42",
    "description": "#26000B",
    "data": "#3CAF8D",
    "visualization": "#164E72",
    "partners": "#092F49",
}

_lastpage = null;

$(document).ready(function() {
	
	$("#title").html("<span>"+_page+"</span>");
	$("#title span:first-child").css({ "background-color": _colors[_page] });
	
	$("#"+_page).css({"background-color":_colors[_page], "color":"white", "font-weight":"bold"});
	
	$(".premierMot").css({ 'color':_colors[_page] });
	$("#main > h2").css({ 'color': _colors[_page] });
	
	_lastpage = _page;
});


function navigate(_topage) {
	
	$.ajax({
        url: "./pages/" + _topage +  ".html",
        cache: false,
        success: function(html){
            
			$("#main").html(html);
			
			$("#title").html("<span>"+_topage+"</span>");
			$("#title span:first-child").css({ 'background-color': _colors[_topage] });
			
			$(".premierMot").css({ 'color':_colors[_topage] });
			$("#main > h2").css({ 'color': _colors[_topage] });
			
			$("#"+_topage).css({'background-color':_colors[_topage], "color":"white", "font-weight":"bold"});
			$("#"+_topage).hover(function(){
				$(this).css({'background-color':_colors[_topage], "color":"white", "font-weight":"bold"});
			},function() {
				$(this).css({'background-color':_colors[_topage], "color":"white", "font-weight":"bold"});
			});
			
			if(_lastpage != null && _lastpage != _topage) {
				$("#"+_lastpage).css({"background-color":"#F0F0F0", "color":"black", "font-weight":"normal"});
				$("#"+_lastpage).hover(function() {
					$(this).css({"background-color": _colors[this.id], "color":"white", "font-weight":"bold"});
				},function() {
					$(this).css({"background-color":"#F0F0F0", "color":"black", "font-weight":"normal"});
				});
			}

			_lastpage = _topage;
        }
    });
	
}
