var OLD_DIV="";
var OLD_BAS="";
var HAUTEUR_REPLIE="-130px";
var FLAG_BLOC=0;
var OLD_PARTENAIRE="";

function load_popup() {
	document.getElementById('popup').style.display='';
	

}

function message_de_connexion(ob){
	alert('To put a message, you must connect');
	//document.getElementById(ob).innerHTML="<p class='alert'>To put a message, you must connect</p><br><a href='?page=connexion' class=lien>Connect</a>";
	//document.getElementById(ob).style.display="";
}

function Remplacer(texte,val1,val2)
{
 var a, tmp;
 tmp = "";
 a = texte;

 for(var i = 0; i < a.length; i++)
 {
 	tmp = tmp + a.charAt(i);

 	if (a.charAt(i) == val1)
	 {
 	tmp = tmp.replace(val1,val2);
 	}
 }

 return tmp;
	
 } 

function envoi_message(id) {
	id_auteur=document.getElementById("id_auteur").value;
	texte=document.getElementById("your_message_"+id).innerHTML;
	window.location="record_msg.php?msg="+texte+"&id_auteur="+id_auteur+"&id_article="+id+"&url="+document.location.href;
	
}

function preview_message(ob) {
	var reg=new RegExp("\n", "g");
	texte=new String();
	texte=document.getElementById("texte_"+ob).value;
	if(texte) {
		document.getElementById("your_message_"+ob).innerHTML=Remplacer(texte,"\n","<br>");
		document.getElementById("preview_message_"+ob).style.display='';
	}
	
}

function debug(v){
document.getElementById('debug').innerHTML=v;
}

function test_variable() {

	if(!FLAG_BLOC && document.getElementById(OLD_BAS)) document.getElementById(OLD_BAS).style.bottom=HAUTEUR_REPLIE;
	OLD_BAS="";
		
}

function modify_overflow(ob) {
	if(!document.getElementById(ob).style.overflow) 
		document.getElementById(ob).style.overflow="auto";
	else document.getElementById(ob).style.overflow="";
}

function position_bas(pied,gd,pd) {
	if(document.getElementById(pied).style.bottom==pd) {		
		if(document.getElementById(OLD_BAS)) document.getElementById(OLD_BAS).style.bottom=pd;
		OLD_BAS=pied;
		
		document.getElementById(pied).style.bottom=gd;
	}else document.getElementById(pied).style.bottom=pd;
	//modify_overflow(pied);
}


function hauteur_pied(pied,gd,pd) {
	if(document.getElementById(pied).style.height==pd)
		document.getElementById(pied).style.height=gd;
	else document.getElementById(pied).style.height=pd;
	
}

function open_corps(corps,balise) {
	if(document.getElementById(OLD_BAS)) document.getElementById(OLD_BAS).style.bottom=HAUTEUR_REPLIE;
	OLD_BAS="";
	if(document.getElementById(corps).style.display=='none') {
		if(document.getElementById(OLD_DIV)) {
			document.getElementById(OLD_DIV).style.display='none';
			if(document.getElementById("more_"+corps)) document.getElementById("more_"+OLD_DIV).src="squelettes-dist/images/bt_more.gif";
		}
		OLD_DIV=corps;
		document.getElementById(corps).style.display='block';
		if(balise) window.location.href='#'+balise;
		if(document.getElementById("more_"+corps)) document.getElementById("more_"+corps).src="squelettes-dist/images/bt_less.gif"
	}else {
		document.getElementById(corps).style.display='none';
		if(balise) window.location.href='#'+balise;
		if(document.getElementById("more_"+corps)) document.getElementById("more_"+corps).src="squelettes-dist/images/bt_more.gif"
	}
	voir_partenaire('');
}


function change_class(ob,c) {

	if(document.getElementById(ob)) document.getElementById(ob).className=c;
}

function affiche_menu(id) {
	s=new String();
/*	s=document.getElementById('rub'+id).innerHTML;
	document.getElementById('rub'+id).innerHTML=s+"&nbsp;|";*/
	document.getElementById(id).style.display='';
}

function cache_menu(id){
	document.getElementById(id).style.display='none';
}

function voir_objet(ob) {
	if(document.getElementById(ob)) {
		if(document.getElementById(ob).style.display=='none') {
			document.getElementById(ob).style.display='block';
		
		}else {
			document.getElementById(ob).style.display='none';
			
		}
	}

}
function voir_partenaire(ob){

	if(document.getElementById(ob)) {
		if(document.getElementById(ob).style.display=='none') {
			if(document.getElementById(OLD_PARTENAIRE)) document.getElementById(OLD_PARTENAIRE).style.display='none';
			OLD_PARTENAIRE=ob;
			document.getElementById(ob).style.display='block';
		
		}else {
			document.getElementById(ob).style.display='none';
			
		}
	} else {
		if(document.getElementById(OLD_PARTENAIRE)) document.getElementById(OLD_PARTENAIRE).style.display='none';
		OLD_PARTENAIRE=ob;
	}
}


function multiClass(eltId,arrLinkId,c1,c2,url,obj,id) {
	//arrLinkId = new Array('_0','_1','_2','_3');
	intNbLinkElt = new Number(arrLinkId.length);
	arrClassLink = new Array(c1,c2);
	strContent = new String();
	for (i=0; i<intNbLinkElt; i++) {
		strContent = "menu"+arrLinkId[i];
		if ( arrLinkId[i] == eltId ) {
			document.getElementById(arrLinkId[i]).className = arrClassLink[0];
			//document.getElementById("load_"+id).innerHTML="<img src='images/loading.gif' width=20>";
			chargement(url,obj);
			//document.getElementById(strContent).className = 'on content';
		} else {
			document.getElementById(arrLinkId[i]).className = arrClassLink[1];
			//document.getElementById(strContent).className = 'off content';
		}
	}	
}


	<!--
		function getWindowHeight() {
			var windowHeight = 0;
			if (typeof(window.innerHeight) == 'number') {
				windowHeight = window.innerHeight;
			}
			else {
				if (document.documentElement && document.documentElement.clientHeight) {
					windowHeight = document.documentElement.clientHeight;
				}
				else {
					if (document.body && document.body.clientHeight) {
						windowHeight = document.body.clientHeight;
					}
				}
			}
			return windowHeight;
		}
		function setFooter() {
			if (document.getElementById) {
				var windowHeight = getWindowHeight();
				if (windowHeight > 0) {
					var contentHeight = document.getElementById('grand').offsetHeight;
					var footerElement = document.getElementById('footer');
					var footerHeight  = footerElement.offsetHeight;
					if (windowHeight - (contentHeight + footerHeight) >= 0) {
						footerElement.style.position = 'relative';
						footerElement.style.top = (windowHeight - (contentHeight + footerHeight)) + 'px';
					}
					else {
						footerElement.style.position = 'static';
					}
				}
			}
		}
		window.onload = function() {
			setFooter();
		}
		window.onresize = function() {
			setFooter();
		}
		//-->

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}
function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
//-->


