function addrub(id,menu)
{
	w		= 600;
	h 		= 160;
	t 		= (screen.height - h)/2;
	l 		= (screen.width - w)/2;
	addwin = window.open('pop_addrubrique.php?id='+id+'&menu='+menu,'a','width='+w+', height='+h+', top='+t+', left='+l+', menubar=no, scrollbars=no, resizable=no');
	addwin.focus();
}

function addicone(id)
{
	w		= 400;
	h 		= 160;
	t 		= (screen.height - h)/2;
	l 		= (screen.width - w)/2;
	addwin = window.open('pop_icone.php?id='+id,'a','width='+w+', height='+h+', top='+t+', left='+l+', menubar=no, scrollbars=yes, resizable=no');
	addwin.focus();
}

function editrub(id,menu)
{
	w		= 600;
	h 		= 125;
	t 	= (screen.height - h)/2;
	l 	= (screen.width - w)/2;
	addwin = window.open('pop_editrubrique.php?id='+id+'&menu='+menu,'a','width='+w+', height='+h+', top='+t+', left='+l+', menubar=no, scrollbars=no, resizable=no');
	addwin.focus();
}

function edit(id,content)
{
	if(true)
	{
		self.location.href = 'index.php?page='+content+'&id='+id;
	}
}

function move(id,ordre,menu)
{
	//if(confirm('Voulez-vous modifier l\'ordre de cette rubrique ?'))
	if(true)
	{
		self.location.href = 'changeordre.php?id='+id+'&ordre='+ordre+'&menu='+menu;
	}
}

function delrub(id,niv,menu)
{
	if(niv==0)
		msg = 'Vous allez supprimer une rubrique ainsi que ses sous-rubriques. Etes-vous sûr(e) ?';
	else
		msg = 'Vous allez supprimer une sous-rubrique. Etes-vous sûr(e) ?';
	if(confirm(msg))
	{
		self.location.href = 'delrubrique.php?id='+id+'&menu='+menu;
	}
}

// -- fonction deplie tr
function deplie3(id)
{
	eval ('var var1=document.getElementsByTagName("tr");');
	for(i=0;i<var1.length;i++)
	{
		if(var1[i].name=="bloc"+id)
		{
		//alert(var1[i].name);
			if (var1[i].style.display == "block")
		{
		var1[i].click();
		}
		etat = var1[i].style.display == "block" ? "none" : "block" ;
	
	var1[i].style.display = etat;
		
		}
	}
}

function deplie2(id)
{
	eval ('var var1=document.getElementsByTagName("table");');
	for(i=0;i<var1.length;i++)
	{
		if(var1[i].name=="bloc"+id)
		{
		//alert(var1[i].name);
		etat = var1[i].style.display == "block" ? "none" : "block" ;
		var1[i].style.display = etat;
//		self.location.href = '?page='+id;
		}
	}
}
//  ----------------

function modifier(valrub,id)
{
	self.location.href = "?page="+valrub+"&action=modifier&id="+id;
}

function supprimer(valrub,id)
{
	if(confirm("Vous allez effacer cet élément.\nConfirmez-vous la suppression ?"))
	{
		self.location.href = "?page="+valrub+"&action=supprimer&id="+id;
	}
}

/* cartes */

function reloadC(id,value)
{
	if(value != 0)
	{
		window.location.href='index.php?page=cartes&id='+id+'&lieu='+value;
	}
}

function getMouseXY(e) {
  if (IE) { // grab the x-y pos.s if browser is IE
    tempX = event.clientX + document.body.scrollLeft;
    tempY = event.clientY + document.body.scrollTop;
  } else {  // grab the x-y pos.s if browser is NS
    tempX = e.pageX;
    tempY = e.pageY;
  }  
  // catch possible negative values in NS4
  if (tempX < 0){tempX = 0;}
  if (tempY < 0){tempY = 0;}  
  // show the position values in the form named Show
  // in the text fields named MouseX and MouseY
  // document.editcarte.ex.value = tempX
  // document.editcarte.ey.value = tempY
  return true;
}


function setCoords()
{
	img = document.getElementById("carte");
	ex = document.getElementById("ex");
	ey = document.getElementById("ey");
	ex.value = tempX - 153;
	ey.value = tempY - 292;
}

/* */
function printpage()
{
	pageP = window.open('print.html','pageP','width=800, height=600, scrollbars=yes,location=no, menubar=yes, resizable=yes');
}

function legal()
{
	pageP = window.open('legal.html','pageP','width=300, height=300, scrollbars=yes,location=no, menubar=yes, resizable=yes');
}

function sendpage()
{
	pageS = window.open('sendP.php','pageS','width=400, height=300, scrollbars=no,location=no, menubar=no, resizable=no');	
}

function checkMail(email)
{
	var filter  = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
	if (filter.test(email)) return true;
	else return false;
}