var individuSelectionne = "";




var IB=new Object;
var posX=0;posY=0;
var xOffset=-10;yOffset=0;
function AffBulle(texte) {
  contenu="<TABLE border=0 cellspacing=0 cellpadding="+IB.NbPixel+"><TR bgcolor='"+IB.ColContour+"'><TD><TABLE border=0 cellpadding=2 cellspacing=0 bgcolor='"+IB.ColFond+"'><TR><TD><FONT size='-1' face='arial' color='"+IB.ColTexte+"'>"+texte+"</FONT></TD></TR></TABLE></TD></TR></TABLE>&nbsp;";
  var finalPosX=posX-xOffset;
  if (finalPosX<0) finalPosX=0;
  if (document.layers) {
    document.layers["bulle"].document.write(contenu);
    document.layers["bulle"].document.close();
    document.layers["bulle"].top=posY+yOffset;
    document.layers["bulle"].left=finalPosX;
    document.layers["bulle"].visibility="show";}
  if (document.all) {
    //var f=window.event;
    //doc=document.body.scrollTop;
    bulle.innerHTML=contenu;
    document.all["bulle"].style.top=posY+yOffset;
    document.all["bulle"].style.left=finalPosX;//f.x-xOffset;
    document.all["bulle"].style.visibility="visible";
  }
  //modif CL 09/2001 - NS6 : celui-ci ne supporte plus document.layers mais document.getElementById
  else if (document.getElementById) {
    document.getElementById("bulle").innerHTML=contenu;
    document.getElementById("bulle").style.top=posY+yOffset;
    document.getElementById("bulle").style.left=finalPosX;
    document.getElementById("bulle").style.visibility="visible";
  }
}



function overIndividu(rowTi){


if (document.getElementById) {

document.getElementById(rowTi).style.background = "#AOCFCA";
}

else
if (document.all) {
//document.all[rowTi].style.background = "#AOCFCA";

    //document.layers[rowTi].document.write(contenu);
//alert(document.layers[rowTi]);
}
}

function outIndividu(rowTi){

document.getElementById(rowTi).style.background = "#ffffcc";

}


function getMousePos(e) {
  if (document.all) {
  posX=event.x+document.body.scrollLeft; //modifs CL 09/2001 - IE : regrouper l'évènement
  posY=event.y+document.body.scrollTop;
  }
  else {
  posX=e.pageX; //modifs CL 09/2001 - NS6 : celui-ci ne supporte pas e.x et e.y
  posY=e.pageY; 
  }
}
function HideBulle() {
	if (document.layers) {document.layers["bulle"].visibility="hide";}
	if (document.all) {document.all["bulle"].style.visibility="hidden";}
	else if (document.getElementById){document.getElementById("bulle").style.visibility="hidden";}
}

function InitBulle(ColTexte,ColFond,ColContour,NbPixel) {
	IB.ColTexte=ColTexte;IB.ColFond=ColFond;IB.ColContour=ColContour;IB.NbPixel=NbPixel;
	if (document.layers) {
		window.captureEvents(Event.MOUSEMOVE);window.onMouseMove=getMousePos;
		document.write("<LAYER name='bulle' top=0 left=0 visibility='hide'></LAYER>");
	}
	if (document.all) {
		document.write("<DIV id='bulle' style='position:absolute;top:0;left:0;visibility:hidden'></DIV>");
		document.onmousemove=getMousePos;
	}
	//modif CL 09/2001 - NS6 : celui-ci ne supporte plus document.layers mais document.getElementById
	else if (document.getElementById) {
	        document.onmousemove=getMousePos;
	        document.write("<DIV id='bulle' style='position:absolute;top:0;left:0;visibility:hidden'></DIV>");
	}

}


