<!--


function showCible(theme,contenuUrl)
{
document.getElementById("divNewMail").className='cachediv';
document.getElementById("divDos").className='cachediv';
document.getElementById("divList").className='cachediv';
document.getElementById("divInter").className='cachediv';
document.getElementById("divView").className='cachediv';
//document.getElementById('divNewMail').innerHTML = '<iframe width=100% height="100%"   id="voirFrame" name="voirFrame" frameborder="0" scrolling="Yes" src="/vide2.php" marginheight="0" marginwidth="0" leftmargin="0" rightmargin="0" topmargin="0" bottommargin="0"></iframe>';
voirFrame.location="/vide2.php";

document.getElementById("divCible").className='fullDivNew'+theme;
ajusteView();
loadFragmentInToElement(contenuUrl, "divCible",0,0,"<br><br><div align=center>Chargement en cours<br><br><img src=/img/waiting.gif width=18 height=18 border=0>",'');

}

function alterDiv(theme,contenuFrame)
{
document.getElementById("divDos").className='cachediv';
document.getElementById("divList").className='cachediv';
document.getElementById("divInter").className='cachediv';
document.getElementById("divView").className='cachediv';
document.getElementById("divCible").className='cachediv';
document.getElementById("divNewMail").className='fullDivNew'+theme;
document.getElementById("divNewMail").style.height=document.getElementById("divMenu").style.height;

//document.getElementById('divNewMail').innerHTML = '<iframe width=100% height="100%"   id="voirMail" name="voirMail" frameborder="0" scrolling="Yes" src="'+contenuFrame+'" marginheight="0" marginwidth="0" leftmargin="0" rightmargin="0" topmargin="0" bottommargin="0"></iframe>';
voirFrame.location=contenuFrame;

}

function showDosMail(theme,rep,force,tri)
{
	if(document.getElementById("divNewMail").className=='fullDivNew'+theme ||  document.getElementById("divCible").className=='fullDivNew'+theme ||  document.getElementById("divList").className=='listeH'+theme || force==1)
	{
		document.getElementById("divNewMail").className='cachediv';
		document.getElementById("divCible").className='cachediv';
		document.getElementById("divDos").className='listeH'+theme;
		document.getElementById("divList").className='cachediv';
		document.getElementById("divInter").className='inter';
		document.getElementById("divView").className='listeB'+theme;
		ajusteView();
		voirFrame.location='/vide2.php';
		loadFragmentInToElement("dossier.php?rep="+rep+"&tri="+tri, "divDos",0,0,"<br><br><div align=center>Chargement du dossier en cours<br><br><img src=/img/waiting.gif width=18 height=18 border=0>","");
	}
}


function showListMail(theme)
{
	if(document.getElementById("divNewMail").className=='fullDivNew'+theme ||  document.getElementById("divCible").className=='fullDivNew'+theme ||  document.getElementById("divDos").className=='listeH'+theme)
	{
		document.getElementById("divNewMail").className='cachediv';
		document.getElementById("divCible").className='cachediv';
		document.getElementById("divDos").className='cachediv';
		document.getElementById("divList").className='listeH'+theme;
		document.getElementById("divInter").className='inter';
		document.getElementById("divView").className='listeB'+theme;
		ajusteView();
		voirFrame.location='/vide2.php';
	}
}


function moveDivContent(div1,div2)
{
var element1 = document.getElementById(div1);
var element2 = document.getElementById(div2);
element2.innerHTML = element1.innerHTML;
}


function loadListMail(theme)
{
	showListMail(theme);
	loadFragmentInToElement("liste2.php?fromAjax=1", "divList",0,0,"<br><br><div align=center>Chargement en cours<br><br><img src=/img/waiting.gif width=18 height=18 border=0>","moveDivContent('divCompteMail','divReceptionCompteMail')");
}


/* */
function fiche_pop4(s,l,h) 
{
	var winwidth = ""+l+""; var winheight = ""+h+"";
	var xMax = screen.width;var yMax = screen.height;
	var xOffset = (xMax - winwidth)/2, yOffset = (yMax - winheight)/2+100;
	locat=""+s+"";
	ff=window.open(locat,'nouveau_sujet','width='+winwidth+',height='+winheight+',screenX='+xOffset+',screenY='+yOffset+',top='+yOffset+',left='+xOffset+',scrollbars=yes,resizable=yes');
	ff.focus();
}


