function loadMenu()
{
	document.getElementById( "menuWrapper" ).innerHtml = "<div id='menuFlash'><object classid='clsid:d27cdb6e-ae6d-11cf-96b8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0' width='1000' height='242' id='menuFlash'><param name='menuFile' value='/utils/scripts/flash/menu_test.swf'/><embed src='/utils/scripts/flash/menu_test.swf' width='1000' height='242' name='menuFile' type='application/x-shockwave-flash' pluginspage='http://www.macromedia.com/go/getflashplayer'></embed></object></div>";
}

// Images Functions
function opacity( id, opacStart, opacEnd, millisec )
{
    //speed for each frame
    var speed = Math.round(millisec / 100);
    var timer = 0;

    //determine the direction for the blending, if start and end are the same nothing happens
    if(opacStart > opacEnd) {
        for(i = opacStart; i >= opacEnd; i--) {
            setTimeout("changeOpac(" + i + ",'" + id + "')",(timer * speed));
            timer++;
        }
    } else if(opacStart < opacEnd) {
        for(i = opacStart; i <= opacEnd; i++)
            {
            setTimeout("changeOpac(" + i + ",'" + id + "')",(timer * speed));
            timer++;
        }
    }
}

//change the opacity for different browsers
function changeOpac(opacity, id)
{
    var object = document.getElementById(id).style;
    object.opacity = (opacity / 100);
    object.MozOpacity = (opacity / 100);
    object.KhtmlOpacity = (opacity / 100);
    object.filter = "alpha(opacity=" + opacity + ")";
} 


// Menu Functions
function highlightMenu( menuId )
{
	document.getElementById( 'menuItem_' + menuId ).className = "menuItemOver";
}

function unHighlightMenu( menuId )
{
	document.getElementById( 'menuItem_' + menuId ).className = "menuItem";
}

// Expositions functions
var expoWork	= 0;

function showExpoSlideShow(lang, expoId)
{
	expoWork = 0;

	document.getElementById("slideShowArrow").style.visibility = "visible";
	document.getElementById("pressArrow").style.visibility = "hidden";
	//document.getElementById("artistArrow").style.visibility = "hidden";
	document.getElementById("vertMenuDetails").style.visibility = "visible";

	loadPage( "content", "expoWork.php?order=0&lang=" + lang + "&expoId=" + expoId );
	loadPage( "vertMenuDetails", "expoWorkDetails.php?order=0&lang=" + lang + "&expoId=" + expoId );
}

function showExpoPress(lang, expoId)
{
	if( document.getElementById("slideShowArrow") )
		document.getElementById("slideShowArrow").style.visibility = "hidden";

	document.getElementById("pressArrow").style.visibility = "visible";
	//document.getElementById("artistArrow").style.visibility = "hidden";
	document.getElementById("vertMenuDetails").style.visibility = "hidden";

	loadPage( "content", "expoPress.php?lang=" + lang + "&expoId=" + expoId );
}
/*
function showExpoArtist(expoId)
{
	if( document.getElementById("slideShowArrow") )
		document.getElementById("slideShowArrow").style.visibility = "hidden";

	document.getElementById("pressArrow").style.visibility = "hidden";
	document.getElementById("artistArrow").style.visibility = "visible";
	document.getElementById("vertMenuDetails").style.visibility = "hidden";

	loadPage( "content", "expoArtists.php?expoId=" + expoId );
}
*/

function showExpoWork( order, worksNum, lang, expoId )
{
	if( order < 0 )	
		return;

	if( order > worksNum - 1 )
		return;

	expoWork = order;

	loadPage( "content", "expoWork.php?order=" + order + "&lang=" + lang + "&expoId=" + expoId );
	loadPage( "vertMenuDetails", "expoWorkDetails.php?order=" + order + "&lang=" + lang + "&expoId=" + expoId );
}

// News Functions

var actualNews = -1;
function showNews( lang, newsId, firstId )
{
	if( actualNews == -1 )
		actualNews = firstId;

	document.getElementById( "arrow_" + actualNews ).style.visibility	= "hidden";
	document.getElementById( "newsTitle_" + actualNews ).style.color	= "#5E5E5E";

	document.getElementById( "arrow_" + newsId ).style.visibility 			= "visible";
	document.getElementById( "newsTitle_" + newsId ).style.color	= "#3FABEA";

	loadPage( "content", "newsDetails.php?lang=" + lang + "&newsId=" + newsId );

	actualNews = newsId;
}

// Publications Functions

function showPublication( lang, year, publicationId )
{
	if( publicationId != -1 )
	{
		var arrows = document.getElementsByName("arrowList");
		for( var i = 0; i != arrows.length; i++ )
			arrows[i].style.visibility	= "hidden";
	
		var titles = document.getElementsByName("titleList");
		for( var i = 0; i != titles.length; i++ )
			titles[i].style.color = "#5E5E5E";

		document.getElementById( "arrow_" + publicationId ).style.visibility	= "visible";
		document.getElementById( "title_" + publicationId ).style.color			= getYearColor( year );

		loadPage( "content", "publicationDetails.php?lang=" + lang + "&year=" + year + "&publicationId=" + publicationId );
	}
}

// Fairs Functions

