var scrollspeed=cache=1
function initialize(){
	var dataobj=document.getElementById("datacontainer");
	dataobj.style.top='100px'
	scrolltest()
}


function scrolltest(){
	var dataobj=document.getElementById("datacontainer");
	thelength=dataobj.offsetHeight
	dataobj.style.top=parseInt(dataobj.style.top)-scrollspeed + 'px'
	if (parseInt(dataobj.style.top)<thelength*(-1))
		dataobj.style.top='150px';
	setTimeout("scrolltest()",50)
}


function openDiv(idLink, idDiv, _height){
	var oDiv = document.getElementById(idDiv);
	var step = 6;
	var stepAcc = 3;
	oLink = document.getElementById(idLink)
	if ( oDiv != null ) {
		if ( oDiv.style.height == _height + 'px' ){
			//oDiv.style.height = '0px';
			if ( oLink != null ) oLink.style.backgroundImage = "url(picts/bt_savoir_plus.jpg)";
			closeSlow(idDiv, _height, step , stepAcc);
			
		}else{
			//alert(oDiv.style.height);
			if ( oLink != null ) oLink.style.backgroundImage = "url(picts/bt_savoir_plusActif.jpg)";
			openSlow(idDiv, _height, step , stepAcc);
			
			//oDiv.style.height = _height + 'px';
			//alert(oDiv.style.height);
		}
	}
}			


function savoirPlusOn(idLink){
	var oLink = document.getElementById(idLink)
	if ( oLink != null ){
		if ( oLink.style.backgroundImage != "url(picts/bt_savoir_plusActif.jpg)" )
			oLink.style.backgroundImage = 'url(picts/bt_savoir_plusOn.jpg)';
	}
}

function savoirPlusOff(idLink){
	var oLink = document.getElementById(idLink)
	if ( oLink != null ){
		if ( oLink.style.backgroundImage != "url(picts/bt_savoir_plusActif.jpg)" )
			oLink.style.backgroundImage = 'url(picts/bt_savoir_plus.jpg)';
	}
}

function openSlow(idDiv, _height, step, stepAcc){
	var oDiv = document.getElementById(idDiv);
	if ( oDiv != null ) {
		intHeight = parseInt(oDiv.style.height.replace('px',''));
		if ( isNaN(intHeight) ) intHeight = 0;
		if ( intHeight < _height  ){
			//alert('_height ' + _height);
			//alert('intHeight ' + intHeight);
			intHeight+=step;
			if ( intHeight > _height ) intHeight = _height;
			oDiv.style.height = intHeight + 'px';
			if ( intHeight < _height  ) {
				step += stepAcc;
				setTimeout("openSlow('"+idDiv+"',"+ _height +", "+step+","+stepAcc+" )", 0);
			}
		}
	}
}

function closeSlow(idDiv, _height, step, stepAcc){
	var oDiv = document.getElementById(idDiv);
	if ( oDiv != null ) {
		intHeight = parseInt(oDiv.style.height.replace('px',''));
		if ( isNaN(intHeight) ) intHeight = _height;
		if ( intHeight > 0  ){
			//alert('_height ' + _height);
			//alert('intHeight ' + intHeight);
			intHeight-=step;
			//alert('intHeight ' + intHeight);
			if ( intHeight < 0 ) intHeight = 0;
			oDiv.style.height = intHeight + 'px';
			if ( intHeight >= 0  ) {
				step += stepAcc;
				setTimeout("closeSlow('"+idDiv+"',"+ _height +", "+step+", "+stepAcc+" )", 0);
			}
		}
	}
}