function fiche_pop3(s,l,h) 
{
	var winwidth = ""+l+""; var winheight = ""+h+"";
	var xMax = screen.width;var yMax = screen.height;
	var xOffset = (xMax - winwidth)/2, yOffset = (yMax - winheight)/2;
	locat=""+s+"";
	window.open(locat,'nouveau_sujet','width='+winwidth+',height='+winheight+',screenX='+xOffset+',screenY='+yOffset+',top='+yOffset+',left='+xOffset+',scrollbars=yes,resizable=yes');
}


function Status ( texte )
  {
  window.status = texte
  }
 
function mkContactdest(mail)
{
	if(window.opener.document.form_envoi.dest.value=='')
	{
		window.opener.document.form_envoi.dest.value=mail;
	}
	else
	{
		window.opener.document.form_envoi.dest.value=window.opener.document.form_envoi.dest.value+', '+mail;
	}
}

function mkContactcc(mail)
{
	if(window.opener.document.form_envoi.cc.value=='')
	{
		window.opener.document.form_envoi.cc.value=mail;
	}
	else
	{
		window.opener.document.form_envoi.cc.value=window.opener.document.form_envoi.cc.value+', '+mail;
	}
}

function mkContactbcc(mail)
{
	if(window.opener.document.form_envoi.bcc.value=='')
	{
		window.opener.document.form_envoi.bcc.value=mail;
	}
	else
	{
		window.opener.document.form_envoi.bcc.value=window.opener.document.form_envoi.bcc.value+', '+mail;
	}
}



function dispChoix2()
{
	var erreur = 0;
	var nbmail = 0;
	var result = "" ;
	for (var i=0; i<document.selectionForm.length;i++)
	{
		if (document.selectionForm[i].checked)
		{
			result += document.selectionForm[i].value + "|" ;
			erreur = 1;
			nbmail=nbmail+1;
		}
	}
		if (erreur == 0)
		{
			alert('Cochez les messages que vous souhaitez supprimer.');
		}
		else
		{
			if(nbmail==1)
			mess='ce message';
			else
			mess='ces '+nbmail+' messages';
			if (confirm('Voulez-vous vraiment supprimer '+mess+'\nde façon permanente ?'))
			{
				loadFragmentInToElementPOST("liste2.php", 'divList',0, 0,'<br><br><div align=center><img src=/img/waiting.gif width=18 height=18 border=0></div>',"moveDivContent('divCompteMail','divReceptionCompteMail')",'selection='+result);
			}
			else 
			{
				
			}
		}
}


function dispChoixDos2(rep)
{
	var erreur = 0;
	var nbmail = 0;
	var result = "" ;
	for (var i=0; i<document.selectionFormDos.length;i++)
	{
		if (document.selectionFormDos[i].checked)
		{
			result += document.selectionFormDos[i].value + "|" ;
			erreur = 1;
			nbmail=nbmail+1;
		}
	}
		if (erreur == 0)
		{
			alert('Cochez les messages que vous souhaitez supprimer.');
		}
		else
		{
			if(nbmail==1)
			mess='ce message';
			else
			mess='ces '+nbmail+' messages';
			if (confirm('Voulez-vous vraiment supprimer '+mess+'\nde façon permanente ?'))
			{
				loadFragmentInToElementPOST("dossier.php?rep="+rep, 'divDos',0, 0,'<br><br><div align=center>Chargement du dossier en cours<br><br><img src=/img/waiting.gif width=18 height=18 border=0></div>',"",'rep='+rep+'&selection='+result);


			}
			else 
			{
				
			}
		}
}