function showFair( lang, year, fairId )
{
	if( fairId != -1 )
	{
		var arrows = document.getElementsByName("arrowList");
		for( var i = 0; i != arrows.length; i++ )
		{
			arrows[i].style.visibility	= "hidden";
			//document.getElementById( "arrow_" + i ).style.visibility	= "hidden";
			//document.getElementById( "title_" + i ).style.color			= "#5E5E5E";
		}
	
		var titles = document.getElementsByName("titleList");
		for( var i = 0; i != titles.length; i++ )
		{
			titles[i].style.color = "#5E5E5E";
			//document.getElementById( "arrow_" + i ).style.visibility	= "hidden";
			//document.getElementById( "title_" + i ).style.color			= "#5E5E5E";
		}

		document.getElementById( "arrow_" + fairId ).style.visibility	= "visible";
		document.getElementById( "title_" + fairId ).style.color		= getYearColor( year );

		loadPage( "content", "fairDetails.php?lang=" + lang + "&year=" + year + "&fairId=" + fairId );
	}
}

// Press Functions

function showPress( lang, year, pressId, counter, total )
{
	for( var i = 0; i != total; i++ )
	{
		document.getElementById( "arrow_" + i ).style.visibility	= "hidden";
		document.getElementById( "title_" + i ).style.color			= "#5E5E5E";
	}

	document.getElementById( "arrow_" + counter ).style.visibility 			= "visible";
	document.getElementById( "title_" + counter ).style.color	= getYearColor( year );

	loadPage( "content", "pressDetails.php?lang=" + lang + "&year=" + year + "&pressId=" + pressId );

	actualPress = pressId;
}


// Artist's functions
var serieWork = 0;

function showArtistSlideShow(lang, artistId)
{
	document.getElementById("slideShowArrow").style.visibility = "visible";
	document.getElementById("bioArrow").style.visibility = "hidden";
	document.getElementById("expoArrow").style.visibility = "hidden";
	document.getElementById("vertMenuDetails").style.visibility = "visible";

	serieWork = 0;

	loadPage( "content", "serieWork.php?current=0&lang=" + lang + "&artistId=" + artistId );
	loadPage( "vertMenuDetails", "serieWorkDetails.php?current=0&lang=" + lang + "&artistId=" + artistId );
}

function showArtistBio(lang, artistId)
{
	document.getElementById("slideShowArrow").style.visibility = "hidden";
	document.getElementById("bioArrow").style.visibility = "visible";
	document.getElementById("expoArrow").style.visibility = "hidden";
	document.getElementById("vertMenuDetails").style.visibility = "hidden";

	loadPage( "content", "artistBio.php?lang=" + lang + "&artistId=" + artistId );
}

function showArtistExpo(lang, artistId)
{
	document.getElementById("slideShowArrow").style.visibility = "hidden";
	document.getElementById("bioArrow").style.visibility = "hidden";
	document.getElementById("expoArrow").style.visibility = "visible";
	document.getElementById("vertMenuDetails").style.visibility = "visible";

	loadPage( "content", "artistExpo.php?lang=" + lang + "&artistId=" + artistId );
	loadPage( "vertMenuDetails", "artistExpoDetails.php?lang=" + lang + "&artistId=" + artistId );
}

function showSerieWork( current, worksNum, lang, artistId )
{
	if( current < 0 )	
		return;

	if( current > worksNum - 1 )
		return;

	serieWork = current;

	loadPage( "content", "serieWork.php?current=" + current + "&lang=" + lang + "&artistId=" + artistId );
	loadPage( "vertMenuDetails", "serieWorkDetails.php?current=" + current + "&lang=" + lang + "&artistId=" + artistId );
}


// Contact Functions

function showMapFromContact( lang, element )
{
	document.getElementById( "contactCircle").src = "/admin/images/front/circle_contact.jpg";
	element.src = "/admin/images/front/circle_plan_actif.jpg";

	loadPage( "content", "galerieMap.php?lang=" + lang );
}

function checkEmail( lang )
{
	var address, message;

	with( window.document.sendEmail )
	{
			address	= emailAddress;
			message	= emailMessage;
	}

	// if address is empty alert the visitor
	if( trim(address.value) == '' && !isEmail( trim(address.value) ) )
	{
		if( lang == "en" )
			alert("Please enter a valid email address");
		else
			alert("Veuillez introduire une addresse e-mail valide");

		address.focus();
		loadPage( "contentWrapper", "contact.php?lang=" + lang);
	}

	// alert the visitor if email is empty or
	// if the format is not correct
	else

		if( trim(message.value) == '' )
		{
			if( lang == "en" )
				alert("Please enter a valide message");
			else
				alert("Veuillez introduire un message valide");

			message.focus();
			loadPage( "contentWrapper", "contact.php?lang=" + lang);
		}
		else
		{
			// when all input are correct
			// return true so the form will submit
			window.document.sendEmail.action = "sendMail.php";
		}
}

function getYearColor( year )
{
	switch( year )
	{
		case 2003:
			return "#59595b";
		break;
		
		case 2004:
			return "#cd071e";
		break;

		case 2005:
			return "#5c5425";
		break;
		
		case 2006:
			return "#fec601";
		break;
		
		case 2007:
			return "#fe7026";
		break;
		
		case 2008:
			return "#009de0";
		break;
		
		case 2009:
			return "#e2017b";
		break;
		
		case 2010:
			return "#19171a";
		break;
		
		case 2011:
			return "#a99616";
		break;
		
		case 2012:
			return "#5c5425";
		break;
		
		case 2013:
			return "#007ca2";
		break;
		
		case 2014:
			return "#fcc601";
		break;
		
		case 2015:
			return "#fe7026";
		break;
		
		case 2016:
			return "#dd5b89";
		break;
		
		case 2017:
			return "#cd071e";
		break;
		
		case 2018:
			return "#58585a";
		break;
		
		case 2019:
			return "#009de0";
		break;
		
		case 2020:
			return "#19171c";
		break;
	}
}