
// affichage sommaire/détails pour une annonce...
function showOverview(){
	document.getElementById('adOverviewAnnonce').style.display='block';
	document.getElementById('adDetailsAnnonce').style.display='none';
}

// affichage sommaire/détails pour une annonce...
function showDetails(){
	document.getElementById('adOverviewAnnonce').style.display='none';
	document.getElementById('adDetailsAnnonce').style.display='block';
}

// affiche ou masque le login form
var loginBoxFormStatus = 'none';
function toggleLoginBoxForm(){
	if(loginBoxFormStatus == 'none'){
		document.getElementById('loginBoxForm').style.display='block';
		loginBoxFormStatus = 'block';
	} else {
		document.getElementById('loginBoxForm').style.display='none';
		loginBoxFormStatus = 'none';
	}
}



function verifLogin(lang,mess1,mess2){
	var messageErreur = 'none';

	if (document.loginForm.password.value != ""){			
		if (document.loginForm.username.value != ""){
			return true;			
		}else{
			document.getElementById('messageErreur').innerHTML = mess2;
			document.getElementById('messageErreur').style.display='block';
			return false;	
		}
	
	}else{
			document.getElementById('messageErreur').innerHTML = mess1;
			document.getElementById('messageErreur').style.display='block';
			return false;
	}
	return false;
};


var ultimateFirstTime = 0;
function autoScroll(id,speed){
	// patch IE - Taille minimum 966
	//alert(document.getElementById(id+'Scroll').offsetWidth);
	
	var text = document.getElementById(id+'Scroll').innerHTML;
	var longueurChaine = text.length*7;	
	
	var widthTaken = (document.getElementById(id+'Scroll').offsetWidth < longueurChaine)? longueurChaine : document.getElementById(id+'Scroll').offsetWidth;
 	
	if(widthTaken > 0) {
		document.getElementById(id+'Scroll').style.width = widthTaken+'px';
		document.getElementById(id+'ScrollFollower').style.width = widthTaken+'px';
	}

	var outerWidth = document.getElementById(id+'ScrollContainer').offsetWidth;
	var innerWidth = document.getElementById(id+'Scroll').offsetWidth;
	
	var first = -1;
                
	var innerWidth = (widthTaken == longueurChaine)? longueurChaine : widthTaken; // patch IE - Taille minimum 966
	eval ("scrolling_"+id+"=setInterval(\"scrollInLoop(\\\""+id+"\\\","+speed+","+outerWidth+","+innerWidth+")\",30);");
}


function scrollInLoop(id,speed,outerWidth,innerWidth) {
	var positionStr = document.getElementById(id+'Scroll').style.marginLeft.toString();
	var position = Number(positionStr.substring(0,positionStr.length-2));
        if(ultimateFirstTime ==0){
		++ultimateFirstTime;    
		//outerWidth=459; // patch IE
		outerWidth=209; // patch IE
	} 
	if(positionStr == ""){ 
		position = outerWidth;
	} 
				
	if(-position > innerWidth){
		position =  innerWidth + position;
	}
	
	//alert(speed);

	position = position - speed;
	positionFollower = position + innerWidth;
				
	document.getElementById(id+'Scroll').style.marginLeft = position.toString()+"px";
	document.getElementById(id+'ScrollFollower').style.marginLeft = positionFollower.toString()+"px";
}

function stopScroll(id){
   eval("if (window.scrolling_"+id+"){clearInterval(scrolling_"+id+");}");
}