function effaceMails2()
{
	erreur = 0;
	dml = document.forms("selectionForm");
	len = dml.elements.length;
	document.forms("selectionForm").action = "effaceMails.php";
	var i=0;
	for( i=0 ; i<len ; i++)
	{
		if (dml.elements[i].name== 'selection[]' && dml.elements[i].checked == 1) erreur = 1;
	}
	if (erreur == 0)
	{
		alert('Cochez les cases\naffichées à coté des messages que vous souhaitez supprimer.');
	}
	else
	{
		if (confirm('Voulez-vous vraiment supprimer le(s) message(s)\n sélectionné(s) de façon permanente ?')) document.forms("selectionForm").submit();
	}
}


function setPointerById(rowNum, thePointerColor)
{
	theRow=document.getElementById(rowNum);
	if (typeof(theRow.style) == 'undefined' || typeof(theRow.cells) == 'undefined') {
        return false;
    }
    var row_cells_cnt           = theRow.cells.length;
    for (var c = 0; c < row_cells_cnt; c++) {
        theRow.cells[c].bgColor = thePointerColor;
    }
    return true;
}

function setPointerByIdDouble(rowNum, thePointerColor)
{
	setPointerById('un'+rowNum, thePointerColor);
	setPointerById('deux'+rowNum, thePointerColor);
}

function setPointer(theRow, thePointerColor)
{
	if (typeof(theRow.style) == 'undefined' || typeof(theRow.cells) == 'undefined') {
        return false;
    }

    var row_cells_cnt           = theRow.cells.length;
    for (var c = 0; c < row_cells_cnt; c++) {
        theRow.cells[c].bgColor = thePointerColor;
    }

    return true;
}


function SetChecked(val,chkName)
{
	var i=0;
	var mess='';
	for( i=0 ; i<document.selectionForm.length ; i++)
	{
	
				
		if (document.selectionForm[i].name==chkName) 
		{
		unDivString="un"+document.selectionForm[i].value;
		unDivString=unDivString.replace('_', '-');
		unDiv=document.getElementById( unDivString );
		mess=mess+' '+unDiv.className;
		if(unDiv.className=="")
		document.selectionForm[i].checked=val;
		}
	}
	if(val==0)
	{
		document.getElementById('check').innerHTML='<a href="#" onClick="SetChecked(1,\'selection[]\');"><img src="img/checkboxOff.gif" align="absmiddle" title="Sélectionner tous les messages" alt="Sélectionner tous les messages" width="13" height="13" border="0" /></a>';
	}
	else
	{
		document.getElementById('check').innerHTML='<a href="#" onClick="SetChecked(0,\'selection[]\');"><img src="img/checkboxOn.gif" align="absmiddle" title="Annuler la sélection de tous les messages" alt="Annuler la sélection de tous les messages" width="13" height="13" border="0" /></a>';
	}
	//alert(mess);
}



function SetCheckedDos(val,chkName)
{
	var i=0;
	var mess='';
	for( i=0 ; i<document.selectionFormDos.length ; i++)
	{
	
				
		if (document.selectionFormDos[i].name==chkName) 
		{
		document.selectionFormDos[i].checked=val;
		}
	}
	if(val==0)
	{
		document.getElementById('checkDos').innerHTML='<a href="#" onClick="SetCheckedDos(1,\'selection[]\');"><img src="img/checkboxOff.gif" align="absmiddle" title="Sélectionner tous les messages" alt="Sélectionner tous les messages" width="13" height="13" border="0" /></a>';
	}
	else
	{
		document.getElementById('checkDos').innerHTML='<a href="#" onClick="SetCheckedDos(0,\'selection[]\');"><img src="img/checkboxOn.gif" align="absmiddle" title="Annuler la sélection de tous les messages" alt="Annuler la sélection de tous les messages" width="13" height="13" border="0" /></a>';
	}
	//alert(mess);
}


function send_attacher()
{
	if (document.form_envoi.send_att.value != "")
	{
		document.form_envoi.send_action.value = "add";
		document.form_envoi.submit();
	}
}

function send_detacher(nom)
{
	document.form_envoi.send_action.value = "delete_"+nom;
	document.form_envoi.submit();
}

function send_ok()
{
	document.form_envoi.send_action.value = "ok";
	document.form_envoi.submit();
}