function AffMenu(texte,idProject) 
{
   // Variables locales
   var menu = ""
   var i = 1
   var strClass=""
   var strLib=""
   var strLien=""
   var ColTexte = IB.ColTexte
   var ColFond = IB.ColFond
   var ColContour = IB.ColContour
   var NbPixel = IB.NbPixel

   //***********
         
   // Construction du tableau
   contenu='        <TABLE border=0 cellspacing=0 cellpadding=0 style="border:1.5pt outset">'
   contenu=contenu + '      <TR bgcolor="#7F97AF">'
   contenu=contenu + '         <TD>'   
   contenu=contenu + '            <TABLE border="0" bgcolor="#7F97AF">'

   menu = GetCol(texte, i, "*")

   while (menu != "")
   {
      contenu=contenu + '            <TR>'
      contenu=contenu + '               <TD'
      if (GetCol(texte, i+1, "*")!="")
      {
         contenu=contenu + '                style="border-bottom:1.5pt groove" '
      }   


		contenu=contenu + '                   onmouseover="'
	if (idProject != "")
	 {
      contenu=contenu + ' selectProject('+idProject+');'
      }
     contenu=contenu + ' this.style.background=\'#4F607F\'"'
      
      contenu=contenu + 'onmouseout="'
      if (idProject != "")
	 {
      contenu=contenu + 'deselectProject('+idProject+');'
      }
      contenu=contenu + 'this.style.background=\'#7F97AF\'">'
      

      strLib=GetCol(menu, 1, "@")
      strLien=GetCol(menu, 2, "@")

      contenu=contenu + '               <a id="menu'+i+'" name="menu'+i+'" href="' + strLien + '"'
      contenu=contenu + '               style="text-decoration:none;color:#000000;font-family:arial">'
      contenu=contenu + strLib + '</a>'

      contenu=contenu + '               </TD>'
      contenu=contenu + '            </TR>'

      i=i+1
      menu = GetCol(texte, i, "*")
   }
   contenu=contenu + '            </TABLE>'
   contenu=contenu + '         </TD>'
   contenu=contenu + '      </TR>'
   contenu=contenu + ' </TABLE>'
   
   
   

   IB.ColTexte=""
   IB.ColFond=""
   IB.ColContour=""
   IB.NbPixel=0

   if (document.layers) 
   {
      document.layers["bulle"].document.write(contenu);
      document.layers["bulle"].document.close();
      document.layers["bulle"].top=posY;
      document.layers["bulle"].left=posX;
      document.layers["bulle"].visibility="show";
   }

   if (document.all) 
   {
      bulle.innerHTML=contenu;
      document.all["bulle"].style.top=posY;
      document.all["bulle"].style.left=posX;
      document.all["bulle"].style.visibility="visible";
   }
   else if (document.getElementById) {
      document.getElementById("bulle").innerHTML=contenu;
      document.getElementById("bulle").style.top=posY;
      document.getElementById("bulle").style.left=posX;
      document.getElementById("bulle").style.visibility="visible";
   }
   IB.ColTexte=ColTexte;
   IB.ColFond=ColFond;
   IB.ColContour=ColContour;
   IB.NbPixel=NbPixel;
} 


function GetCol(strChaine, iCol, strSep)
   {
      var j=1;   
      var strRetour=""

      if (strSep == "")
      {
         strSep = "@";
      }
   
      while (j<=iCol)
      {
         strRetour = strChaine.substring(0, strChaine.indexOf(strSep,0));
         if (strRetour=="" && strChaine!="")
         {
            if    (j==iCol)
            {
               strRetour=strChaine;
            }
            else if (strChaine.indexOf(strSep,0)!=0)
            {
               strRetour=""
               j=iCol
               }   
         }

         if (j==iCol && strChaine.indexOf(strSep,0)==0)
         {
                // Le caractère suivant étant le séparateur, on a donc une chaîne vide à renvoyer
            strRetour="";
         }

         strChaine = strChaine.substring(strChaine.indexOf(strSep,0)+1,strChaine.length);

         j=j+1;
      }

      return strRetour;
   } 

function choisirLieu(elem,elementCache)
{
	//,elementCache
	var strLieu = showModalDialog("./Popup.aspx?module=ChoixLieu",null,"scroll:0;status:0;resizable:1;dialogWidth:705px;dialogHeight:305px;dialogLeft:300px;dialogTop:300px");
	if (strLieu != undefined)
	{
		var alt = strLieu.indexOf("@");
		var idLieuStr = strLieu.substring(0,alt);
		var labelLieuStr = strLieu.substring(alt+1);
		document.getElementById(elem).value = labelLieuStr;
		document.getElementById(elementCache).value = idLieuStr;	
	}
}

