
var yInc= 5 ;
var yDestination= 21 ;

var expandedItem= null ;
var expanded= null ;
var timerId= null ;


function expand( id )
{
	if ( document.getElementById(id) != expanded ) {
		collapse() ;
		if ( (expanded= document.getElementById(id)) != null 
				&& (expandedItem= document.getElementById(id+"Item")) != null ) {
			/*expandedItem.style.backgroundColor= "#99d8ef" ;*/
			expandedItem.style.color='#000000';
			expanded.style.top= -yInc+"px" ;
			timerId= setInterval( softExpand, 50 ) ;
		}
	}
}


function collapse()
{
	cancelAnim() ;
	if ( expanded != null ) {
		with ( expanded.style ) {
			visibility= "hidden" ;
			display= "none" ;
		}
		with ( expandedItem.style ) {
			/*backgroundColor= "#339966" ;
			color='#FFFFFF';*/
		}
		expanded= null ;
	}
}



function cancelAnim()
{
	if ( timerId != null ) {
		clearInterval( timerId ) ;
		timerId= null ;
	}
}


function softExpand()
{
	with ( expanded.style ) {
		var yPosLayer= parseInt(top) ;
		var newYPosLayer= yPosLayer + yInc ;
		if ( yPosLayer == -yInc ) {
			display= "block" ;
			visibility= "visible" ;
			top= newYPosLayer+"px" ;
		}
		else if ( newYPosLayer < yDestination ) {
			top= newYPosLayer+"px" ;
		}
		else {
			top= yDestination+"px" ;
			cancelAnim() ;
		}
	}
}


function positionneMenu()
{
	expand('association'); collapse();
	expand('histoire'); collapse();
	expand('vie'); collapse();
	expand('visite'); collapse();
	expand('location'); collapse();
}



/* Divers */
function linkto( url )
{
	document.location.href= url ;
}