function send_invit_ok()
{
	document.form_envoi.send_action.value = "ok";
	document.form_envoi.avecInvit.value = "1";
	document.form_envoi.submit();
}

function send_html_ok()
{
	document.form_envoi.send_action.value = "ok";
	document.form_envoi.texte.value=document.all["div_texte"].innerHTML;
	document.form_envoi.submit();
	
}

function mailHtml(selObj)
{

		var num = selObj.options[selObj.selectedIndex].value;
		

		if(num == 1)
		{
			document.form_envoi.send_action.value = "html";
			document.form_envoi.send_from_texte.value = "1";
			document.form_envoi.submit();
		}
		else
		{
			// alert(num);
			// document.form_envoi.texte.value=document.all["div_texte"].innerHTML;
			document.form_envoi.send_action.value = "texte";
			document.form_envoi.send_from_html.value = "1";
			document.form_envoi.submit();
		}
}


function suppr_ligne(nomtr)
{
        //num = object.substr(6);
        //object2 = "ligne2_" + num;
                ligne = document.getElementById(nomtr).rowIndex;
                document.getElementById("resultSet").deleteRow(ligne);
}


function go_to(select)
{

//alert("Le selectedIndex est: " + select.selectedIndex + "\n" +
//"La valeur de la ligne est: " + select.value + "\n" +
//"Le nombre de lignes est: " + select.length + "." ) ;

voirFrame.location=select.value;

}

function go_to2(select,cible)
{
cible.location=select.value;
}

function go_to3(select,theme)
{
alterDiv(theme,select.value);
}


function lienClassOn(objet,classe)
{
	if (objet) objet.className=''+classe+'';
}
function lienClassOff(objet,classe)
{
	if (objet) objet.className=''+classe+'';
}


function clearSpan(span)
{
	document.getElementById(span).innerHTML = '&nbsp;';
}

function loadFragmentInToElementNew(fichier)
{
if(window.XMLHttpRequest) // FIREFOX
xhr_object = new XMLHttpRequest();
else if(window.ActiveXObject) // IE
xhr_object = new ActiveXObject("Microsoft.XMLHTTP");
else
return(false);
xhr_object.open("GET", fichier, false);
xhr_object.send(null);
if(xhr_object.readyState == 4) return(xhr_object.responseText);
else return(false);
}

function writediv(texte)
     {
     document.getElementById('pseudobox').innerHTML = texte;
     }


	 



function makeCurrentMailRead()
{
var idUniqueMailCurrent=document.getElementById('divUniqueMailCurrent').innerHTML;
//alert ('ici'+idUniqueMailCurrent);
document.getElementById(idUniqueMailCurrent).className='mailLu';
}


function loadFragmentInToElement(fragment_url, element_id,delay, reload,message,fonc) { 

	var xmlhttp=false; 
	var ns6 = document.getElementById && !document.all;
	var ie4 = document.all;
	if(ns6)
	{
		var xmlhttp = new XMLHttpRequest();
	}
	else if(ie4)
	{
		var xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
	}
    var element = document.getElementById(element_id); 
	if(message == '')
	{
	message='';
	}
	else
	{
	element.innerHTML = message;
    }
	xmlhttp.open("GET", fragment_url); 
    xmlhttp.onreadystatechange = function() { 
      if (xmlhttp.readyState == 4 && xmlhttp.status == 200) { 
      element.innerHTML = xmlhttp.responseText; 
		if(delay>0)
		{
			window.setTimeout('clearSpan(\''+element_id+'\')',delay);
		}
		if(reload>0)
		{
			window.setTimeout('loadFragmentInToElement(\''+fragment_url+'\', \''+element_id+'\', \''+delay+'\', \''+reload+'\',\''+message+'\')',reload);
		}
		if(fonc!= "")
		{
			eval(fonc);
			//alert('ici');
		}
      } 
    } 
    if(ns6)
	{
		xmlhttp.send(null);
	}
	else if(ie4)
	{
		xmlhttp.send();
	}
} 