function choisirDate(elem)
{
	//,elementCache
	var strDate = showModalDialog("./Popup.aspx?module=ChoisirDate",null,"scroll:0;status:0;resizable:1;dialogWidth:605px;dialogHeight:335px;dialogLeft:300px;dialogTop:300px");
	if (strDate != undefined)
	{
		document.getElementById(elem).value = strDate;
	}
}

function effaceInd(ind)
{
	if(confirm("Voulez vous vraiment supprimer cet individu"))
	{
	var strEff = showModalDialog("./Popup.aspx?module=EffaceIndividu&id="+ind,null,"scroll:0;status:0;resizable:1;dialogWidth:605px;dialogHeight:335px;dialogLeft:300px;dialogTop:300px");
	if (strEff != undefined)
	{
		
	}
	}
}

function editInd(ind)
{
	window.location.assign("index.aspx?chapitre=Administration&rubrique=EditPersonne&ind="+ind);
}

function editMariage(ind)
{
	//window.location.assign("index.aspx?chapitre=Administration&rubrique=EditPersonne&ind="+ind);
	//window.alert("Pas encore developpé");
}

function effaceMariage(ind)
{
	//window.location.assign("index.aspx?chapitre=Administration&rubrique=EditPersonne&ind="+ind);
	//window.alert("Pas encore developpé");
}


function effacePhotoAjout(idPhot)
{
	var strPhotDElAjout = showModalDialog("./Popup.aspx?module=EffacePhotoAjout&id="+idPhot,null,"scroll:0;status:0;resizable:1;dialogWidth:605px;dialogHeight:335px;dialogLeft:300px;dialogTop:300px");
if(strPhotDElAjout != "toto")
	{
		window.document.location.reload();
	}
}

function effacePhotoAjoutMariage(idPhot)
{
	var strPhotDElAjout = showModalDialog("./Popup.aspx?module=EffacePhotoAjout&mariage=true&id="+idPhot,null,"scroll:0;status:0;resizable:1;dialogWidth:605px;dialogHeight:335px;dialogLeft:300px;dialogTop:300px");
if(strPhotDElAjout != "toto")
	{
		window.document.location.reload();
	}
}


function effacePhotoAjoutEdit(idPhot)
{
	var strPhotDElAjout = showModalDialog("./Popup.aspx?module=EffacePhotoAjout&edit=yes&id="+idPhot,null,"scroll:0;status:0;resizable:1;dialogWidth:605px;dialogHeight:335px;dialogLeft:300px;dialogTop:300px");
if(strPhotDElAjout != "toto")
	{
		window.document.location.reload();
	}
}

function effaceEnfantAjout(idPhot)
{
		var strEnfDElAjout = showModalDialog("./Popup.aspx?module=EffaceEnfantAjout&id="+idPhot,null,"scroll:0;status:0;resizable:1;dialogWidth:605px;dialogHeight:335px;dialogLeft:300px;dialogTop:300px");
		if(strEnfDElAjout != "toto")
		{
			window.document.location.reload();
		}	
}


function effaceEnfantAjout(idPhot)
{
		var strEnfDElAjout = showModalDialog("./Popup.aspx?module=EffaceEnfantAjout&edit=yes&id="+idPhot,null,"scroll:0;status:0;resizable:1;dialogWidth:605px;dialogHeight:335px;dialogLeft:300px;dialogTop:300px");
		if(strEnfDElAjout != "toto")
		{
			window.document.location.reload();
		}	
}

function resetPereAjout()
{
	var strEnfDElAjout = showModalDialog("./Popup.aspx?module=EffacePereAjout",null,"scroll:0;status:0;resizable:1;dialogWidth:605px;dialogHeight:335px;dialogLeft:300px;dialogTop:300px");
if(strEnfDElAjout != "toto")
	{
		window.document.location.reload();
	}
}

function resetEpouxAjout()
{
	var strEnfDElAjout = showModalDialog("./Popup.aspx?module=EffacePereAjout&mariage=true",null,"scroll:0;status:0;resizable:1;dialogWidth:605px;dialogHeight:335px;dialogLeft:300px;dialogTop:300px");
if(strEnfDElAjout != "toto")
	{
		window.document.location.reload();
	}
}

