function ouvre(id,site,retour){
	document.location.href = 'compte.html?id='+id+'&site='+site+'&ret='+retour;
}


function retDiv(div) {
	if (document.getElementById) return eval("document.getElementById('"+div+"')");
	else
	return eval("document.all["+div+"]");
}

function getScrollXY(){
	var scrOfX = 0, scrOfY = 0;
	if( typeof( window.pageYOffset ) == 'number' ){
		scrOfY = window.pageYOffset;
		scrOfX = window.pageXOffset;
	}else if(document.body && ( document.body.scrollLeft || document.body.scrollTop)){
		scrOfY = document.body.scrollTop;
		scrOfX = document.body.scrollLeft;
	}else if(document.documentElement && ( document.documentElement.scrollLeft || document.documentElement.scrollTop ) ){
		scrOfY = document.documentElement.scrollTop;
		scrOfX = document.documentElement.scrollLeft;
	}
return [ scrOfX, scrOfY ];
}

function  parseint_(ch){
	var i;
	i=parseInt(ch);
	if(isNaN(i))
	return 0;
	else
	return i;
}

function  GSl(){
	var HautBase=140;
	var i;
	for(i=1;i<=2;i++){
		if((elem=retDiv("pub"+i))){
			$tmp=getScrollXY();
			sL=$tmp[0];
			sT=$tmp[1];
			t=parseint_(elem.style.top);
			l=parseint_(elem.style.left);
			if(elem.className=="pubTop"){
				if((t=sT-HautBase)<0)t=0;
			}
			if(sT!=t || sL!=l){
				clearTimeout(timeoutid[i]);
				GSl_(i,t,l,0);
			}
		}
	}
}

function  NwPs(saut,fP,aP){
	if(saut!=1){
		distance=Math.abs(fP-aP);
		if(distance<2) 	saut=distance/8;	else if(distance<5) 	saut=distance/6;
		else if(distance<10) 	saut=distance/4;
		else saut=distance/ 2;
		if((saut=Math.floor(saut))<1)	saut=1;
		}
		if(fP>aP) aP+=saut;
		else if(fP<aP) aP-=saut;return aP;
}

function  GSl_(i,nT,nL,x){
	if(!(o=retDiv("pub"+i)))return;
	if(x)	vitesse=40;
	else	vitesse=1;
	t=NwPs(vitesse,nT,parseint_(o.style.top));
	l=NwPs(vitesse,nL,parseint_(o.style.left));
	var BasMax= HautWin()-820;
	if(t>=BasMax && BasMax>1){t=BasMax};
	o.style.top=t+"px";
	o.style.left=l+"px";
	if(nT!=t || nL!=l){
		tmp = "GSl_("+i+","+nT+","+nL+",1)";
	timeoutid[i] = setTimeout(tmp,80)} else clearTimeout(timeoutid[i]);
}

function HautWin(){
	if (document.body && typeof(document.body.offsetHeight) == 'number'){
			HautC = document.body.offsetHeight;
	}else if (typeof(window.innerHeight) == 'number'){
			HautC = window.innerHeight;}else{HautC = 600;
	}
	return HautC;
}

function OpenCoordonne(url){  
  var vLeft=window.screen.width/2-400;
  var vTop=50;
  //Videment faut modifier la config!!
  var Configuration="'toolbar=no, menubar=no, location=no, directories=no, status=no, resizeable=no, width=800, height=620, left=" + vLeft + ", top=" + vTop;
  window.open(url,'',Configuration);
}

function visibilite(thingId)
{
	var targetElement;
	targetElement = document.getElementById(thingId) ;
	if (targetElement.style.display == "none")
		{
			targetElement.style.display = "" ;
		} else {
			targetElement.style.display = "none" ;
		}
}


if(parent.frames.length > 0){  // interdit l'affichage en frame
		window.top.location.href = location.href;
} 

// timeoutid= new Array();
// window.onscroll = GSl;
// window.onmouseover = GSl; // active mvt pub

function q(w){
	if (document.getElementById("image_visible").style.display == "none")
		{
			visibilite("image_visible");
		}
	document.imageaffiche.src=varimage[w];
}