function loadFragmentInToElementPOST(fragment_url, element_id,delay, reload,message,fonc,value) { 

	var xmlhttp=false; 
	var ns6 = document.getElementById && !document.all;
	var ie4 = document.all;
	if(ns6)
	{
		var xmlhttp = new XMLHttpRequest();
	}
	else if(ie4)
	{
		var xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
	}
    var element = document.getElementById(element_id); 
	if(message == '')
	{
	message='';
	}
	else
	{
	element.innerHTML = message;
    }
	xmlhttp.open("POST", fragment_url);
	xmlhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); 
	
	var corps = value;
    

	
    xmlhttp.onreadystatechange = function() { 
      if (xmlhttp.readyState == 4 && xmlhttp.status == 200) { 
      element.innerHTML = xmlhttp.responseText; 
		if(delay>0)
		{
			window.setTimeout('clearSpan(\''+element_id+'\')',delay);
		}
		if(reload>0)
		{
			window.setTimeout('loadFragmentInToElement(\''+fragment_url+'\', \''+element_id+'\', \''+delay+'\', \''+reload+'\',\''+message+'\')',reload);
		}
		if(fonc!= "")
		{
			eval(fonc);
			//alert('ici');
		}
      } 
    } 
    if(ns6)
	{
		xmlhttp.send(corps);
	}
	else if(ie4)
	{
		xmlhttp.send(corps);
	}
}



function addText(instext) {
    var mess = document.form_envoi.texte;
        //IE support
        if (document.selection) {
            mess.focus();
            sel = document.selection.createRange();
            sel.text = instext;
            document.form_envoi.focus();
        }
        //MOZILLA/NETSCAPE support
        else if (mess.selectionStart || mess.selectionStart == "0") {
            var startPos = mess.selectionStart;
            var endPos = mess.selectionEnd;
            var chaine = mess.value;

            mess.value = chaine.substring(0, startPos) + instext + chaine.substring(endPos, chaine.length);

            mess.selectionStart = startPos + instext.length;
            mess.selectionEnd = endPos + instext.length;
            mess.focus();
        } else {
            mess.value += instext;
            mess.focus();
        }
    }
function insertSig(selObj)
{
		var num = selObj.options[selObj.selectedIndex].value;
		addText(num);
}
function insertSig2(selObj)
{

		var num = selObj.options[selObj.selectedIndex].value;
		//addText2(num);
		// var mess = texte___Frame.eEditorArea.innerHTML;
	//document.form_envoi.texte.value=document.all["div_texte"].innerHTML;
	//document.form_envoi.submit();
		//alert('r'+mess);
		addText2(num);
		//alert('ok'+num);
		//FCKeditor.prototype._InsertHtmlBefore
		
}


function addText2new(instext) {
    
	alert('ici'+instext);
	//var mess = window.texte___Frame.eEditorArea;
	
	//var mess = document.getElementById('texte___Frame').eEditorArea;
	var ns6 = document.getElementById && !document.all;
	var ie4 = document.all;
	if(ns6)
	{
		alert('okmo'+instext);
            var startPos = mess.selectionStart;
            var endPos = mess.selectionEnd;
            var chaine = mess.value;

            mess.value = chaine.substring(0, startPos) + instext + chaine.substring(endPos, chaine.length);

            mess.selectionStart = startPos + instext.length;
            mess.selectionEnd = endPos + instext.length;
            mess.focus();
	}
	else if(ie4)
	{
		alert('okie'+instext);
            mess.focus();
            sel = document.selection.createRange();
            sel.text = instext;
			
            
	}
	else
	{
		alert('okautre'+instext);
            mess.value += instext;
            mess.focus();
	}
    
    }
	
function insertHtml(html) {
  iframe.contentDocument.body.innerHTML = html;
}