function resetEpouseAjout()
{
	var strEnfDElAjout = showModalDialog("./Popup.aspx?module=EffaceMereAjout&mariage=true",null,"scroll:0;status:0;resizable:1;dialogWidth:605px;dialogHeight:335px;dialogLeft:300px;dialogTop:300px");
if(strEnfDElAjout != "toto")
	{
		window.document.location.reload();
	}
}

function resetMereAjout()
{
	var strEnfDElAjout = showModalDialog("./Popup.aspx?module=EffaceMereAjout",null,"scroll:0;status:0;resizable:1;dialogWidth:605px;dialogHeight:335px;dialogLeft:300px;dialogTop:300px");
if(strEnfDElAjout != "toto")
	{
		window.document.location.reload();
	}
}





function resetPere()
{
	var strEnfDElAjout = showModalDialog("./Popup.aspx?module=EffacePere",null,"scroll:0;status:0;resizable:1;dialogWidth:605px;dialogHeight:335px;dialogLeft:300px;dialogTop:300px");
if(strEnfDElAjout != "toto")
	{
		window.document.location.reload();
	}
}

function resetMere()
{
	var strEnfDElAjout = showModalDialog("./Popup.aspx?module=EffaceMere",null,"scroll:0;status:0;resizable:1;dialogWidth:605px;dialogHeight:335px;dialogLeft:300px;dialogTop:300px");
if(strEnfDElAjout != "toto")
	{
		window.document.location.reload();
	}
}

function choisirPere()
{
	var strPere = showModalDialog("./Popup.aspx?module=ChoisirParent&pere=true",null,"scroll:0;status:0;resizable:1;dialogWidth:605px;dialogHeight:335px;dialogLeft:300px;dialogTop:300px");
if(strPere != "toto")
	{
		window.document.location.reload();
	}
}

function choisirMere()
{
	var strMere = showModalDialog("./Popup.aspx?module=ChoisirParent&mere=true",null,"scroll:0;status:0;resizable:1;dialogWidth:605px;dialogHeight:335px;dialogLeft:300px;dialogTop:300px");
if(strMere != "toto")
	{
		window.document.location.reload();
	}
}

function choisirEpoux()
{
	var strEpoux = showModalDialog("./Popup.aspx?module=ChoisirParent&pere=true&mariage=true",null,"scroll:0;status:0;resizable:1;dialogWidth:605px;dialogHeight:335px;dialogLeft:300px;dialogTop:300px");
if(strEpoux != "toto")
	{
		window.document.location.reload();
	}
}

function choisirEpouse()
{
	var strEpouse = showModalDialog("./Popup.aspx?module=ChoisirParent&mere=true&mariage=true",null,"scroll:0;status:0;resizable:1;dialogWidth:605px;dialogHeight:335px;dialogLeft:300px;dialogTop:300px");
if(strEpouse != "toto")
	{
		window.document.location.reload();
	}
}


function editMere()
{
	var strMere = showModalDialog("./Popup.aspx?module=EditParents&mere=true",null,"scroll:0;status:0;resizable:1;dialogWidth:605px;dialogHeight:335px;dialogLeft:300px;dialogTop:300px");
if(strMere != "toto")
	{
		window.document.location.reload();
	}
}

function editPere()
{
	var strMere = showModalDialog("./Popup.aspx?module=EditParents&pere=true",null,"scroll:0;status:0;resizable:1;dialogWidth:605px;dialogHeight:335px;dialogLeft:300px;dialogTop:300px");
if(strMere != "toto")
	{
		window.document.location.reload();
	}
}

function editEnfants()
{
	var strMere = showModalDialog("./Popup.aspx?module=EditParents&enfants=true",null,"scroll:0;status:0;resizable:1;dialogWidth:605px;dialogHeight:335px;dialogLeft:300px;dialogTop:300px");
if(strMere != "toto")
	{
		window.document.location.reload();
	}
}


function ajouteEnfants()
{
	var strMere = showModalDialog("./Popup.aspx?module=ChoisirParent&enfants=true",null,"scroll:0;status:0;resizable:1;dialogWidth:605px;dialogHeight:335px;dialogLeft:300px;dialogTop:300px");
if(strMere != "toto")
	{
		window.document.location.reload();
	}
}


function ajouteDocument()
{
	var strDoc = showModalDialog("./Popup.aspx?module=AjoutePhotos",null,"scroll:0;status:0;resizable:1;dialogWidth:605px;dialogHeight:335px;dialogLeft:300px;dialogTop:300px");
	if(strDoc != "toto")
	{
		window.document.location.reload();
	}
}

function ajouteDocumentMariage()
{
	var strDoc = showModalDialog("./Popup.aspx?module=AjoutePhotos&mariage=true",null,"scroll:0;status:0;resizable:1;dialogWidth:605px;dialogHeight:335px;dialogLeft:300px;dialogTop:300px");
	if(strDoc != "toto")
	{
		window.document.location.reload();
	}
}

function ajouteMessage()
{
	var strDoc = showModalDialog("./Popup.aspx?module=Messages/AjoutMessage",null,"scroll:0;status:0;resizable:1;dialogWidth:555px;dialogHeight:485px;dialogLeft:300px;dialogTop:300px");
	if(strDoc != "toto")
	{
		window.document.location.reload();
	}
}

function annuleLieu(elem,elementCache)
{

		document.getElementById(elem).value = "";
		document.getElementById(elementCache).value = "-1";	
	
}

function annuleDate(elem)
{
		document.getElementById(elem).value = "";
}




function selectionnePersonne(ind,alternate)
{
	
	individuSelectionne = ind;
	
	if(ind == "null")
	{
		individuSelectionne = ind;
		return;
	}
if(alternate=="alternate")	
		{
	if(individuSelectionne != "") {
		document.getElementById("ind" + individuSelectionne).className = "ligneAlternative";
	}
	individuSelectionne = ind;
	document.getElementById("ind").value = ind;
	document.getElementById("ind" + ind).className = "elementSelectionne";
	}
	else
	{
	if(individuSelectionne != "") {
		document.getElementById("ind" + individuSelectionne).className = "ligneNormale";
	}
	individuSelectionne = ind;
	document.getElementById("ind").value = ind;
	document.getElementById("ind" + ind).className = "elementSelectionne";
	}
	
}


function deselectionnePersonne(ind,alternate)
{
	
	individuSelectionne = ind;
	if(ind == "null")
	{
		individuSelectionne = ind;
		return;
	}

	
	if(individuSelectionne != "")
	
	{
		if(alternate=="alternate")	
		{
		document.getElementById("ind" + individuSelectionne).className = "ligneAlternative";
		}
		else
		{
		document.getElementById("ind" + individuSelectionne).className = "ligneNormale";
		}
	}
	individuSelectionne = ind;
	document.getElementById("ind").value = ind;
	if(alternate=="alternate")	
		{
		document.getElementById("ind" + ind).className = "ligneAlternative";
		}
		else
		{
		document.getElementById("ind" + ind).className = "ligneNormale";
		}
	
}

function chargePagination()
{
	vari = document.getElementById("selectionnePage").value;
	
	window.location.assign("index.aspx?chapitre=Recherches&rubrique=Recherche Simple&ind="+vari);
	
}

function chargePaginationMariage()
{
	vari = document.getElementById("selectionnePage").value;
	
	window.location.assign("index.aspx?chapitre=Recherches&rubrique=Resultat Mariage&ind="+vari);
	
}

function redirectionIndividu(individu)
{
	this.location = "./Popup.aspx?module=Fiche&ind="+individu,"Individu","scrollbars=1,status=0,resizable=1";
}

function voirIndividu(individu)
{
	open("./Popup.aspx?module=Fiche&ind="+individu,"Individu","scrollbars=1,status=0,resizable=1");
}

function voirMariage(individu)
{
	open("./Popup.aspx?module=FicheMariage&ind="+individu,"Mariage","scrollbars=1,status=0,resizable=1");
}

function ouvrePop(name)
{
	showModalDialog("./Popup.aspx?module="+name,null,"scroll:0;status:0;resizable:1;dialogWidth:705px;dialogHeight:535px;dialogLeft:300px;dialogTop:300px");
}

function resize()
	{
		this.window.resizeTo(document.getElementById("DetailedPane").width+40,document.getElementById("DetailedPane").height+40);
		alert(document.getElementById("tablePopup").width+" et "+document.getElementById("tablePopup").height);
	}