function addText2(instext) {
    
	
	// insertion de img qui marche sous ie : var oImg = window.texte___Frame.FCK.CreateElement( 'IMG' ) ;
	// puis oImg.src = 'http://www.jump2mail.com/img/fraise3_16.gif' ;
	
	// IMPORTANT : mettre l'attribut  NAME dans la frame pour que cela fonctionne avec firefox
	// dans fckeditor.php :
	// Render the editor IFRAME.
	// $Html .= "<iframe id=\"{$this->InstanceName}___Frame\" name=\"{$this->InstanceName}___Frame\" src=\"{$Link}\" width=\"{$this->Width}\" height=\"{$this->Height}\" frameborder=\"no\" scrolling=\"no\"></iframe>" ;


	var ns6 = document.getElementById && !document.all;
	var ie4 = document.all;
	instext='<!--JTAGS1-->'+instext+'<!--JTAGS2-->';
	
	if(ns6)
	{
		window.frames['texte___Frame'].FCK.InsertHtml( instext );
	}
	else if(ie4)
	{
		window.texte___Frame.FCK.InsertHtml( instext )
	}

	
    }


    
function DivShowHide( nom,imgID )
{
	var divID = nom ;
	var imgNom = imgID ;
	if ( document.getElementById && document.getElementById( divID ) ) // Pour les navigateurs récents
		{
			leBonDiv = document.getElementById( divID );
			leTest = true;
 		}
	else if ( document.all && document.all[ divID ] ) // Pour les veilles versions
		{
			leBonDiv = document.all[ divID ];
			leTest = true;
		}
	else if ( document.layers && document.layers[ divID ] ) // Pour les très veilles versions
		{
			leBonDiv = document.layers[ divID ];
			leTest = true;
		}
	else
		{
			leTest = false;
		}
	if ( leTest )
		{
			leBonDiv.className = ( leBonDiv.className == 'cachediv' ) ? '' : 'cachediv';
		}

	if(imgNom!='')
	{
	if(leBonDiv.className == 'cachediv' )
	{
		document.getElementById( imgNom ).src=imOuvre.src
	}
	else
	{
		document.getElementById( imgNom ).src=imFerme.src
	}
	}
}

imFerme = new Image;
imFerme.src = "/bookmark/img/open3.gif";
imOuvre = new Image;
imOuvre.src = "/bookmark/img/fold3.gif";

function checkRead(tour,flux,ink)
{
	var nom='spArt'+tour;
	if(document.getElementById(nom).className=='mailNonLu' )
	{
		loadFragmentInToElement("save.php?flux="+flux+"&link="+ink+"", "read"+tour+"",0,0,"","");
		parent.voirListeMail.refreshFavoriBox();
	}
}



		
			function showHideMail2(compte,nom,stringuette,show,hide)
			{
			

			//var string_'.$k.'="'.$v.'";

			//alert(stringuette);
			eval("explodestring=stringuette.split(\'|\')");
			var part_num=0;
			while (part_num < explodestring.length)
				{
					//alert(explodestring[part_num]);
					unDiv = document.getElementById( "un"+explodestring[part_num] );
					unDiv.className = ( unDiv.className == "cachediv" ) ? "" : "cachediv";
					document.getElementById(nom).innerHTML = ( unDiv.className == "cachediv" ) ? ""+show+"" : ""+hide+"";
					
					//nom.value= ( unDiv.className == "cachediv" ) ? "[ouvrir]" : "[masquer]";
					
					//deuxDiv = document.getElementById( "deux"+explodestring[part_num] );
					//deuxDiv.className = ( deuxDiv.className == "cachediv" ) ? "" : "cachediv";
					part_num+=1;
				}
			}
			
			

function ouvrirBonBox(nomBonBox,px,py)
{
	
	if(px>0)
	{
	document.getElementById(nomBonBox).style.left=px-document.getElementById(nomBonBox).offsetWidth-14;
	}
	else
	{
	document.getElementById(nomBonBox).style.left =(document.body.clientWidth-document.getElementById(nomBonBox).offsetWidth)/2;
	}
	
	if(py>0)
	{
	document.getElementById(nomBonBox).style.top=py-document.getElementById(nomBonBox).offsetHeight-14;
	}
	else
	{
	document.getElementById(nomBonBox).style.top =(document.body.clientHeight-document.getElementById(nomBonBox).offsetHeight)/2;
	}
	
	document.getElementById(nomBonBox).style.visibility = "visible";

}

function fermeBonBox(nomBonBox)
{
	document.getElementById(nomBonBox).style.visibility = "hidden";
}
-->